Skip to main content
An Autonomy Node starts an HTTP Server that includes a set of built-in APIs. You can also add custom FastAPI routes tailored to your application’s needs.

Built-in APIs

By default, an Autonomy Node automatically provides these endpoints:
  • POST /agents/{agent_name} - Send messages to a specific agent.
  • POST /agents/{agent_name}?stream=true Send messages, get streaming responses.
  • GET /agents - List all running agents.
  • GET /agents/{agent_name} - Get details about a specific agent.

Custom APIs with FastAPI

For applications that need custom business logic, data validation, or specialized endpoints, create custom FastAPI routes. Basic Custom API Create a custom endpoint that uses an agent:
images/main/main.py
  • Use NodeDep to inject the Node instance into your endpoint
  • Create agents on-demand or reuse them across requests
  • Return custom response formats tailored to your API design
Accessing the Node Instance The NodeDep dependency provides access to the Autonomy Node reference, which you need to start agents:
images/main/main.py

Parallel Processing

For high-throughput applications, process multiple requests concurrently by running many agents in parallel:
images/main/main.py
  • Each item gets its own agent with a unique name.
  • asyncio.gather runs all agents concurrently.
  • Agents are stopped after processing to free resources.
  • Errors are caught per-item, so one failure doesn’t break the batch.

Streaming Responses

For long-running agent interactions, stream responses to the client:
images/main/main.py
Client-side handling:
client.ts

API Documentation

FastAPI automatically generates interactive API documentation. Access it at:
  • /docs - Swagger UI interface
  • /redoc - ReDoc interface