mirror of
https://github.com/hanzoai/agents.git
synced 2026-10-30 18:48:36 +00:00
The server mounts /v1, /v1/ui and /v2/ui. The UI and its dev proxy, the helm and kubernetes health probes, functional tests, project templates, examples and scripts still called /api/v1, so the probes failed and the UI's requests missed. Co-authored-by: Hanzo Dev <[email protected]>
39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
"""
|
|
Docker/Kubernetes-friendly Hello World (Python)
|
|
|
|
This example is designed to validate the full Hanzo Agents execution path:
|
|
|
|
client -> control plane (/v1/execute) -> agent callback URL -> response
|
|
|
|
It is intentionally deterministic (no LLM credentials required).
|
|
"""
|
|
|
|
import os
|
|
|
|
from hanzo_agents import Agent
|
|
|
|
|
|
app = Agent(
|
|
node_id=os.getenv("AGENT_NODE_ID", "demo-python-agent"),
|
|
hanzo_agents_server=os.getenv("HANZO_AGENTS_URL", "http://localhost:8080"),
|
|
dev_mode=True,
|
|
)
|
|
|
|
|
|
@app.reasoner()
|
|
async def hello(name: str = "Hanzo Agents") -> dict:
|
|
return {"greeting": f"Hello, {name}!", "node_id": app.node_id}
|
|
|
|
|
|
@app.reasoner()
|
|
async def demo_echo(message: str = "Hello!") -> dict:
|
|
return {"echo": message, "node_id": app.node_id}
|
|
|
|
|
|
if __name__ == "__main__":
|
|
port = int(os.getenv("PORT", "8001"))
|
|
# For containerized runs, set AGENT_CALLBACK_URL so the control plane can call back:
|
|
# AGENT_CALLBACK_URL=http://<service-name>:<port>
|
|
app.run(host="0.0.0.0", port=port, auto_port=False)
|
|
|