What you’ll build
- A Vercel AI SDK agent with streaming + tools
- The same agent connected to CometChat (Agent ID + Deployment URL)
- A customized chat experience using UI Kit Builder
- An export to React UI Kit code or Chat Widget for integration
Prerequisites
- A CometChat account and an app: Create App
- A Vercel AI SDK agent (HTTP endpoint) plus the adaptor package:
vercel-cometchat-adaptor - Node.js environment with:
ai,@ai-sdk/openai,zod, and Express (or another HTTP framework)
Step 1 - Create your CometChat app
Create or open an app
Copy credentials
Step 2 - Connect your Vercel AI SDK Agent
Navigate to AI Agent → Get Started and then AI Agents → Add Agent.Choose provider
Basic details
- Name and optional Icon
- (Optional) Greeting and Introductory Message
- (Optional) Suggested messages
Vercel configuration
- Agent ID — a unique handle that matches how you route traffic (e.g.,
support). - Deployment URL — the public HTTPS endpoint that receives CometChat requests.
- (Optional) Headers — JSON auth headers that your endpoint expects.
Save & enable
Tip: The vercel-cometchat-adaptor handles conversion between CometChat events and the Vercel AI SDK. Keep the Agent ID and Deployment URL stable so you don’t need to reconnect.
Step 3 - Define Frontend Actions (Optional)
Add an action
Define fields
- Display Name — Shown to users (e.g., “Open Product Page”).
- Execution Text — How the agent describes running it (e.g., “Opening product details for the user.”).
- Name — A unique, code-friendly key (e.g.,
open_product). - Description — What the tool does and when to use it.
- Parameters — JSON Schema describing inputs (the agent will fill these).
Validate inputs (schema)
Handle in your UI
Step 4 - Customize in UI Kit Builder
Open variant
Customize & Deploy
Adjust settings
Preview

Step 5 - Export & Integrate
Choose how you’ll ship the experience (Widget or React UI Kit export).The Vercel AI SDK agent from Step 2 is included automatically in exported variants—no extra code needed for basic conversations.
Decide delivery mode
Widget path
React UI Kit path
Verify agent inclusion
Step 6 - Deploy & Secure (Reference)
Define your Vercel AI SDK agent
Define your Vercel AI SDK agent
Expose a CometChat-compatible endpoint
Expose a CometChat-compatible endpoint
- TypeScript (Express)
- JavaScript (Express)
Run & Deploy Your Vercel Agent
Run & Deploy Your Vercel Agent
Local Development
npm installto pull dependencies (includingvercel-cometchat-adaptor).npm run dev(orvercel dev) to start the local server.
Quick test against the Express route:
Temporary Public Tunnel
Append route (e.g. /agent/vercel) to the forwarded HTTPS URL.
Production Patterns
- Serverless: Convert the route to a Vercel /api handler or edge function.
- Container: Run the Express app in Docker; add health checks.
- Edge: Use
@vercel/edgeruntime and keep tools stateless.
Security
- Rate limit by IP + user.
- Add auth (Bearer / JWT) for private agents.
- Log tool calls (id, latency) for observability.
CometChat Mapping
Use the final HTTPS URL + path for Deployment URL. Reuse the same string you configured in code as the Agent ID.
Deploy & copy IDs
Deploy & copy IDs
Docs: https://sdk.vercel.ai/docs
Test your setup
Enable the agent
Preview in UI Kit Builder
Validate conversation
Test actions
Troubleshooting
Agent not responding
Agent not responding
- Verify your Deployment URL is publicly reachable and returns
text/event-stream. - Check server logs for runtime errors or missing environment variables.
Tool call not executed
Tool call not executed
- Confirm the Action’s Name in CometChat exactly matches the tool name your UI listens for.
- Validate the Parameters JSON Schema; the agent uses this to fill inputs.
Auth issues in exports
Auth issues in exports
- Use
authKeyonly for development. For production, implement a secure token flow for user login.
By combining the CometChat Agentic Interface with the Vercel AI SDK, you can connect intelligent agents with end users instantly and securely.
The
vercel-cometchat-adaptor library simplifies message and event translation, creating a reliable bridge between CometChat and Vercel-powered AI systems.