Skip to content

Latest commit

 

History

History
114 lines (85 loc) · 2.13 KB

File metadata and controls

114 lines (85 loc) · 2.13 KB

Using Agents

Every agent is a FastAPI server running in a Docker container. Once built and running, you interact with it via HTTP.

Find an agent's port

curl http://localhost:7000/api/agents/{name}

Look for the port field in the response. Or check the dashboard at http://localhost:7000.

Invoke an agent

Send a POST to the agent's /invoke endpoint with the inputs defined in its spec.

curl -X POST http://localhost:{port}/invoke \
  -H "Content-Type: application/json" \
  -d '{"field_name": "value"}'

Example: text-summarizer (port 9005)

curl -X POST http://localhost:9005/invoke \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Your long text here...",
    "max_length": 100,
    "style": "bullet-points"
  }'

Response:

{
  "success": true,
  "result": {
    "summary": "...",
    "word_count": 42,
    "key_points": ["...", "..."]
  },
  "error": null
}

Example: code-reviewer (port 9014)

curl -X POST http://localhost:9014/invoke \
  -H "Content-Type: application/json" \
  -d '{
    "code": "def foo(x):\n  return x+1",
    "language": "python"
  }'

Other agent endpoints

Every agent exposes these:

Endpoint Method What it does
/invoke POST Run the agent with input data
/health GET Check if agent is alive
/spec GET View agent name, type, description

From Python

import httpx

resp = httpx.post("http://localhost:9005/invoke", json={
    "text": "Your text here...",
    "style": "brief"
})

result = resp.json()
print(result["result"])

Finding input fields for an agent

Check the agent's spec YAML in specs/ or call the AgentCreator API:

curl http://localhost:7000/api/agents/{name}

The capabilities.tools field shows what tools the agent has. The input fields are defined in the spec YAML under input:.

Response format

All agents return the same envelope:

{
  "success": true,
  "result": { ... },
  "error": null
}

On failure:

{
  "success": false,
  "result": {},
  "error": "Description of what went wrong"
}