Skip to main content

Console Agent Pipeline

The console routes agent interactions through /api/ai/agent-chat, streaming responses via Server-Sent Events (SSE).

Pipeline Steps

  1. Validate the user session with requireAuth().
  2. Verify chat ownership for the org.
  3. Resolve sandbox auth context and credentials.
  4. Load chat context and recent messages.
  5. Run the agent in the sandbox runtime.
  6. Stream events and results over SSE.

Guardrails

  • Sensitive tools trigger confirmation events
  • Tool calls are validated against policy and guardrails
  • Confirmation tokens are required for write actions