> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Gateway Protocol • AI Agent SDK

> GatewayProtocol: Protocol for gateway/control plane implementations.

# GatewayProtocol

> Defined in the [**protocols**](../modules/protocols) module.

<Badge color="blue">AI Agent</Badge>

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 wrapper):
from praisonai.gateway import WebSocketGateway

gateway = WebSocketGateway(port=8765)
gateway.register\_agent(my\_agent)
await gateway.start()

## Methods

<CardGroup cols={2}>
  <Card title="is_running()" icon="function" href="../functions/GatewayProtocol-is_running">
    Whether the gateway is currently running.
  </Card>

  <Card title="port()" icon="function" href="../functions/GatewayProtocol-port">
    Port the gateway is listening on.
  </Card>

  <Card title="host()" icon="function" href="../functions/GatewayProtocol-host">
    Host the gateway is bound to.
  </Card>

  <Card title="start()" icon="function" href="../functions/GatewayProtocol-start">
    Start the gateway server.
  </Card>

  <Card title="stop()" icon="function" href="../functions/GatewayProtocol-stop">
    Stop the gateway server.
  </Card>

  <Card title="register_agent()" icon="function" href="../functions/GatewayProtocol-register_agent">
    Register an agent with the gateway.
  </Card>

  <Card title="unregister_agent()" icon="function" href="../functions/GatewayProtocol-unregister_agent">
    Unregister an agent from the gateway.
  </Card>

  <Card title="get_agent()" icon="function" href="../functions/GatewayProtocol-get_agent">
    Get a registered agent by ID.
  </Card>

  <Card title="list_agents()" icon="function" href="../functions/GatewayProtocol-list_agents">
    List all registered agent IDs.
  </Card>

  <Card title="create_session()" icon="function" href="../functions/GatewayProtocol-create_session">
    Create a new session.
  </Card>

  <Card title="get_session()" icon="function" href="../functions/GatewayProtocol-get_session">
    Get a session by ID.
  </Card>

  <Card title="close_session()" icon="function" href="../functions/GatewayProtocol-close_session">
    Close a session.
  </Card>

  <Card title="list_sessions()" icon="function" href="../functions/GatewayProtocol-list_sessions">
    List session IDs, optionally filtered by agent.
  </Card>

  <Card title="on_event()" icon="function" href="../functions/GatewayProtocol-on_event">
    Decorator to register an event handler.
  </Card>

  <Card title="emit()" icon="function" href="../functions/GatewayProtocol-emit">
    Emit an event to registered handlers.
  </Card>

  <Card title="broadcast()" icon="function" href="../functions/GatewayProtocol-broadcast">
    Broadcast an event to all connected clients.
  </Card>

  <Card title="health()" icon="function" href="../functions/GatewayProtocol-health">
    Get gateway health status.
  </Card>
</CardGroup>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L256">
  `praisonaiagents/gateway/protocols.py` at line 256
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Gateway Feature" icon="tower-broadcast" href="/docs/features/gateway" />
</CardGroup>
