Skip to main content

Overview

CometChat’s “Bring Your Own Agent” (BYOA) feature allows you to integrate your custom AI agent with CometChat’s full-stack platform. This approach provides:
  • Complete Control: Host and manage your own agent logic
  • Flexibility: Use any AI provider or custom model
  • Self-Service: Configure everything through the CometChat dashboard
  • Production-Ready UI: CometChat handles chat interface, moderation, and analytics
  • Security: Secure communication via headers and authentication

How It Works

  1. Host Your Agent: Deploy an AG-UI compatible agent on your infrastructure
  2. Configure in CometChat: Add agent details in the CometChat dashboard
  3. Secure Connection: Set up authentication headers
  4. Seamless Integration: CometChat sends AG-UI messages to your agent and streams responses

Key Benefits

  • No Infrastructure Headaches: CometChat provides the UI, moderation, and monitoring
  • Model Agnostic: Works with OpenAI, Anthropic, Mastra, LangGraph, or custom models
  • Multi-Agent Support: Connect multiple specialized agents
  • Real-Time Streaming: Token-by-token response streaming
  • Tool Integration: Execute frontend tools from your agent

Building an AG-UI Compatible Agent

Core Requirements

An AG-UI compatible agent must:
  1. Accept POST requests with RunAgentInput body
  2. Return streaming responses as Server-Sent Events (SSE)
  3. Emit AG-UI events in the correct sequence
  4. Handle errors gracefully with RUN_ERROR events

RunAgentInput Interface

Every AG-UI agent receives this input:

Tool Interface

Basic Agent Implementation Pattern