> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agnost.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Vercel eve

> Monitor eve agents and the MCP servers they publish with eve's OpenTelemetry integration

[eve](https://eve.dev/docs) is Vercel's framework for durable backend agents. It
emits OpenTelemetry spans for every agent turn, model call, and tool call, using the
GenAI semantic conventions Agnost AI reads. You add one exporter file to the agent.
You don't need the Agnost AI SDK, and you don't change any agent code.

The exporter applies to the whole agent, whichever channel starts the work: the HTTP
API, a chat channel such as Slack, a schedule, or the
[MCP channel](https://eve.dev/docs/channels/mcp) when you publish the agent or its
tools as an MCP server.

## Manual setup: OpenTelemetry

### 1. Install the exporter

```bash theme={null}
npm install @vercel/otel
```

### 2. Add the Agnost AI destination

Create `agent/instrumentation/agnost.ts`. eve loads every file in
`agent/instrumentation/` on its own, so you don't need to import this one anywhere.

```typescript agent/instrumentation/agnost.ts theme={null}
import { OTLPHttpProtoTraceExporter } from "@vercel/otel";
import { otelIntegration } from "eve/instrumentation/otel";

export default otelIntegration({
  traceExporter: new OTLPHttpProtoTraceExporter({
    url: "https://otel.agnost.ai/v1/traces",
    headers: { "X-Agnost-Org-ID": process.env.AGNOST_ORG_ID! },
  }),
  // Send eve's agent, model, and tool spans. Skip Vercel Workflow's
  // internal spans, which carry no conversation data.
  exportPolicy: {
    span: ({ name }) => ({ emit: !name.startsWith("workflow.") }),
  },
  // Attribute each turn to the signed-in caller.
  runtimeContext: ({ session }) => {
    const caller = session.auth.current;
    return caller ? { userId: caller.principalId } : undefined;
  },
});
```

`runtimeContext` adds `userId` to every model span, and Agnost AI uses it for
user-level analytics. `principalId` is the caller your channel's `auth` accepted,
such as the subject of an OAuth token. To use your own ID instead, read it from
`caller.attributes`.

### 3. Record inputs and outputs in production

In preview and production, eve sends only metadata unless the channel marks the
conversation `public`. Without message and tool content, Agnost AI can't classify
intents, sentiment, or failures. Create `agent/instrumentation/otel.ts` to send it:

```typescript agent/instrumentation/otel.ts theme={null}
import { otel } from "eve/instrumentation/otel";

export default otel({
  tracePolicy: () => ({
    emit: true,
    recordInputs: true,
    recordOutputs: true,
  }),
});
```

This policy applies to every OpenTelemetry destination in the process, and it also
decides whether eve keeps completed run data. To keep
some content out, return `recordInputs: false` or `recordOutputs: false` for the
`channel`, `audience`, or `environment` the policy receives, or redact individual
attributes with an `exportPolicy.attribute` callback in `agnost.ts`.

### 4. Set your org ID and redeploy

```bash theme={null}
vercel env add AGNOST_ORG_ID production
```

Paste your Agnost AI org ID, then redeploy. Vercel applies environment variables to
new deployments only. For local runs, put `AGNOST_ORG_ID` in `.env.local`.

### What appears in Agnost AI

| eve span | In Agnost AI |
| - | - |
| `invoke_agent <agent>` | One conversation turn: the user's message and the agent's final reply. |
| `chat <model>` | A model call with its prompt, response, and token usage. |
| `execute_tool <tool>` | A tool call with its arguments, result, latency, and outcome. |
| `agent.step` | A step event, named `workflow`, that groups one model call with the tools it requested. |

* **Conversations** are grouped by eve's session ID (`gen_ai.conversation.id`), so
  every turn in one eve session lands in the same conversation.
* **Users** come from the `userId` that `runtimeContext` sets.

#### MCP servers built with eve

With `mcpChannel({ tools: true })`, an MCP client can call the agent's tools directly.
Each direct `tools/call` runs outside a conversation, so it appears in Agnost AI as
its own session with one tool event, including arguments, result, and latency. These
calls don't run a model, so `runtimeContext` doesn't apply and the event has no user.
Work started through `agent_start` runs a full agent turn and appears like any other
conversation.

### Verify

1. Start the agent with `AGNOST_ORG_ID` set, for example with `eve dev`.
2. Send one message that makes the agent call a tool.
3. Open **Events** in Agnost AI. You should see the turn, the model call, and the tool
   call with its arguments.
4. Open **Conversations** to check that the turn is grouped under the eve session and
   attributed to the caller.

To compare with what eve exported, run `eve traces show` for the most recent local
trace.

### Troubleshooting

* **No events**: confirm `AGNOST_ORG_ID` is set in the environment the deployment runs
  in, and redeploy after adding it. The URL must be the full trace endpoint,
  `https://otel.agnost.ai/v1/traces`.
* **Events without message or tool content**: the default trace policy drops content
  in preview and production. Add the `otel.ts` policy from step 3.
* **Many `workflow.*` events in separate sessions**: the `exportPolicy` filter is
  missing from `agnost.ts`.
* **Every user is anonymous**: confirm `runtimeContext` returns `userId`, and that
  the channel's `auth` identifies callers. Direct MCP tool calls have no user, as
  described above.

### References

* [eve OpenTelemetry](https://eve.dev/docs/observability/otel)
* [eve instrumentation and trace policy](https://eve.dev/docs/observability/instrumentation)
* [eve MCP channel](https://eve.dev/docs/channels/mcp)
* [Agnost AI OpenTelemetry endpoint](https://docs.agnost.ai/otel.md)

## Next steps

* [Conversations](https://docs.agnost.ai/using-conversations.md): review complete eve sessions.
* [Tool calls](https://docs.agnost.ai/using-tool-calls.md): track tool reliability and latency.
* [Patterns](https://docs.agnost.ai/using-patterns.md): organize production conversations by what users wanted.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.