convex-agents

Builds stateful AI agents on Convex with threads, tools, streaming, and RAG.

Updated Jun 28, 2026
One-click install
npx skills add https://github.com/AO-HyS/aohys.com --skill convex-agents-ao-hys
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: convex-agents
Source: https://github.com/AO-HyS/aohys.com/tree/main/.agents/skills/convex-agents
Command: npx skills add https://github.com/AO-HyS/aohys.com --skill convex-agents-ao-hys

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @convex-dev/agent, ai, openai.

What problem does it solve? Building AI agents that remember conversations, call tools, and stream responses requires stitching together state storage, vector search, and workflow orchestration. This Skill provides ready-to-use Convex patterns so agents persist threads, execute tools, and run multi-step workflows without custom infrastructure. ## Core Features & Use Cases - Thread & Message Management: Create persistent conversation threads, list user threads, and retrieve message history stored in Convex tables. - Tool Integration & Streaming: Define Convex functions as agent tools (knowledge search, task creation, external APIs) and stream tokens to clients in real time. - RAG & Workflow Orchestration: Generate embeddings, run vector search over documents, and coordinate multi-step research workflows with status tracking. - Use Case: Build a customer support chatbot that remembers each user's history, searches a knowledge base via vector search, creates follow-up tasks, and streams answers to a React chat UI. ## Quick Start Ask the AI to set up a Convex agent with thread management, tool calling, and streaming chat using the @convex-dev/agent component.

Frequently Asked Questions about convex-agents

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build an AI agent with Convex?▼

Install @convex-dev/agent, ai, and openai, then create an Agent instance wired to your OpenAI chat and embedding clients. Use agent.createThread for conversations and agent.chat to generate responses with optional tools and streaming.

How do I add tools to a Convex agent?▼

Define tools with the tool() helper from @convex-dev/agent, specifying a name, description, validated parameters, and a handler that runs Convex queries or mutations. Pass the tools array to agent.chat so the model can invoke them.

Does Convex support streaming AI responses?▼

Yes, agent.chat accepts a stream option with an onToken callback that fires per token. You can forward tokens to clients by writing them through a mutation, giving users real-time response updates.

How do I implement RAG with Convex vector search?▼

Generate embeddings with agent.embed when inserting documents, store them in a table with a vectorIndex, then call agent.search with a query and table name. Results include similarity scores for ranking retrieved context.

Why do agent conversations disappear after refresh?▼

Conversations vanish when threads and messages are not persisted to Convex tables. Store threads and messages in indexed tables and reload them via queries so history survives restarts and page refreshes.