PluginBench
Skill
Pass
Audit score 90

convex-agent

get-convex/agent-skills

Add durable AI agent and RAG backend to Convex with built-in message history, tool calls, and vector search.

What is convex-agent?

Install @convex-dev/agent to add an AI agent backend with durable threads, message history, tool-calling, and vector search/RAG capabilities. Use the Convex AI Gateway by default (no API key management needed on paid plans), or fall back to provider credentials for self-hosted or free deployments.

  • Create and manage durable agent threads with persistent message history
  • Execute tool calls and define custom agent instructions
  • Perform vector search and RAG with embedded documents
  • Call LLM models through Convex AI Gateway without managing provider keys
  • Fall back to provider SDKs with credentials stored securely in Convex env
  • Stream messages and maintain reactive state in Convex database

How to install convex-agent

npx skills add https://github.com/get-convex/agent-skills --skill convex-agent
Prerequisites
  • Convex 1.45+ (for gateway support on paid plans)
  • @convex-dev/agent and @convex-dev/ai-sdk-provider packages
  • Convex Cloud deployment (paid plan for gateway, or self-hosted/free with provider key)
  • Vector embedding provider key (if using RAG; stored via env micro power)
Claude Code
Cursor
Windsurf
Cline

How to use convex-agent

  1. 1.Run `npx skills add https://github.com/get-convex/agent-skills --skill convex-agent`
  2. 2.Install @convex-dev/agent and @convex-dev/ai-sdk-provider packages
  3. 3.Add the agent component to convex.config.ts
  4. 4.Define your agent with tools and instructions using `convexGateway("provider/model")`
  5. 5.Create threads and stream messages; persist history in Convex database
  6. 6.For RAG: embed documents into a vector index and retrieve via agent tools
  7. 7.Store any required provider keys (embeddings, fallback) in Convex env using the env micro power

Use cases

Good for
  • Build in-app AI assistants with persistent conversation history
  • Implement retrieval-augmented generation (RAG) over custom documents
  • Create multi-turn agent workflows with tool integration
  • Deploy AI agents without managing LLM API keys client-side
  • Add semantic search capabilities via vector embeddings
Who it's for
  • Convex backend developers
  • Full-stack engineers building AI-powered applications
  • Teams deploying agents on Convex Cloud paid plans
  • Developers implementing RAG systems

convex-agent FAQ

Do I need to manage LLM API keys?

No, by default the Convex AI Gateway handles credentials on paid plans. Only store provider keys in Convex env if using embeddings or falling back on free/self-hosted deployments.

Can I use this on a free Convex plan?

Yes, but you must fall back to calling provider SDKs directly with credentials stored in Convex env, since the gateway is only available on paid plans.

How do I implement RAG?

Embed your documents into a vector index, then retrieve relevant documents in an agent tool. Store the embedding provider key in Convex env via the env micro power.

Where should I run model calls?

Always run model calls in Convex actions (use 'use node' if the SDK requires it) to keep credentials server-side and ensure durability.

Is message history automatically persisted?

Yes, threads and messages are persisted in the Convex database for durability and reactivity.

Full instructions (SKILL.md)

Source of truth, from get-convex/agent-skills.


name: convex-agent description: "Add an AI agent / RAG backend (@convex-dev/agent) to the Convex app."

<!-- GENERATED from convex-agents content/capabilities/agent.json — do not edit by hand. -->

Add an AI agent / RAG backend

Install @convex-dev/agent for durable threads, message history, tool-calls, and vector search/RAG — the backend for an in-app AI agent. Call models through the Convex AI Gateway by default: Convex holds the provider credentials, so there is no LLM key to obtain, store, or rotate.

Workflow

  1. Install @convex-dev/agent + @convex-dev/ai-sdk-provider; add the agent component to convex.config.ts.
  2. Define the agent (tools, instructions) with languageModel: convexGateway("provider/model") — no API key needed (needs convex 1.45+ on a Convex Cloud deployment, paid plan).
  3. Create threads + stream messages; persist history in Convex.
  4. For RAG: embed docs into a vector index and retrieve in the tool. The gateway does not serve embeddings yet, so store the embedding provider's key via the env micro power.
  5. Only if the gateway is unavailable (free plan, self-hosted, local backend): call the provider SDK with a key stored via the env micro power.

Rules

  • Default to the Convex AI Gateway (convexGateway from @convex-dev/ai-sdk-provider) for model calls; fall back to a provider key in Convex env only where the gateway is unavailable (free plan, self-hosted, local backend).
  • Never expose a provider API key client-side; when one is needed (embeddings, gateway fallback), keep it in Convex env via the env micro power.
  • Run model calls in actions ('use node' if the SDK needs it).
  • Persist threads/messages in Convex for durability + reactivity.