***

title: as_router
slug: /reference/python/agents/agent-base/as-router
description: Get the agent's endpoints as a FastAPI APIRouter for mounting in larger applications.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[agentserver]: /docs/server-sdks/reference/python/agents/agent-server

Get a FastAPI `APIRouter` containing all of this agent's registered routes. This is
the lowest-level integration point for embedding an agent's endpoints into an
existing FastAPI application.

Use this when you need fine-grained control over how the agent's routes are
mounted, or when composing multiple agents into a custom application layout. For
multi-agent hosting, consider
[`AgentServer`][agentserver] instead.

## **Parameters**

None.

## **Returns**

`APIRouter` -- A FastAPI router with all agent endpoints (SWML delivery, SWAIG
function handling, post-prompt, debug events, etc.).

## **Example**

```python {9-10}
from fastapi import FastAPI
from signalwire import AgentBase

app = FastAPI()

support_agent = AgentBase(name="support", route="/support")
sales_agent = AgentBase(name="sales", route="/sales")

app.include_router(support_agent.as_router(), prefix="/support")
app.include_router(sales_agent.as_router(), prefix="/sales")
```