get_agents

View as MarkdownOpen in Claude

Return all registered agents as a list of (route, agent) tuples. Useful for introspection, logging, or building admin interfaces.

Returns

list[tuple[str, AgentBase]] — A list of tuples where the first element is the route string (e.g., "/sales") and the second is the AgentBase instance.

Example

1from signalwire import AgentServer
2from signalwire import AgentBase
3
4agent1 = AgentBase(name="sales", route="/sales")
5agent2 = AgentBase(name="support", route="/support")
6server = AgentServer(port=3000)
7server.register(agent1)
8server.register(agent2)
9for route, agent in server.get_agents():
10 print(f"{route}: {agent.get_name()}")
11# /sales: sales
12# /support: support