Skip to main content
Use app_registry to mount custom FastAPI routers in the same process as your agent server.

When to Use

  • Add custom health or diagnostics endpoints.
  • Expose supplemental API routes used by your integrations.
  • Keep custom routes close to the agent module that is loaded by aion.yaml.

Example

aion.yaml:
aion:
  agents:
    support:
      path: "./agent.py:build_graph"
agent.py:
from fastapi import APIRouter
from aion.server import app_registry

custom_router = APIRouter(prefix="/api/custom")


@custom_router.get("/health")
async def custom_health():
    return {"status": "ok"}


app_registry.add_router(custom_router)

API

MethodDescription
add_router(router: APIRouter)Registers a FastAPI router.
get_routers()Returns all registered routers.