Use this file to discover all available pages before exploring further.
The Context7Agent class is a pre-configured AI agent that handles the complete documentation lookup workflow automatically. It combines both resolveLibraryId and queryDocs tools with an optimized system prompt.
import { Context7Agent } from "@upstash/context7-tools-ai-sdk";import { anthropic } from "@ai-sdk/anthropic";const agent = new Context7Agent({ model: anthropic("claude-sonnet-4-20250514"),});const { text } = await agent.generate({ prompt: "How do I use React Server Components?",});console.log(text);
import { Context7Agent } from "@upstash/context7-tools-ai-sdk";import { anthropic } from "@ai-sdk/anthropic";const agent = new Context7Agent({ model: anthropic("claude-sonnet-4-20250514"),});const { text } = await agent.generate({ prompt: "How do I set up authentication in Next.js?",});console.log(text);
import { Context7Agent, AGENT_PROMPT } from "@upstash/context7-tools-ai-sdk";import { openai } from "@ai-sdk/openai";const agent = new Context7Agent({ model: openai("gpt-5.2"), system: `${AGENT_PROMPT}Additional instructions:- Always include TypeScript examples- Mention version compatibility when relevant- Suggest related documentation topics`,});