Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ai-agents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Because CometChat AI Agents are model-agnostic, you can swap providers or upgrad
</p>
<div className="mt-4 flex flex-wrap gap-3">
<a
href="/docs/ai-agents/ag-ui"
href="/docs/ai-agents/custom-agent"
className="inline-flex items-center justify-center rounded-full bg-gray-900 text-white px-5 py-2 text-sm font-medium hover:bg-gray-800 transition"
>
Connect Third-Party Agent
Expand Down
2 changes: 1 addition & 1 deletion ai-agents/ag2-product-hunt-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ curl -N http://localhost:8000/agent \
}'
```

You’ll see `tool_call_*` events with Product Hunt data followed by streaming `text_message` chunks and a `[DONE]` sentinel—exactly what CometChat’s AI agents API consumes.
You’ll see `tool_call_*` events with Product Hunt data followed by streaming `text_message` chunks and a `[DONE]` sentinel—exactly what CometChat’s Custom Agent API consumes.

---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "CometChat AG-UI Agents"
sidebarTitle: "CometChat AG-UI Agents"
description: "Bring your own agent to CometChat and build AG-UI compatible agents."
title: "CometChat Custom Agents"
sidebarTitle: "CometChat Custom Agents"
description: "Bring your own agent to CometChat and build Custom Agent integrations."
---

### Overview
Expand All @@ -16,10 +16,10 @@ CometChat's "Bring Your Own Agent" (BYOA) feature allows you to integrate your c

### How It Works

1. **Host Your Agent**: Deploy an AG-UI compatible agent on your infrastructure
1. **Host Your Agent**: Deploy your Custom Agent server 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
4. **Seamless Integration**: CometChat sends Custom Agent events to your agent and streams responses

### Key Benefits

Expand All @@ -31,20 +31,20 @@ CometChat's "Bring Your Own Agent" (BYOA) feature allows you to integrate your c

---

## Building an AG-UI Compatible Agent
## Building a Custom Agent

### Core Requirements

An AG-UI compatible agent must:
A Custom Agent implementation 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
3. **Emit Custom Agent events** in the correct sequence
4. **Handle errors gracefully** with `RUN_ERROR` events

### RunAgentInput Interface

Every AG-UI agent receives this input:
Every Custom Agent implementation receives this input:

```typescript
interface RunAgentInput {
Expand Down Expand Up @@ -119,4 +119,3 @@ app.post('/agent', async (req, res) => {
```

---

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "AG-UI Express.js Implementation"
title: "Custom Agent Express.js Implementation"
sidebarTitle: "Express.js"
description: "Implementation guide for building an AG-UI agent with Express.js."
description: "Implementation guide for building a Custom Agent with Express.js."
---

### Prerequisites
Expand All @@ -14,8 +14,8 @@ description: "Implementation guide for building an AG-UI agent with Express.js."

```bash
# Create project directory
mkdir my-ag-ui-agent
cd my-ag-ui-agent
mkdir my-custom-agent
cd my-custom-agent

# Initialize package.json
npm init -y
Expand Down Expand Up @@ -71,7 +71,7 @@ const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
});

// Event encoder for AG-UI events
// Event encoder for Custom Agent events
class EventEncoder {
encode(event: any): string {
return `data: ${JSON.stringify(event)}\n\n`;
Expand All @@ -82,7 +82,7 @@ class EventEncoder {
}
}

// AG-UI Agent Endpoint
// Custom Agent Endpoint
app.post('/agent', async (req: Request, res: Response) => {
const input: RunAgentInput = req.body;
const encoder = new EventEncoder();
Expand All @@ -101,7 +101,7 @@ app.post('/agent', async (req: Request, res: Response) => {
runId: input.runId,
}));

// Convert AG-UI messages to OpenAI format
// Convert Custom Agent messages to OpenAI format
const openaiMessages = input.messages.map((msg) => ({
role: msg.role as 'user' | 'assistant' | 'system',
content: msg.content || '',
Expand All @@ -113,7 +113,7 @@ app.post('/agent', async (req: Request, res: Response) => {
} : {})
}));

// Convert AG-UI tools to OpenAI format
// Convert Custom Agent tools to OpenAI format
const openaiTools = input.tools?.map((tool) => ({
type: 'function' as const,
function: {
Expand Down Expand Up @@ -213,7 +213,7 @@ app.get('/health', (req: Request, res: Response) => {

// Start server
app.listen(port, () => {
console.log(`🚀 AG-UI Agent server running on port ${port}`);
console.log(`🚀 Custom Agent server running on port ${port}`);
console.log(`📍 Agent endpoint: http://localhost:${port}/agent`);
console.log(`💚 Health check: http://localhost:${port}/health`);
});
Expand All @@ -234,7 +234,7 @@ Update `package.json`:

```json
{
"name": "my-ag-ui-agent",
"name": "my-custom-agent",
"version": "1.0.0",
"scripts": {
"dev": "nodemon --exec ts-node src/server.ts",
Expand Down Expand Up @@ -277,4 +277,3 @@ curl -X POST http://localhost:8000/agent \
```

---

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "AG-UI NestJS Implementation"
title: "Custom Agent NestJS Implementation"
sidebarTitle: "NestJS"
description: "Implementation guide for building an AG-UI agent with NestJS."
description: "Implementation guide for building a Custom Agent with NestJS."
---

### Prerequisites
Expand All @@ -18,10 +18,10 @@ description: "Implementation guide for building an AG-UI agent with NestJS."
npm i -g @nestjs/cli

# Create new project
nest new my-ag-ui-agent
nest new my-custom-agent

# Navigate to project
cd my-ag-ui-agent
cd my-custom-agent

# Install additional dependencies
npm install @ag-ui/core openai uuid @nestjs/config
Expand Down Expand Up @@ -106,7 +106,7 @@ export class AgentService {
runId: input.runId,
});

// Convert AG-UI messages to OpenAI format
// Convert Custom Agent messages to OpenAI format
const openaiMessages = input.messages.map((msg) => ({
role: msg.role as 'user' | 'assistant' | 'system',
content: msg.content || '',
Expand All @@ -118,7 +118,7 @@ export class AgentService {
} : {})
}));

// Convert AG-UI tools to OpenAI format
// Convert Custom Agent tools to OpenAI format
const openaiTools = input.tools?.map((tool) => ({
type: 'function' as const,
function: {
Expand Down Expand Up @@ -293,7 +293,7 @@ async function bootstrap() {

await app.listen(port);

console.log(`🚀 AG-UI Agent server running on port ${port}`);
console.log(`🚀 Custom Agent server running on port ${port}`);
console.log(`📍 Agent endpoint: http://localhost:${port}/agent`);
}

Expand Down Expand Up @@ -333,4 +333,3 @@ curl -X POST http://localhost:8000/agent \
```

---

2 changes: 1 addition & 1 deletion ai-agents/crew-ai-knowledge-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,6 @@ crew = Crew(agents=[agent], tasks=[task], process=Process.sequential)
## Wire it to CometChat

- Dashboard → **AI Agent → BYO Agents** and then **Get Started / Integrate → Choose CrewAI**. → **Agent ID** (e.g., `knowledge`) → **Deployment URL** = your public `/stream`.
- The SSE stream is newline-delimited JSON; CometChat AG-UI adapters parse `text_start`/`text_delta`/`text_end` and stop on `done`. Message IDs, thread IDs, and run IDs are included for threading.
- The SSE stream is newline-delimited JSON; CometChat Custom Agent adapters parse `text_start`/`text_delta`/`text_end` and stop on `done`. Message IDs, thread IDs, and run IDs are included for threading.
- Use namespaces to keep customer/workspace data separate; pass `namespace` in the payload or inside `tool_params.namespace` (either works; defaults to `default` if omitted).
- Keep secrets server-side; add auth headers on the FastAPI route if needed.
File renamed without changes.
File renamed without changes.
32 changes: 16 additions & 16 deletions ai-agents/ag-ui.mdx → ai-agents/custom-agent.mdx
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
---
title: "CometChat AG-UI Integration"
sidebarTitle: "AG-UI"
description: "Integrate your AG-UI compatible AI agents with CometChat using the AG-UI protocol."
title: "CometChat Custom Agent Integration"
sidebarTitle: "Custom Agent"
description: "Integrate your AI agents with CometChat using the Custom Agent protocol."
---

> Overview of the CometChat AG-UI integration protocol, event categories, and message formats.
> Overview of the CometChat Custom Agent integration protocol, event categories, and message formats.

CometChat has integrated support for **AG-UI (Agent-User Interaction Protocol)**, making it easier than ever to bring your own AI agents into your applications. With the "Bring Your Own Agent" (BYOA) approach, you can now host your own AG-UI compatible agent and seamlessly integrate it with CometChat's full-stack platform.
CometChat has integrated support for **Custom Agent**, making it easier than ever to bring your own AI agents into your applications. With the "Bring Your Own Agent" (BYOA) approach, you can host your own agent and seamlessly integrate it with CometChat's full-stack platform using the Custom Agent protocol.

This documentation provides a comprehensive guide on:

* Understanding the AG-UI protocol
* Creating AG-UI compatible agents using TypeScript
* Understanding the Custom Agent protocol
* Creating Custom Agent integrations using TypeScript
* Hosting agents on Express.js or NestJS
* Connecting your agent to CometChat

***

## What is AG-UI?
## What is Custom Agent?

### Overview

**AG-UI (Agent-User Interaction Protocol)** is an open-source, lightweight, event-based protocol developed to standardize real-time communication between AI agents and user interfaces. It provides a vendor-neutral format that works across different AI providers (OpenAI, Anthropic, custom models, etc.) without requiring changes to client-side implementations.
**Custom Agent** is a lightweight, event-based protocol developed to standardize real-time communication between AI agents and user interfaces. It provides a vendor-neutral format that works across different AI providers (OpenAI, Anthropic, custom models, etc.) without requiring changes to client-side implementations.

### Key Features

Expand All @@ -34,17 +34,17 @@ This documentation provides a comprehensive guide on:

### Core Concepts

AG-UI operates on three fundamental concepts:
The Custom Agent protocol operates on three fundamental concepts:

1. **Events**: Standardized messages that flow from agent to frontend
2. **Messages**: Conversation history between users and agents
3. **Tools**: Functions that agents can invoke to perform actions

***

## AG-UI Event Types
## Custom Agent Event Types

AG-UI defines **16+ standardized event types** organized into six categories. Understanding these events is crucial for implementing AG-UI compatible agents.
The Custom Agent protocol defines **16+ standardized event types** organized into six categories. Understanding these events is crucial for implementing Custom Agent integrations.

### 1. Lifecycle Events

Expand Down Expand Up @@ -295,7 +295,7 @@ interface RawEvent {

### Event Flow Patterns

AG-UI events follow specific patterns:
Custom Agent events follow specific patterns:

1. **Start-Content-End Pattern**: Used for streaming (text messages, tool calls)
* Start event initiates the stream
Expand All @@ -312,9 +312,9 @@ AG-UI events follow specific patterns:

***

## AG-UI Message Types
## Custom Agent Message Types

Messages form the backbone of communication in the AG-UI protocol. They represent the conversation history between users and AI agents.
Messages form the backbone of communication in the Custom Agent protocol. They represent the conversation history between users and AI agents.

### Base Message Structure

Expand Down Expand Up @@ -453,4 +453,4 @@ const conversation = [
]
```

***
***
42 changes: 33 additions & 9 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5049,23 +5049,23 @@
]
},
{
"dropdown": "AG-UI",
"icon": "/images/icons/agui.svg",
"dropdown": "Custom Agent",
"icon": "/images/icons/custom-agent.svg",
"pages": [
"/ai-agents/ag-ui",
"/ai-agents/ag-ui-actions",
"/ai-agents/ag-ui-tools",
"/ai-agents/custom-agent",
"/ai-agents/custom-agent-actions",
"/ai-agents/custom-agent-tools",
{
"group": "Guides",
"pages": [
"/ai-agents/cometchat-ag-ui-byoa"
"/ai-agents/cometchat-custom-agent-byoa"
]
},
{
"group": "Implementation",
"pages": [
"/ai-agents/cometchat-ag-ui-express",
"/ai-agents/cometchat-ag-ui-nestjs"
"/ai-agents/cometchat-custom-agent-express",
"/ai-agents/cometchat-custom-agent-nestjs"
]
}
]
Expand Down Expand Up @@ -5268,6 +5268,30 @@
"source": "/ai/conversation-summary",
"destination": "/fundamentals/ai-user-copilot/conversation-summary"
},
{
"source": "/ai-agents/ag-ui",
"destination": "/ai-agents/custom-agent"
},
{
"source": "/ai-agents/ag-ui-actions",
"destination": "/ai-agents/custom-agent-actions"
},
{
"source": "/ai-agents/ag-ui-tools",
"destination": "/ai-agents/custom-agent-tools"
},
{
"source": "/ai-agents/cometchat-ag-ui-byoa",
"destination": "/ai-agents/cometchat-custom-agent-byoa"
},
{
"source": "/ai-agents/cometchat-ag-ui-express",
"destination": "/ai-agents/cometchat-custom-agent-express"
},
{
"source": "/ai-agents/cometchat-ag-ui-nestjs",
"destination": "/ai-agents/cometchat-custom-agent-nestjs"
},
{
"source": "/webhooks/overview",
"destination": "/fundamentals/webhooks-overview"
Expand Down Expand Up @@ -5936,4 +5960,4 @@
"redirect": true
}
}
}
}
1 change: 0 additions & 1 deletion images/icons/agui.svg

This file was deleted.

1 change: 1 addition & 0 deletions images/icons/custom-agent.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.