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

from signalwire import AgentServer
from signalwire import AgentBase
agent1 = AgentBase(name="sales", route="/sales")
agent2 = AgentBase(name="support", route="/support")
server = AgentServer(port=3000)
server.register(agent1)
server.register(agent2)
for route, agent in server.get_agents():
print(f"{route}: {agent.get_name()}")
# /sales: sales
# /support: support