Skip to main content
AI Agent Chat

AI Agent Chat

Example project demonstrating AI agent integration.

Features

  • Actor-per-agent pattern with a coordinating manager Rivet Actor
  • Queue-based intake using c.queue.next inside the run loop
  • Streaming AI responses sent to the UI as they arrive
  • Persistent history stored in Rivet Actor state
  • Live status updates via events and polling

Prerequisites

  • OpenAI API key set as OPENAI_API_KEY

Implementation

The AgentManager creates and tracks agent actors, while each AI agent Rivet Actor consumes queue messages in run and streams responses with the Vercel AI SDK.

Resources

Read more about queues, run handlers, state, and events.