-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.py
More file actions
59 lines (46 loc) · 1.51 KB
/
cli.py
File metadata and controls
59 lines (46 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""
AgentMesh CLI — typer-based entry point.
Usage:
agentmesh serve # start the API server
agentmesh research # run research_mesh example
agentmesh summarise # run summary_mesh example
agentmesh mesh # print current mesh state (requires running server)
"""
import typer
import uvicorn
app = typer.Typer(name="agentmesh", help="AgentMesh AI Orchestration System")
@app.command()
def serve(
host: str = typer.Option("0.0.0.0", help="Bind host"),
port: int = typer.Option(8000, help="Bind port"),
reload: bool = typer.Option(False, help="Auto-reload on code changes"),
):
"""Start the AgentMesh API server."""
uvicorn.run("api.server:app", host=host, port=port, reload=reload)
@app.command()
def research():
"""Run the 3-agent research pipeline demo."""
import asyncio
from examples.research_mesh import main
asyncio.run(main())
@app.command()
def summarise():
"""Run the hierarchical summarisation demo."""
import asyncio
from examples.summary_mesh import main
asyncio.run(main())
@app.command()
def mesh(
url: str = typer.Option("http://localhost:8000", help="API base URL"),
):
"""Print the current mesh state from a running server."""
import httpx
try:
resp = httpx.get(f"{url}/mesh", timeout=5)
import json
typer.echo(json.dumps(resp.json(), indent=2))
except Exception as e:
typer.echo(f"Error: {e}", err=True)
raise typer.Exit(1)
if __name__ == "__main__":
app()