Gateway Protocol • AI Agent SDK
GatewayProtocol: Protocol for gateway/control plane implementations.
GatewayProtocol
Defined in the protocols module.
AI Agent
Protocol for gateway/control plane implementations.
The gateway coordinates communication between clients and agents, manages sessions, and provides health/presence tracking.
Example usage (implementation in praisonai_bot.gateway): from praisonai.gateway import WebSocketGateway
gateway = WebSocketGateway(port=8765) gateway.register_agent(my_agent) await gateway.start()
Methods
Whether the gateway is currently running.
port()Port the gateway is listening on.
host()Host the gateway is bound to.
start()Start the gateway server.
stop()Stop the gateway server.
register_agent()Register an agent with the gateway.
unregister_agent()Unregister an agent from the gateway.
get_agent()Get a registered agent by ID.
list_agents()List all registered agent IDs.
create_session()Create a new session.
get_session()Get a session by ID.
close_session()Close a session.
list_sessions()List session IDs, optionally filtered by agent.
on_event()Decorator to register an event handler.
emit()Emit an event to registered handlers.
broadcast()Broadcast an event to all connected clients.
health()Get gateway health status.
Source
View on GitHubpraisonaiagents/gateway/protocols.py at line 1338