| |
| |
| |
| |
| |
| |
| |
|
|
| import marimo |
|
|
| __generated_with = "0.9.0" |
| app = marimo.App() |
|
|
|
|
| @app.cell |
| def _(): |
| import marimo as mo |
| import os |
| import json |
| return mo, os, json |
|
|
|
|
| @app.cell |
| def _(mo): |
| mo.md( |
| """ |
| # ☤ Agent Zero Canvas |
| |
| Connected to **Agent Zero** via Hermes API (OpenAI-compatible). |
| """ |
| ) |
| return |
|
|
|
|
| @app.cell |
| def _(mo, os, json): |
| |
| |
| api_key = os.environ.get("AGENT_ZERO_API_KEY", "") |
|
|
| if not api_key: |
| |
| keys_json = os.environ.get("API_KEYS_JSON", "") |
| if keys_json: |
| try: |
| keys = json.loads(keys_json) |
| |
| api_key = keys.get("agent_zero", keys.get("openai", "")) |
| except json.JSONDecodeError: |
| pass |
|
|
| if not api_key: |
| api_key = "hermes-secret-key-123" |
|
|
| |
| |
| base_url = os.environ.get( |
| "AGENT_ZERO_BASE_URL", |
| "https://8642-01kmke6kkwzc5svsxjvqje6yth.cloudspaces.litng.ai/v1" |
| ) |
|
|
| chat = mo.ui.chat( |
| mo.ai.llm.openai( |
| "hermes-agent", |
| system_message="You are Agent Zero, an advanced AI assistant with access to tools including Hermes Agent for complex reasoning, a terminal, browser, and file system.", |
| api_key=api_key, |
| base_url=base_url, |
| ), |
| prompts=[ |
| "What tools do you have available?", |
| "Use Hermes to analyze this problem", |
| "Help me write a Python script", |
| ], |
| show_configuration_controls=True, |
| ) |
| chat |
| return base_url, api_key, chat |
|
|
|
|
| @app.cell |
| def _(chat, mo): |
| mo.md( |
| f"**Messages exchanged:** {len(chat.value) if chat.value else 0}" |
| ) |
| return |
|
|
|
|
| if __name__ == "__main__": |
| app.run() |
|
|