The Open Framework for Building Agents
docs: restore Agent Runs guidance (#3679)
Chad Hietala51b8f0da4136
diff --git a/apps/docs/AGENTS.md b/apps/docs/AGENTS.mdindex ff029c93e..983e1685f 100644--- a/apps/docs/AGENTS.md+++ b/apps/docs/AGENTS.md@@ -22,4 +22,5 @@ All user-facing UI changes must be mobile-responsive. Before completing a UI chaThis version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.+<!-- END:nextjs-agent-rules -->diff --git a/apps/docs/components/geistdocs/mdx-components.tsx b/apps/docs/components/geistdocs/mdx-components.tsxindex 6a472e065..1f5152b2f 100644--- a/apps/docs/components/geistdocs/mdx-components.tsx+++ b/apps/docs/components/geistdocs/mdx-components.tsx@@ -1,6 +1,7 @@import { createMdxComponents } from "@vercel/geistdocs/mdx";import { File, Files, Folder } from "fumadocs-ui/components/files";import { Step, Steps } from "fumadocs-ui/components/steps";+import { Flag } from "lucide-react";import type { MDXComponents } from "mdx/types";import Link from "next/link";import { AgentRuntimeDiagram } from "./agent-runtime-diagram";@@ -19,6 +20,7 @@ const localComponents: MDXComponents = {),File,Files,+ Flag,Folder,AgentRuntimeDiagram,Step,diff --git a/docs/channels/slack.mdx b/docs/channels/slack.mdxindex fc390bf35..e3d69facd 100644--- a/docs/channels/slack.mdx+++ b/docs/channels/slack.mdx@@ -135,7 +135,7 @@ Check the delivery path in order so you can identify where a Slack event stops:| Mentions work but DMs or thread replies do not | Check the Slack app's Event Subscriptions and OAuth scopes. DMs require `message.im` and `im:history`; channel replies require the matching message event and history scope. | Add the missing events or scopes, then reinstall the Slack app if Slack requires it. || A long response cannot be uploaded as a snippet | Check whether the installed Slack app has the `files:write` bot scope. | Add `files:write`, then reinstall the Slack app so the new scope takes effect. || A preview request receives an authentication page or protection error | Check whether the branch domain is exempt or the direct Slack request URL includes `x-vercel-protection-bypass`. Slack cannot complete an interactive Vercel Authentication challenge. | Add a Deployment Protection Exception for the branch domain, or add the automation bypass query parameter to a Slack app that uses environment-variable credentials. |-| The webhook reaches the deployment but the agent does not reply | Open the project's Vercel runtime logs and locate the request for the inbound Slack event. | Use the first missing or failed stage to narrow the issue to channel dispatch, model or tool execution, or outbound Slack delivery. |+| The webhook reaches the deployment but the agent does not reply | Open the project's Vercel runtime logs, then inspect the session in [**Agent Runs**](/docs/observability/agent-runs) when your team has access. | Use the first missing or failed stage to narrow the issue to channel dispatch, the agent run, or outbound Slack delivery. |## Audiencediff --git a/docs/guides/deployment/vercel.mdx b/docs/guides/deployment/vercel.mdxindex 996c53495..04b3ccb91 100644--- a/docs/guides/deployment/vercel.mdx+++ b/docs/guides/deployment/vercel.mdx@@ -155,6 +155,12 @@ eve dev https://your_agent.vercel.app/eve/supportSet `VERCEL_AUTOMATION_BYPASS_SECRET` locally before connecting if the deployment uses Deployment Protection.+## Inspect agent runs++Use the **Agent Runs** tab under **Observability** to browse sessions and+inspect conversation traces. See [Agent Runs](../../observability/agent-runs)+for beta access, pricing, retention, and tracing setup.+## Continue configuring productionUse these guides to secure and observe the deployed agent:diff --git a/docs/guides/instrumentation/agent-runs.mdx b/docs/guides/instrumentation/agent-runs.mdxnew file mode 100644index 000000000..2eb312ee2--- /dev/null+++ b/docs/guides/instrumentation/agent-runs.mdx@@ -0,0 +1,101 @@+---+title: "Agent Runs"+description: "Inspect eve sessions in Vercel and configure the Agent Runs destination."+url: "/observability/agent-runs"+---++<Callout type="info" icon={<Flag aria-hidden="true" className="size-5" />}>+ Agent Runs are available in [**Beta**](https://vercel.com/docs/release-phases#beta) on+ [**Enterprise**](https://vercel.com/docs/plans/enterprise),+ [**Pro**](https://vercel.com/docs/plans/pro), and [**Hobby**](https://vercel.com/docs/plans/hobby)+ plans.+</Callout>++Use Vercel Agent Runs to browse eve sessions and inspect conversation traces+in the project's **Observability** view. The tab requires enablement for your+Vercel team; contact your Vercel representative if it does not appear.++Agent Runs usage is billed at+[Always-on Tracing rates](https://vercel.com/docs/tracing/always-on-tracing#usage-and-pricing)+during beta. All plans include 30-day Agent Runs retention during beta.++## Configure Agent Runs++Preview and production deployments export to Vercel Agent Runs by default.+Omitting `agent/instrumentation/agent-runs.ts` preserves that default. Export+`agentRuns(...)` from that file to reconfigure it, or export+`disableInstrumentation()` to disable it.++## Enable tracing on Vercel++New eve deployments automatically sample 100% of requests. Existing eve+deployments need a sampling rule configured for the Vercel project to collect+traces. To enable tracing for an existing deployment, select your team and+project, then open+[**Settings → Tracing**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Fsettings%2Ftracing&title=Go+to+Tracing+settings):++1. Select **Add Sampling Rule**.+2. Choose **All Environments**, **Production**, or **Preview**.+3. Set **Rate** to `100%`.+4. Leave **Request Path Prefix** blank to sample requests on every path.+5. Select **Save**.++Vercel applies the first matching rule. If an existing rule matches these+requests, update it to use a 100% rate; a later rule will not override it.++Tracing starts as soon as you save the rule. You can also manage sampling+rules with [`vercel traces config`](https://vercel.com/docs/cli/traces#manage-trace-sampling-rules).+The CLI accepts rates from 1 to 100%; add a 0% rule from the dashboard.++## Filter Agent Runs exports++`agentRuns()` accepts one `exportPolicy` object or an array applied in order.+Each policy filters spans and attributes before the Agent Runs destination+receives them:++```ts title="agent/instrumentation/agent-runs.ts"+import { agentRuns } from "eve/instrumentation/otel";++export default agentRuns({+ exportPolicy: {+ span: ({ name }) => ({ emit: name !== "internal.cache.refresh" }),+ attribute: ({ key }) => (key === "customer.id" ? { emit: false } : { emit: true }),+ },+});+```++Return `{ emit: true }` from `span` to retain a span unchanged, or+`{ emit: false }` to omit it from Agent Runs. To retain the span while redacting+content, return `{ redact: true }` with `inputs: true`, `outputs: true`, or+both. A redaction decision implies emission and requires at least one+direction. A throwing `span` callback drops the span from Agent Runs. Return+`{ emit: true }`, `{ emit: false }`, or `{ replace: true, value }` from+`attribute` to retain, remove, or change one attribute.++## Redact content++The `exportPolicy` can further narrow what Agent Runs receives after the+process-wide `otel({ tracePolicy })` has admitted a trace. For example, keep+spans while redacting inputs and outputs unless the session is public:++```ts title="agent/instrumentation/agent-runs.ts"+import { agentRuns } from "eve/instrumentation/otel";++export default agentRuns({+ exportPolicy: {+ span: ({ audience }) =>+ audience === "public" ? { emit: true } : { redact: true, inputs: true, outputs: true },+ },+});+```++Input redaction removes eve's known prompt, instruction, document, and+tool-argument attributes. Output redaction removes response, reasoning,+tool-result, exception, and status attributes. Redaction narrows only Agent+Runs; it does not mutate spans sent to another destination.++## What to read next++- [OpenTelemetry](./otel): configure process-wide settings and third-party destinations.+- [Vercel deployment](/docs/guides/deployment/vercel): deploy an eve agent and inspect its runtime.+- [Migrate instrumentation](/docs/observability/instrumentation-migration): replace `agent/instrumentation.ts`.diff --git a/docs/guides/instrumentation/instrumentation.mdx b/docs/guides/instrumentation/instrumentation.mdxindex a4abbd622..472329b42 100644--- a/docs/guides/instrumentation/instrumentation.mdx+++ b/docs/guides/instrumentation/instrumentation.mdx@@ -159,6 +159,7 @@ not depend on execution order. Use `flush` to drain buffered records and## What to read next- [Migrate instrumentation](/docs/observability/instrumentation-migration): replace `agent/instrumentation.ts`.-- [OpenTelemetry](/docs/observability/otel): configure OTel destinations and third-party exports.+- [OpenTelemetry](/docs/observability/otel): configure process-wide settings and third-party destinations.+- [Agent Runs](/docs/observability/agent-runs): configure Vercel's built-in trace destination.- [Local development](../guides/dev-tui): inspect local traces in the TUI- [Hooks](../guides/hooks): react to runtime events outside the instrumentation lifecyclediff --git a/docs/guides/instrumentation/meta.json b/docs/guides/instrumentation/meta.jsonindex 432f06d41..9374c1f29 100644--- a/docs/guides/instrumentation/meta.json+++ b/docs/guides/instrumentation/meta.json@@ -1,5 +1,5 @@{"title": "Observability","defaultOpen": false,- "pages": ["instrumentation", "otel", "migration"]+ "pages": ["instrumentation", "otel", "agent-runs", "migration"]}diff --git a/docs/guides/instrumentation/migration.md b/docs/guides/instrumentation/migration.mdindex 55592a070..2ed2b1330 100644--- a/docs/guides/instrumentation/migration.md+++ b/docs/guides/instrumentation/migration.md@@ -89,4 +89,8 @@ seeRun `eve build`. A remaining `agent/instrumentation.ts` fails the build with amessage directing you to the instrumentation directory.-Run the agent and verify each destination independently.+New eve deployments automatically sample 100% of requests. Existing Vercel+deployments need project sampling configured before you verify them. See+[Enable tracing on Vercel](/docs/observability/agent-runs#enable-tracing-on-vercel).++Then run the agent and verify each destination independently.diff --git a/docs/guides/instrumentation/otel.mdx b/docs/guides/instrumentation/otel.mdxindex 91a8c60ba..5336e03be 100644--- a/docs/guides/instrumentation/otel.mdx+++ b/docs/guides/instrumentation/otel.mdx@@ -4,8 +4,8 @@ description: "Configure OpenTelemetry destinations, content capture, and third-purl: "/observability/otel"----`eve dev` records local traces automatically. You do not need `otel()` or-`localTraces()` to use this default.+`eve dev` records local traces by default. Use `otel()` for process-wide+settings and `otelIntegration()` for third-party destinations.## Configure OpenTelemetry@@ -128,6 +128,11 @@ import { disableInstrumentation } from "eve/instrumentation";export default disableInstrumentation();```+## Enable tracing on Vercel++For Agent Runs sampling defaults and existing-deployment setup, see+[Enable tracing on Vercel](./agent-runs#enable-tracing-on-vercel).+## Filter a destination`otelIntegration()` and `localTraces()` accept one@@ -156,33 +161,9 @@ A throwing `span` callback drops the span from this destination. Return`{ replace: true, value }` from `attribute` to retain, remove, or changeone attribute.-### Redact content from local traces--Return a redaction decision to further narrow what the local trace destination-receives after the process-wide `otel({ tracePolicy })` has admitted a trace.-For example, keep spans in the local trace viewer while redacting their inputs-and outputs unless the session is public:--```ts title="agent/instrumentation/local.ts"-import { localTraces } from "eve/instrumentation/otel";--export default localTraces({- exportPolicy: {- span: ({ audience }) =>- audience === "public" ? { emit: true } : { redact: true, inputs: true, outputs: true },- },-});-```--Input redaction removes eve's known prompt, instruction, document, and-tool-argument attributes. Output redaction removes response, reasoning,-tool-result, exception, and status attributes. Redaction narrows only this-destination; it does not mutate spans sent to another destination. Policies run-in array order, and each policy receives the facade produced by the policies-before it.-## What to read next- [Instrumentation](/docs/observability/instrumentation): handle eve lifecycle events.+- [Agent Runs](./agent-runs): configure Vercel's built-in trace destination.- [Migrate instrumentation](/docs/observability/instrumentation-migration): replace `agent/instrumentation.ts`.- [Local development](../guides/dev-tui): inspect local traces in the TUI.diff --git a/docs/reference/typescript-api.md b/docs/reference/typescript-api.mdindex adb2352bc..37934deb7 100644--- a/docs/reference/typescript-api.md+++ b/docs/reference/typescript-api.md@@ -138,7 +138,7 @@ Tool definitions accept `availableInSubagents: false` to restrict the tool to to| `eve/context` | `defineState`, session and state types || `eve/sandbox` | `defineSandbox`, provider environments, and sandbox session types || `eve/instrumentation` | `defineInstrumentation`, `disableInstrumentation`, `isChannel`, lifecycle provider types |-| `eve/instrumentation/otel` | `otel`, `otelIntegration`, `localTraces`, OpenTelemetry policy types |+| `eve/instrumentation/otel` | `otel`, `otelIntegration`, `localTraces`, `agentRuns`, OpenTelemetry policy types || `eve/local-dev` | `getLocalDevCapability`, `LocalDevCapability` || [`eve/models`](../guides/evaluate) | Automatic model selection with `auto` || `eve/models/openai` | `openai`, `chatgpt`, deprecated `experimental_chatgpt` |