#convex agent

3 messages · Page 1 of 1 (latest)

tall roostBOT
#

Hi @versed talon. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

If you’re using Convex’s Agent component, you can give the LLM “instructions” (a system prompt) when you define the agent. This controls its tone and behavior.

  • Basic setup with instructions:
import { Agent } from "@convex-dev/agent";
import { openai } from "@ai-sdk/openai";
import { components } from "./_generated/api";

const supportAgent = new Agent(components.agent, {
  name: "Support Agent",
  languageModel: openai.chat("gpt-4o-mini"),
  instructions: "You are a helpful assistant. Answer concisely and cite sources when possible.",
});

(“instructions” is the system prompt; you can customize it to match the style you want) (Agents > Getting Started).

  • You can also supply per-call options, including custom context behavior, when generating messages. The Agent will automatically include prior message history and supports hybrid search; you can tweak what context is pulled in via contextOptions if needed (LLM Context).

  • For richer setups (tools, retries, usage tracking), you can define defaults once and override at call time. Example shows configurable instructions and tools, plus provider options (Agents > Getting Started).

#

If you’re looking for a reusable “instruction set” for coding with Convex (not chat style), Convex provides editor-specific rules/guidelines you can add to your project (e.g., Cursor rules, Copilot instructions) so agents write Convex code correctly. Install:

For MCP-powered coding agents (Cursor/Copilot), you can also enable the Convex MCP server so the agent can inspect your schema/functions and run queries against your deployment (Using Cursor with Convex, GitHub Copilot + MCP).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: