Eve Docs Agent Example
Overview
examples/eve-docs-agent is a standalone eve example application named context7-docs-agent in examples/…/package.json. It defines a documentation Q&A agent that must search current official docs before answering library, framework, or API questions. The package is ESM ("type": "module"), uses Node 24.x, and exposes the usual eve lifecycle scripts: pnpm build runs eve build, pnpm dev runs eve dev, pnpm start runs eve start, and pnpm typecheck runs tsc.
The runtime entry point is examples/…/agent.ts, which exports defineAgent({ model: "anthropic/claude-sonnet-5" }). The model behavior is mainly constrained by examples/…/instructions.md: it identifies the assistant as a developer documentation assistant, requires calling search_docs before answering library/API usage questions, passes library and version when available, bases answers on returned snippets, cites source URLs, refuses to guess on irrelevant results, and keeps answers short.
The only custom tool is examples/…/search_docs.ts. It registers an eve defineTool with a Zod input schema containing query (required, non-empty), library (optional library name or Context7 ID), and version (optional release). During execution it calls getContext7().search(query, { libraries, version, type: "txt", signal }); libraries is set to a one-element array only when library is provided, and version is also forwarded only when a library was provided. The eve execution context's abort signal is passed through to the Context7 request, so cancelled agent runs can cancel documentation search.
examples/…/context7.ts owns Context7 client creation and caches the singleton in module state. When CONTEXT7_API_KEY is present, it constructs new Context7() and relies on the SDK's environment-based authentication. Otherwise it trims CONTEXT7_RESOURCE_ID; if that variable is empty it throws Set CONTEXT7_API_KEY or CONTEXT7_RESOURCE_ID for the connected Vercel resource. With a resource ID, it constructs new Context7({ authToken: () => getIntegrationToken(resourceId) }), using @vercel/integrations to mint Vercel Marketplace/OIDC-backed tokens for the connected Context7 resource.
The chat surface is examples/…/eve.ts, which exports eveChannel({ auth: [vercelOidc(), localDev(), placeholderAuth()] }). That means production deployments accept Vercel OIDC, local development is allowed through eve's local auth helper, and the example still includes placeholderAuth() as a template convenience rather than a real public auth policy.
Workspace and type checking are scoped to the example. examples/…/tsconfig.json uses target: ES2022, module/moduleResolution: NodeNext, strict: true, noEmit: true, Node types, and includes only agent/…/*.ts plus generated .eve/…/*.d.ts. examples/…/pnpm-workspace.yaml disables pnpm's global virtual store, excludes several fast-moving AI/Vercel/eve packages from minimum release age, allows esbuild postinstall builds, and overrides eve>undici to ^8.12.2. examples/…/pnpm-lock.yaml locks the example importer to @upstash/context7-sdk, @vercel/integrations, ai, eve, zod, @types/node, and TypeScript versions resolved for this package.
Deployment and local setup are documented in examples/…/README.md. The README's Vercel deploy button clones this example, connects the Context7 Marketplace integration, and asks for CONTEXT7_API_KEY; the alternative deployment path removes the API key and sets CONTEXT7_RESOURCE_ID so agent/…/context7.ts can call getIntegrationToken. Local development expects pnpm install, vercel link, vercel env pull, and pnpm dev; without Vercel, developers copy the env template to .env.local and provide Context7 and AI Gateway credentials. examples/eve-docs-agent/.gitignore ignores .env* but re-allows .env.example, plus generated/build directories including .eve, .vercel, .workflow-data, .next, .output, .nitro, and dist. examples/eve-docs-agent/.vercelignore keeps node_modules, eve output, Next/Nitro/output directories, and dist out of Vercel uploads.
Assistant-facing maintenance instructions are duplicated through examples/…/AGENTS.md and examples/…/CLAUDE.md (CLAUDE.md just references @AGENTS.md). AGENTS.md tells future coding agents to read eve guides from node_modules/eve/docs/, treat agent/…/search_docs.ts as the library-question tool, keep Context7 secrets out of commits, understand the API-key-versus-Vercel-resource auth split in agent/…/context7.ts, and replace placeholderAuth() in agent/…/eve.ts before exposing the agent outside the Vercel team.
Coupling
- If examples/…/search_docs.ts changes its tool name, input schema, or return shape, also update examples/…/instructions.md and examples/…/README.md; both refer to
search_docsas the required pre-answer search step and describe the library/version behavior users should expect. - If examples/…/context7.ts changes environment variables or token minting behavior, update examples/…/README.md, examples/…/AGENTS.md, and the env template path covered by examples/…/.env.example; deployment instructions currently depend on the exact
CONTEXT7_API_KEY/CONTEXT7_RESOURCE_IDfallback order. - If examples/…/eve.ts changes authentication, verify examples/…/README.md and examples/…/AGENTS.md; both warn that
placeholderAuth()must be replaced before exposing the agent beyond trusted/local or Vercel-team use. - If dependency versions or the Node engine in examples/…/package.json change, keep examples/…/pnpm-lock.yaml, examples/…/pnpm-workspace.yaml, and the README's Node/local development guidance aligned so the example remains reproducible for
pnpm install,eve dev, and Vercel deployment.
Risks
- examples/…/eve.ts includes
placeholderAuth()in the auth list. If this example is deployed as-is for users outside the owning Vercel team, the channel may not enforce the intended production access boundary; replace or remove it when turning the example into a real public assistant. - examples/…/context7.ts caches the first
Context7client it creates. If tests or a long-lived process mutateCONTEXT7_API_KEYorCONTEXT7_RESOURCE_IDafter the first call togetContext7(), later searches will keep using the original auth mode until the module is reloaded.