eve 0.53.0 → 0.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/src/channel/types.d.ts +2 -0
  3. package/dist/src/cli/commands/trace-detail.js +1 -1
  4. package/dist/src/cli/commands/trace.d.ts +2 -2
  5. package/dist/src/cli/commands/trace.js +3 -3
  6. package/dist/src/cli/dev/tui/runner.js +1 -1
  7. package/dist/src/cli/dev/tui/traces/trace-conversation.d.ts +5 -5
  8. package/dist/src/cli/dev/tui/traces/trace-conversation.js +1 -1
  9. package/dist/src/cli/dev/tui/traces/trace-view.js +1 -1
  10. package/dist/src/cli/dev/tui/traces/trace-viewer-session.js +1 -1
  11. package/dist/src/compiled/.vendor-stamp.json +1 -1
  12. package/dist/src/compiled/@opentelemetry/api/index.d.ts +1 -0
  13. package/dist/src/compiler/extension-compatibility.d.ts +6 -6
  14. package/dist/src/compiler/extension-compatibility.js +1 -1
  15. package/dist/src/compiler/manifest.d.ts +1 -1
  16. package/dist/src/compiler/manifest.js +1 -1
  17. package/dist/src/compiler/normalize-agent-config.js +1 -1
  18. package/dist/src/context/dynamic-instruction-lifecycle.d.ts +2 -1
  19. package/dist/src/context/dynamic-instruction-lifecycle.js +1 -1
  20. package/dist/src/context/keys.d.ts +3 -1
  21. package/dist/src/context/keys.js +1 -1
  22. package/dist/src/eve-channel/index.js +1 -1
  23. package/dist/src/execution/cancelled-model-call-batch.js +1 -1
  24. package/dist/src/execution/cancelled-turn-message.js +1 -1
  25. package/dist/src/execution/compaction.d.ts +2 -2
  26. package/dist/src/execution/coordination-dispatch-shared.d.ts +0 -1
  27. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  28. package/dist/src/execution/dispatch-turn-step.js +1 -1
  29. package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +7 -0
  30. package/dist/src/execution/durable-session-store.d.ts +2 -2
  31. package/dist/src/execution/eve-workflow-attributes.d.ts +3 -3
  32. package/dist/src/execution/next-driver-action.d.ts +2 -0
  33. package/dist/src/execution/route-child-delivery.js +1 -1
  34. package/dist/src/execution/runtime-context.js +1 -1
  35. package/dist/src/execution/sandbox/bindings/vercel-lifecycle.d.ts +5 -0
  36. package/dist/src/execution/sandbox/bindings/vercel-lifecycle.js +1 -1
  37. package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
  38. package/dist/src/execution/session.js +2 -2
  39. package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +5 -1
  40. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
  41. package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
  42. package/dist/src/execution/tools/sleep-workflow.js +1 -1
  43. package/dist/src/execution/tools/subagent/invoke-step.d.ts +4 -0
  44. package/dist/src/execution/tools/subagent/invoke-step.js +1 -1
  45. package/dist/src/execution/tools/subagent/start.d.ts +2 -2
  46. package/dist/src/execution/tools/subagent/start.js +1 -1
  47. package/dist/src/execution/tools/subagent/task-agent-requests.js +1 -1
  48. package/dist/src/execution/tools/todo.d.ts +2 -2
  49. package/dist/src/execution/tools/todo.js +2 -2
  50. package/dist/src/execution/turn-dispatch.d.ts +2 -0
  51. package/dist/src/execution/turn-dispatch.js +1 -1
  52. package/dist/src/execution/turn-workflow.js +1 -1
  53. package/dist/src/execution/workflow-entry-crash.d.ts +39 -0
  54. package/dist/src/execution/workflow-entry-crash.js +1 -0
  55. package/dist/src/execution/workflow-entry.d.ts +2 -0
  56. package/dist/src/execution/workflow-entry.js +1 -1
  57. package/dist/src/execution/workflow-runtime.js +1 -1
  58. package/dist/src/execution/workflow-steps.js +1 -1
  59. package/dist/src/harness/compaction.js +1 -1
  60. package/dist/src/harness/current-messages.d.ts +7 -6
  61. package/dist/src/harness/current-messages.js +1 -1
  62. package/dist/src/harness/messages.d.ts +36 -0
  63. package/dist/src/harness/messages.js +1 -1
  64. package/dist/src/harness/provider-tool-history.d.ts +5 -5
  65. package/dist/src/harness/provider-tool-history.js +1 -1
  66. package/dist/src/harness/session-limit-enforcement.d.ts +2 -15
  67. package/dist/src/harness/tool-loop.js +2 -2
  68. package/dist/src/harness/types.d.ts +6 -4
  69. package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
  70. package/dist/src/instrumentation/background-task-runtime.d.ts +18 -0
  71. package/dist/src/instrumentation/background-task-runtime.js +1 -0
  72. package/dist/src/instrumentation/channel-delivery.js +1 -1
  73. package/dist/src/instrumentation/lifecycle.d.ts +13 -0
  74. package/dist/src/instrumentation/lifecycle.js +1 -1
  75. package/dist/src/instrumentation/native-events.d.ts +7 -0
  76. package/dist/src/instrumentation/native-events.js +1 -1
  77. package/dist/src/instrumentation/parent-lineage.d.ts +2 -2
  78. package/dist/src/instrumentation/parent-lineage.js +1 -1
  79. package/dist/src/instrumentation/prepare-trace-context.d.ts +3 -11
  80. package/dist/src/instrumentation/prepare-trace-context.js +1 -1
  81. package/dist/src/instrumentation/principal-summary.d.ts +11 -0
  82. package/dist/src/instrumentation/principal-summary.js +1 -0
  83. package/dist/src/instrumentation/providers.js +1 -1
  84. package/dist/src/instrumentation/runtime.d.ts +8 -7
  85. package/dist/src/instrumentation/runtime.js +1 -1
  86. package/dist/src/instrumentation/session-context.d.ts +22 -0
  87. package/dist/src/instrumentation/session-context.js +1 -0
  88. package/dist/src/instrumentation/state.d.ts +7 -2
  89. package/dist/src/instrumentation/state.js +1 -1
  90. package/dist/src/internal/application/package.js +1 -1
  91. package/dist/src/internal/authored-definition/core.js +1 -1
  92. package/dist/src/internal/logging.js +1 -1
  93. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  94. package/dist/src/internal/nitro/routes/channel-request-instrumentation.d.ts +4 -5
  95. package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
  96. package/dist/src/internal/vercel/build-agent-workspace.js +1 -1
  97. package/dist/src/internal/vercel-agent-summary.d.ts +24 -0
  98. package/dist/src/internal/vercel-agent-summary.js +1 -1
  99. package/dist/src/protocol/baggage.d.ts +15 -2
  100. package/dist/src/protocol/baggage.js +1 -1
  101. package/dist/src/public/channels/slack/api.d.ts +2 -0
  102. package/dist/src/public/channels/slack/api.js +1 -1
  103. package/dist/src/public/channels/slack/defaults.d.ts +6 -0
  104. package/dist/src/public/channels/slack/defaults.js +3 -3
  105. package/dist/src/public/channels/slack/limits.d.ts +6 -0
  106. package/dist/src/public/channels/slack/limits.js +1 -1
  107. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  108. package/dist/src/public/definitions/agent.d.ts +1 -1
  109. package/dist/src/public/index.d.ts +1 -1
  110. package/dist/src/public/instrumentation/index.d.ts +5 -4
  111. package/dist/src/public/instrumentation/otel.d.ts +1 -1
  112. package/dist/src/runtime/agent/bootstrap.d.ts +2 -2
  113. package/dist/src/runtime/agent/bootstrap.js +1 -1
  114. package/dist/src/runtime/agent/resolve-model.js +1 -1
  115. package/dist/src/runtime/resolve-agent.js +1 -1
  116. package/dist/src/runtime/subagents/dynamic-agent-config.js +1 -1
  117. package/dist/src/self-modification/agent.js +1 -1
  118. package/dist/src/self-modification/extension/instructions.js +21 -20
  119. package/dist/src/self-modification/extension/tools/edit_file.js +1 -1
  120. package/dist/src/self-modification/extension/tools/search_registry.d.ts +1 -1
  121. package/dist/src/self-modification/extension/tools/search_registry.js +1 -1
  122. package/dist/src/setup/integrations/self-modification/setup.js +1 -1
  123. package/dist/src/setup/scaffold/create/project.js +1 -1
  124. package/dist/src/shared/agent-definition.d.ts +35 -0
  125. package/dist/src/shared/agent-definition.js +1 -1
  126. package/dist/src/shared/memory-state.js +1 -1
  127. package/dist/src/shared/serialized-observability-state.d.ts +12 -0
  128. package/dist/src/shared/serialized-observability-state.js +1 -0
  129. package/dist/src/subagents/invocation.d.ts +9 -0
  130. package/dist/src/subagents/remote-dispatch.d.ts +3 -3
  131. package/dist/src/subagents/remote-dispatch.js +1 -1
  132. package/dist/src/subagents/start-local.d.ts +2 -6
  133. package/dist/src/subagents/start-local.js +1 -1
  134. package/dist/src/subagents/start-remote.d.ts +2 -8
  135. package/dist/src/subagents/start-remote.js +1 -1
  136. package/dist/src/subagents/tool.d.ts +3 -13
  137. package/dist/src/subagents/tool.js +1 -1
  138. package/dist/src/tasks/delivery-context.d.ts +10 -1
  139. package/dist/src/tasks/delivery-context.js +2 -2
  140. package/dist/src/tracing/agent-action-instrumentation.d.ts +3 -2
  141. package/dist/src/tracing/agent-action-instrumentation.js +1 -1
  142. package/dist/src/tracing/agent-approval-instrumentation.js +1 -1
  143. package/dist/src/tracing/agent-channel-delivery-instrumentation.d.ts +1 -6
  144. package/dist/src/tracing/agent-channel-delivery-instrumentation.js +1 -1
  145. package/dist/src/tracing/agent-invocation-coordinator.d.ts +28 -0
  146. package/dist/src/tracing/agent-invocation-coordinator.js +1 -0
  147. package/dist/src/tracing/agent-invocation-terminal.d.ts +18 -0
  148. package/dist/src/tracing/agent-invocation-terminal.js +1 -0
  149. package/dist/src/tracing/agent-otel-attributes.d.ts +4 -0
  150. package/dist/src/tracing/agent-otel-attributes.js +1 -0
  151. package/dist/src/tracing/agent-otel-content.js +1 -1
  152. package/dist/src/tracing/agent-otel-provider.d.ts +4 -6
  153. package/dist/src/tracing/agent-otel-provider.js +2 -2
  154. package/dist/src/tracing/agent-otel-runtime-context.d.ts +9 -0
  155. package/dist/src/tracing/agent-otel-runtime-context.js +1 -1
  156. package/dist/src/tracing/agent-otel-session-context.d.ts +4 -3
  157. package/dist/src/tracing/agent-otel-session-context.js +1 -1
  158. package/dist/src/tracing/agent-otel-usage.d.ts +4 -10
  159. package/dist/src/tracing/agent-otel-usage.js +1 -1
  160. package/dist/src/tracing/agent-span-contract.d.ts +25 -0
  161. package/dist/src/tracing/agent-span-contract.js +1 -0
  162. package/dist/src/tracing/agent-span-error.d.ts +3 -0
  163. package/dist/src/tracing/agent-span-error.js +1 -0
  164. package/dist/src/tracing/agent-span-id-generator.d.ts +3 -0
  165. package/dist/src/tracing/agent-span-id-generator.js +1 -1
  166. package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
  167. package/dist/src/tracing/agent-trace-context-codec.d.ts +12 -0
  168. package/dist/src/tracing/agent-trace-context-codec.js +1 -0
  169. package/dist/src/tracing/agent-trace-context-store.d.ts +35 -8
  170. package/dist/src/tracing/agent-trace-context-store.js +1 -1
  171. package/dist/src/tracing/agent-trace-span-processor.d.ts +5 -7
  172. package/dist/src/tracing/agent-trace-span-processor.js +1 -1
  173. package/dist/src/tracing/agent-trace-state.d.ts +41 -3
  174. package/dist/src/tracing/agent-trace-state.js +1 -1
  175. package/dist/src/tracing/bounded-error.d.ts +1 -0
  176. package/dist/src/tracing/bounded-error.js +1 -0
  177. package/dist/src/tracing/content-span-processor.js +1 -1
  178. package/dist/src/tracing/conversation-context.d.ts +4 -0
  179. package/dist/src/tracing/conversation-context.js +1 -0
  180. package/dist/src/tracing/error-content-context.d.ts +3 -0
  181. package/dist/src/tracing/error-content-context.js +1 -0
  182. package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
  183. package/dist/src/tracing/local-trace-reader.d.ts +6 -6
  184. package/dist/src/tracing/local-trace-reader.js +1 -1
  185. package/dist/src/tracing/local-traces.d.ts +6 -8
  186. package/dist/src/tracing/local-traces.js +1 -1
  187. package/dist/src/tracing/otel-declaration.d.ts +6 -4
  188. package/dist/src/tracing/otel-registration.d.ts +2 -1
  189. package/dist/src/tracing/otel-registration.js +1 -1
  190. package/dist/src/tracing/telemetry-budget.d.ts +4 -0
  191. package/dist/src/tracing/telemetry-budget.js +1 -0
  192. package/docs/agent-config.md +42 -8
  193. package/docs/channels/slack.mdx +5 -8
  194. package/docs/guides/instrumentation-providers.md +6 -1
  195. package/docs/guides/instrumentation.md +144 -14
  196. package/docs/guides/remote-agents.md +11 -0
  197. package/docs/reference/cli.md +8 -6
  198. package/docs/reference/typescript-api.md +1 -1
  199. package/docs/sandbox.mdx +1 -1
  200. package/package.json +1 -1
@@ -56,6 +56,8 @@ Three more fields control what the AI SDK records inside those spans (see the AI
56
56
 
57
57
  eve records metadata without model or tool inputs and outputs by default. Enable either content category only after reviewing the exporter and its data-retention path.
58
58
 
59
+ In the provider layout, eve stamps each span with `gen_ai.conversation.id`, which stays fixed across local and remote activations, including independent remote root workflows. Query this attribute to find the conversation's exported, retained traces; it does not grant access or control trace parenting. On Vercel, `vercel.session_id` additionally identifies the current Workflow run. See [Query exported traces](#query-exported-traces) for the cross-backend workflow.
60
+
59
61
  You are responsible for ensuring any observability or eval provider is approved for the data exported to it.
60
62
 
61
63
  The third configurable surface, [runtime context events](#runtime-context), attaches per-model-call values to these spans.
@@ -79,11 +81,9 @@ and outcome fields. Content providers additionally receive only eve's known
79
81
  message, context, input-response, and output-schema fields; adapter-specific
80
82
  payload fields are never projected.
81
83
 
82
- The built-in OpenTelemetry provider maps each pair to an
83
- `agent.channel.delivery` consumer span under the durable session window. When
84
- `traceChannelRequests: true` creates an inbound HTTP server span, the delivery
85
- span links to it with `eve.link.type=channel.request` rather than using the
86
- short-lived request span as its parent.
84
+ For a single delivery that starts a turn, the built-in OpenTelemetry provider records the channel kind, channel name, delivery ID, optional request ID, and captured input on that turn's `invoke_agent` activation. The activation remains a root in its own trace and links to the active upstream request or function span with `eve.link.type=channel.request`. Set `traceChannelRequests: true` to create an eve-owned HTTP server span as that link target; when the option is false, an already-active upstream span remains the target.
85
+
86
+ Deliveries that do not map one-to-one to an activation still produce instrumentation lifecycle events, but the built-in OpenTelemetry provider does not emit a separate delivery span.
87
87
 
88
88
  ## Callback delivery errors
89
89
 
@@ -103,12 +103,12 @@ not mark the active span as failed.
103
103
  The built-in OpenTelemetry provider preserves each span's OTel name and adds
104
104
  `operation.name` and `resource.name` for Datadog's operation/resource mapping:
105
105
 
106
- | OTel span name | `operation.name` | `resource.name` |
107
- | ------------------------------------------------------------------------------------------------------------------ | ----------------- | ---------------------- |
108
- | `invoke_agent weather` | `invoke_agent` | `invoke_agent weather` |
109
- | `execute_tool search` | `execute_tool` | `execute_tool search` |
110
- | `chat <model>` | `chat` | `chat <model>` |
111
- | `agent.session`, `agent.step`, `agent.action`, `agent.approval`, `agent.channel.delivery`, `agent.channel.request` | Same as span name | Same as span name |
106
+ | OTel span name | `operation.name` | `resource.name` |
107
+ | ----------------------------------------------------------------------- | ----------------- | ---------------------- |
108
+ | `invoke_agent weather` | `invoke_agent` | `invoke_agent weather` |
109
+ | `execute_tool search` | `execute_tool` | `execute_tool search` |
110
+ | `chat <model>` | `chat` | `chat <model>` |
111
+ | `agent.step`, `agent.action`, `agent.approval`, `agent.channel.request` | Same as span name | Same as span name |
112
112
 
113
113
  These attributes apply to eve-owned spans in local tracing and the
114
114
  [instrumentation provider layout](./instrumentation-providers). They do not
@@ -137,6 +137,136 @@ that discard span events, including Sentry's [direct OTLP
137
137
  intake](https://docs.sentry.io/concepts/otlp/direct/traces/). These attributes
138
138
  remain available when model and tool content is redacted.
139
139
 
140
+ ## Agent trace contract
141
+
142
+ The provider layout and zero-config local tracing emit the following spans.
143
+ The legacy `instrumentation.ts` layout still uses its authored OTel setup.
144
+
145
+ | Span | Meaning |
146
+ | ----------------------- | -------------------------------------------------------- |
147
+ | `invoke_agent <agent>` | One agent activation in its own trace |
148
+ | `agent.step` | One model attempt |
149
+ | `chat <model>` | One model call beneath its step |
150
+ | `agent.action` | Durable action lifecycle, including dispatch and waiting |
151
+ | `execute_tool <tool>` | In-process tool execution beneath its action |
152
+ | `agent.approval` | Approval waiting beneath its action |
153
+ | `agent.channel.request` | Optional HTTP request span in the provider layout |
154
+
155
+ For background tools and subagents, the AI SDK's `execute_tool` span ends when
156
+ the model receives the task receipt. The enclosing `agent.action` span remains
157
+ open until the background task completes, fails, or is cancelled. Its duration,
158
+ outcome, and usage describe the background task rather than the receipt.
159
+ Background tool results follow the output-content policy. Recorded task failure
160
+ details become bounded exception and status messages; redacted spans retain only
161
+ the failure outcome, error status, and error type. The initiating turn can
162
+ finish or be cancelled while the action remains open. Ending the session closes
163
+ an action whose task never reported a terminal result.
164
+
165
+ Schema v4 removes the session-long `agent.session` root and duplicate agent session and lineage attributes. Every eve span carries `agent.trace.schema.version=4` and `gen_ai.conversation.id`; Vercel deployments additionally carry `vercel.session_id`.
166
+ Only activations use the `invoke_agent` operation. Dispatch lifecycle spans use
167
+ `agent.action` with `agent.invocation.role=caller`; the built-in `agent` tool
168
+ executes under `execute_tool agent`. Turn IDs such as `turn_0` are local to a session,
169
+ so correlate turns by session ID and turn ID together.
170
+
171
+ A conversation remains durable state; `gen_ai.conversation.id` joins the activations that operate on it.
172
+
173
+ Each activation owns a fresh trace identity, including local and remote
174
+ subagents. The first child activation links to its caller with
175
+ `eve.link.type=agent.dispatch`; incoming `traceparent` provides that link, not
176
+ the child trace ID. Later turns do not reuse the original caller link.
177
+ Conversation baggage is independent of execution lineage and trace-policy
178
+ ceilings, which remain in force across the boundary.
179
+
180
+ Channel delivery does not allocate or replace the activation, and a later turn
181
+ receives a new trace. Samplers
182
+ see the activation name and attributes after its session coordinates are
183
+ available. Sampling must be deterministic for the same trace and operation
184
+ because durable reconstruction can evaluate it again.
185
+
186
+ Use `agent.turn.outcome` to distinguish completed, failed, and cancelled activations. A failed action can be handled by the agent without failing its activation; see [Exported span names and outcomes](#exported-span-names-and-outcomes).
187
+
188
+ Activation spans retain `gen_ai.usage.input_tokens` and
189
+ `gen_ai.usage.output_tokens` alongside `agent.usage.*` totals for that activation.
190
+ Model spans carry `gen_ai.usage.*`; step and dispatch spans report
191
+ `agent.usage.*`. Activation totals summarize that activation's own model calls, while caller spans can summarize delegated usage. Do not sum usage across these levels.
192
+
193
+ Nested dispatch spans are materialized when the child settles and handed to
194
+ span processors; successful materialization removes their completed records
195
+ from durable state. Settlement does not drain exporters or authored providers.
196
+ Materialization failures are logged without failing settlement, and exporter
197
+ draining follows the runtime's normal flush lifecycle.
198
+
199
+ Cancelled or abandoned dispatches retain
200
+ their outcome without error status. Error messages and stacks on eve spans count as
201
+ output content, including errors reconstructed after a worker replacement.
202
+ Metadata-only capture retains failure status without those details. Error logging
203
+ outside eve's instrumented execution retains its existing exception content.
204
+
205
+ Agent Runs activation metadata includes bounded principal summaries:
206
+
207
+ - `agent.principal.current.type` and `agent.principal.current.id` describe the current caller.
208
+ - `agent.principal.initiator.type` and `agent.principal.initiator.id` describe the authenticated principal that created the root session. The initiator remains fixed when later turns have a different caller.
209
+
210
+ Types are limited to `user`, `service`, `runtime`, `app`, `anonymous`, `local-dev`, `unknown`, `none`, and `other`. Types are emitted for every audience when a principal is present. An absent type means no authentication context was set; `none` means an explicitly null principal and has no ID. The auth layer's `unknown` type stays `unknown`; unrecognized authored types become `other`.
211
+
212
+ Principal IDs require a content-visible audience and a resolved trace decision that allows both `recordInputs` and `recordOutputs`. Public turns and unknown turns under `eve dev` can include IDs; private and hosted-unknown turns omit them. A user-configured trace policy or forwarded content ceiling that denies either direction omits both principal IDs before turn state is stored or sampled. Empty IDs and IDs larger than 1 KiB of UTF-8 data are omitted, not truncated; authentication records are unchanged. eve does not copy other authentication fields, such as claims, email attributes, issuers, or subjects, into these summaries.
213
+
214
+ ## Query exported traces
215
+
216
+ Use a trace to investigate one activation's work. Use session and conversation attributes to find the other activations. Exporting to an OpenTelemetry backend does not turn a conversation into one continuous waterfall.
217
+
218
+ This workflow applies to schema v4 from the [instrumentation provider layout](./instrumentation-providers). Configure third-party exporters through `otelIntegration()` so they receive the same framework spans as local tracing and Agent Runs. The legacy `instrumentation.ts` setup emits the [authored trace hierarchy](#authored-trace-hierarchy), not this contract.
219
+
220
+ ### Find an activation or conversation
221
+
222
+ | Investigation | Filter |
223
+ | ------------------------ | ----------------------------------------------------------------------- |
224
+ | Agent activations | `agent.trace.schema.version=4` and `gen_ai.operation.name=invoke_agent` |
225
+ | One logical conversation | `gen_ai.conversation.id=<conversation ID>` |
226
+ | One turn | Both `gen_ai.conversation.id` and `agent.turn.id` |
227
+ | One Vercel Workflow run | `vercel.session_id=<session ID>` |
228
+ | Delegated dispatches | `agent.invocation.role=caller` |
229
+
230
+ Start with an activation filter for latency, failure, or turn-count dashboards. Every activation is a trace root. Within a conversation, group by trace ID, order activations by `agent.turn.sequence` or start time, and open the selected trace ID. Child activations link to their caller with `eve.link.type=agent.dispatch`; remote workflows keep their own execution lineage, so use conversation IDs and caller links for cross-deployment correlation.
231
+
232
+ For example, the built-in `agent` tool dispatches research into a new workflow and trace, and the next user turn starts another trace:
233
+
234
+ ```text
235
+ Trace A
236
+ invoke_agent support session=S, turn=turn_0, conversation=S
237
+ agent.step
238
+ chat <model>
239
+ agent.action role=caller, action.call_id=C
240
+ execute_tool agent
241
+
242
+ Trace B
243
+ invoke_agent research session=R, turn=turn_0, conversation=S
244
+ link: agent.dispatch -> Trace A's caller action C
245
+ agent.step
246
+ chat <model>
247
+
248
+ Trace C
249
+ invoke_agent support session=S, turn=turn_1, conversation=S
250
+ agent.step
251
+ chat <model>
252
+ ```
253
+
254
+ The conversation filter finds all three retained traces. eve initializes the conversation ID once and carries it through the existing parent context for local dispatch and `eve.conversation.id` baggage for remote dispatch. Remote session creation does not carry execution lineage or add authorization requirements for tracing. Existing authentication, principal forwarding, and root-session limits remain unchanged.
255
+
256
+ `traceparent` carries the caller's trace and span IDs for the causal link; adopting it as the child's parent would instead keep both in the same trace. Resolved trace-policy decisions and trusted remote content ceilings continue across this boundary independently of correlation, and an unsampled caller cannot be widened into a sampled child. No synthetic session span is needed.
257
+
258
+ Activation duration is elapsed time for that activation, including waits inside it, not the lifetime of the conversation or CPU time. Idle time between ended activations is not part of their durations. For token totals, choose one level: filter to `chat` model spans and sum `gen_ai.usage.*`, or filter to activations and sum their `agent.usage.input_tokens` and `agent.usage.output_tokens`. Exclude caller summaries from the activation total. Query cache usage on model spans. Do not add model, step, activation, and caller counters together.
259
+
260
+ ### Search traces
261
+
262
+ Use your destination's span-search surface to filter by the attributes in the table, group activations by session or trace ID, and open one activation's trace waterfall. Use the OTel span name and `gen_ai.operation.name` to identify the operation. Preserve eve's ownership of the OTel provider; do not register a second provider merely to add a destination.
263
+
264
+ ### Sampling and completeness
265
+
266
+ A session can contain both retained and missing activation traces. Head sampling, backend retention, destination filtering, and exporter failures all affect what a conversation query returns. Preserve the schema and correlation attributes in Collector transforms and destination policies, and configure indexing and retention for the queries above.
267
+
268
+ Do not interpret a missing activation as a missing execution, or sampled trace counts and token sums as an exact session ledger. A backend may receive descendants before the activation span finishes and exports; a temporarily missing root is not necessarily a broken parent ID. After deployment, verify a two-turn conversation and a delegation in the actual destination, including names, conversation grouping across services, separate trace roots, caller links, and outcome attributes.
269
+
140
270
  ## Runtime context
141
271
 
142
272
  _Runtime context_ is an [AI SDK concept](https://ai-sdk.dev/docs/reference/ai-sdk-core/stream-text): a user-defined object that flows through a generation lifecycle. eve exposes it through `events["step.started"]`, a callback that runs once eve has assembled the model input for an attempt and returns `{ runtimeContext }`. Because eve registers the AI SDK's OpenTelemetry integration with runtime context enabled, those returned values ride onto the model-call span and its children. The field is named `runtimeContext`, not `metadata`, because AI SDK v7 carries per-call attributes on runtime context rather than a dedicated metadata field.
@@ -198,7 +328,7 @@ eve creates the `ai.eve.turn` parent span per turn and passes enriched telemetry
198
328
 
199
329
  This hierarchy applies when eve passes telemetry to the AI SDK. When the `otel()` provider layout is declared and eve owns the agent spans, eve names its invocation span `invoke_agent <agent>` and its model-attempt spans `agent.step`. Session, turn, step, and channel context is injected as the framework half of the runtime context (`eve.version`, `eve.session.id`, `eve.environment`, `eve.turn.id`, `eve.turn.sequence`, `eve.step.index`, `eve.channel.kind`) and rides onto the spans alongside any values your `events["step.started"]` callback returns under `runtimeContext`.
200
330
 
201
- Set `traceChannelRequests: true` on `defineInstrumentation` to also wrap each inbound channel HTTP request in a single OpenTelemetry `SERVER` span named for the registered route, which parents the turn tree above (and any `hook.resume` and outgoing HTTP spans):
331
+ Set `traceChannelRequests: true` on `defineInstrumentation` to also wrap each inbound channel HTTP request in a single OpenTelemetry `SERVER` span named for the registered route. In the authored hierarchy above, this span parents the turn tree and any `hook.resume` or outgoing HTTP spans. In the provider layout, `invoke_agent` remains a separate trace root and links to the request span.
202
332
 
203
333
  ```text
204
334
  POST /eve/v1/session/:sessionId
@@ -224,7 +354,7 @@ Structural tags describe each run's place in the tree:
224
354
  - `$eve.trigger`: the channel kind that started the run
225
355
  - `$eve.schedule`: the authored schedule that created the session, including sessions started through a target channel
226
356
  - `$eve.title`: truncated title derived from the first user message
227
- - `$eve.trace_id`: trace id of the sampled agent trace containing the run, written on session, subagent, and turn rows so a dashboard run can be joined to its OpenTelemetry trace. Present only when the trace is sampled; absence means no exported OTEL trace exists.
357
+ - `$eve.trace_id`: sampled trace seed available when tagging a session, subagent, or turn run. Use it as a trace link, not a conversation-wide trace identity. Later activations can use other trace IDs; query `gen_ai.conversation.id` for the history. The tag does not confirm that a destination retained the trace.
228
358
 
229
359
  Per-turn usage tags are written on each step of a turn, accumulating cumulative totals (last write wins):
230
360
 
@@ -238,7 +368,7 @@ These tags power the **Agent Runs** tab in the Vercel dashboard. When you deploy
238
368
 
239
369
  ## Local traces
240
370
 
241
- Without an `instrumentation.ts`, `eve dev` records spans to disk — one trace per session, with turns, model steps, and tool calls. Read them two ways:
371
+ Without an `instrumentation.ts`, `eve dev` records spans to disk with one bounded trace per turn, including its model steps and tool calls. Read them two ways:
242
372
 
243
373
  - [`/traces`](dev-tui#logs-and-traces) in the dev TUI: a live trace viewer that replays captured content as a conversation.
244
374
  - [`eve traces`](../reference/cli#eve-traces): a span tree in the terminal, `eve traces ls` to list. Works after `eve dev` exits.
@@ -139,6 +139,17 @@ Identity forwarding does not make a persistent session private to one caller. Co
139
139
 
140
140
  Forwarding is explicit on both sides. The receiver names which forwarders it trusts with `eveChannel({ trustedForwarders })` (see [Auth & route protection](./auth-and-route-protection#accepting-forwarded-identity-from-another-deployment)); a receiver that refuses the forwarder — or has no `trustedForwarders` at all — rejects with a 403 and the dispatch fails.
141
141
 
142
+ Remote tracing uses ordinary `traceparent` propagation. Trace context is not an authorization grant: it cannot assert eve parent lineage, change `rootSessionId`, or remove the normal root-session token cap.
143
+
144
+ eve also carries the original `gen_ai.conversation.id` in `eve.conversation.id` baggage so you can find related traces across local and remote agents. This observability identifier does not require principal forwarding or shared execution lineage; it grants no session access and does not change trace-content policy. Session execution establishes this ID even without an instrumentation runtime. Only session-create requests with a callback may supply this baggage; top-level requests ignore it and establish their own conversation ID. Callback metadata is caller-supplied correlation, not verified identity.
145
+
146
+ eve replaces configured `traceparent` and conversation baggage only when it has a framework value to send. Incoming baggage has an 8 KiB limit; the audience and conversation readers share whitespace, percent-decoding, and duplicate-key validation. Conversation IDs are limited to 1 KiB and exclude control characters and line separators. If adding an audience assertion or conversation ID would exceed 8 KiB, eve rejects the dispatch before sending a request instead of dropping the member. Reduce `remote.headers.baggage` to leave room for these framework values.
147
+
148
+ In the [provider trace contract](./instrumentation#agent-trace-contract), each
149
+ child activation starts a separate trace. The first activation uses the incoming
150
+ `traceparent` as an `agent.dispatch` span link rather than adopting the caller's
151
+ trace ID.
152
+
142
153
  > ⚠️ **Upgrade both deployments before resuming persistent remote sessions.** A sender with continuation forwarding includes `forwardedPrincipal` on each authenticated follow-up. A receiver that supports forwarding only on session creation rejects that continuation with HTTP 400. eve does not retry without the field because that would run the follow-up as the transport service principal and silently change caller authority. The parent retains the child handle after this failure, so you can retry the same session after upgrading the receiver.
143
154
 
144
155
  A receiver on an eve version that predates all principal forwarding may instead drop the unknown field and run the session as your app's service identity; per-user connections there fail with `principal_required`. On remote requests where the dispatching turn has no auth, the field is omitted and the call proceeds on transport trust alone.
@@ -304,23 +304,25 @@ eve traces --verbose # expand every span with all attributes and events
304
304
  eve traces --json # dump the full trace as JSON
305
305
  ```
306
306
 
307
- Reads the immutable OTLP/JSON segments under `.eve/traces/v1`, so `eve dev` need not be running. Accepts a full trace id, an `agent.session.id`, or an unambiguous prefix of either. Malformed segments are skipped without hiding valid spans from the same trace.
307
+ Reads the immutable OTLP/JSON segments under `.eve/traces/v1`, so `eve dev` need not be running. Accepts a full trace id, a `gen_ai.conversation.id`, or an unambiguous prefix of either. Malformed segments are skipped without hiding valid spans from the same trace.
308
308
 
309
309
  Span rows carry inline metrics when the span recorded them — `↑input`/`↓output` token counts, gateway cost, and the tool name for `execute_tool` spans — and the header aggregates models, token totals, cost, and error count across the trace's step spans. `--verbose` expands each span under its tree row: status (with the error message on failures), timing, ids, every attribute (prompts, responses, and tool payloads as transcripts or pretty-printed JSON), and every span event with its offset from span start. `--json` prints the same records as JSON, one object per selected trace.
310
310
 
311
- A local subagent keeps its own session id but records into the parent trace. Its `invoke_agent` span is parented to the `agent.action` span that dispatched it, so the span tree carries the relationship without duplicate lineage attributes; `agent.subagent.name` remains on the child invocation as a standalone label. Either session id resolves to that trace. Remote agents propagate the parent trace context over `traceparent`.
311
+ Every subagent activation starts its own trace. The first child's `invoke_agent` root links to the dispatching caller with `eve.link.type=agent.dispatch`; remote agents carry that caller context over `traceparent`. Later turns also start fresh traces without repeating the initial caller link. All related sessions retain the same `gen_ai.conversation.id`, and `agent.subagent.name` labels the child invocation.
312
312
 
313
- A durable session keeps one persisted trace context across turns and worker resumptions. Independently replayed attempts can still produce another trace; passing the session id shows every trace it produced, oldest first.
313
+ Each `agent()` call inside an authored workflow has its own `agent.action` caller span, including sequential, parallel, and background calls. The workflow tool keeps its own `agent.action` and `execute_tool` spans. Only agent execution uses `invoke_agent`.
314
314
 
315
- Every span carries a real duration except `agent.session`: an idle session never closes, so it is recorded as a zero-duration marker and the span tree shows its descendant extent instead. A turn's `invoke_agent` span is written when the turn settles, so a running turn shows only its steps.
315
+ A durable conversation produces one bounded trace per turn. Worker replacements reuse the prepared context for the same turn, while a later turn or an independently replayed attempt starts a fresh trace. Passing the conversation ID shows every trace it produced, oldest first.
316
+
317
+ Every span carries a real duration. A turn's root `invoke_agent` span is written when the turn settles, so a running turn shows only its steps.
316
318
 
317
319
  Model and `execute_tool` spans omit their inputs and outputs by default. Set `EVE_TRACES_CONTENT=on` to capture system prompts, prompt messages, and response text for models, plus call arguments and results for tools. Each captured value is capped at 32 KB.
318
320
 
319
- Step spans carry token counts, and cost when Vercel AI Gateway served the call. Both follow the [OTel GenAI semantic conventions](https://github.com/open-telemetry/semantic-conventions-genai) (`gen_ai.usage.*`), so a third-party backend reads them without mapping.
321
+ Step spans carry token counts under `agent.usage.*`, and cost when Vercel AI Gateway served the call. Model spans also expose `gen_ai.usage.*` token counters. The CLI sums step-level counters only, so model and delegated-call totals are not counted twice.
320
322
 
321
323
  ### Retention
322
324
 
323
- eve sweeps the store when a session finishes and when the dev server starts, evicting oldest-first past the bounds below — except that the newest traces and anything written in the last five minutes are always kept, so a sweep will exceed the size budget rather than drop a trace you just recorded. Set the bounds in `.env.local`, which `eve dev` loads automatically; each accepts `off` to disable it individually.
325
+ eve sweeps the store when an activation's writes finish, when a session finishes, and when the dev server starts. An open conversation does not pin every completed turn's trace. Sweeps evict oldest-first past the bounds below, except that active traces, the newest traces, and anything written in the last five minutes are kept. A sweep can therefore exceed the size budget. Set the bounds in `.env.local`, which `eve dev` loads automatically; each accepts `off` to disable it individually.
324
326
 
325
327
  | Variable | Default | Effect |
326
328
  | ---------------------------- | -------------------- | ----------------------------------------------------------------------------------- |
@@ -57,7 +57,7 @@ export default defineTool({
57
57
 
58
58
  Tool-wide authoring helpers and types such as `defineTool`, `defineWorkflowTool`, `defineDurableCallback`, `defineDynamic`, `disableTool`, and `ToolLabelDefinition` come from `eve/tools`. Capability-specific definitions and helpers use their own subpaths (see [Built-in tools](../concepts/built-in-tools)): reusable definitions such as `bash` and `glob` come from `eve/tools/<name>`, `webSearch` comes from `eve/tools/web_search`, `experimental_workflow` comes from `eve/tools/workflow`, `sleep` comes from `eve/tools/sleep`, and approval policies and types come from `eve/tools/approval`. The route verbs `GET`/`HEAD`/`POST`/`PUT`/`PATCH`/`DELETE`/`OPTIONS`/`WS` plus `disableRoute` come from `eve/channels`, and the channel auth helpers `localDev`/`vercelOidc`/`placeholderAuth` come from `eve/channels/auth`.
59
59
 
60
- `AgentReasoningDefinition` is exported from `eve` for the top-level `defineAgent({ reasoning })` setting. `AgentLimitsDefinition` is exported for `defineAgent({ limits })`. `AgentWorkflowDefinition` and `AgentWorkflowWorldDefinition` are exported from `eve` for the `defineAgent({ experimental: { workflow } })` config shape. `ExperimentalWorkflowToolInput` is exported from `eve/tools/workflow`; `WebSearchToolInput` and `WebSearchProvider` are exported from `eve/tools/web_search`.
60
+ `AgentReasoningDefinition` is exported from `eve` for the top-level `defineAgent({ reasoning })` setting. `AgentLimitsDefinition` is exported for `defineAgent({ limits })`. `AgentWorkflowDefinition`, `AgentWorkflowRetentionDefinition`, and `AgentWorkflowWorldDefinition` are exported from `eve` for the `defineAgent({ experimental: { workflow } })` config shape. `ExperimentalWorkflowToolInput` is exported from `eve/tools/workflow`; `WebSearchToolInput` and `WebSearchProvider` are exported from `eve/tools/web_search`.
61
61
 
62
62
  `defineInstructions` accepts `{ content: string, role?: "system" | "user" }`; omitted `role` means `"system"`. Its `eve/instructions` version of `defineDynamic` accepts only `session.started` and `turn.started` handlers returning `defineInstructions(...)` or `null`. The legacy `{ markdown: string }` definition remains available as a deprecated system-role form.
63
63
 
package/docs/sandbox.mdx CHANGED
@@ -291,7 +291,7 @@ Session sandboxes are keyed per durable session, not per deployment, so redeploy
291
291
 
292
292
  For sandboxes with `bootstrap`, unrelated agent changes preserve the template and session sandbox keys even when there are no skill or workspace seed files. You do not need to add a seed file or `revalidationKey` solely to preserve reuse across those changes.
293
293
 
294
- Reattachment still depends on the backend retaining its physical sandbox state. If a persisted Vercel sandbox is no longer available, eve creates a replacement, using the current template when one is configured. Files and other changes made after the original sandbox was created are not restored automatically. Because the durable session still has the same sandbox key, `onSession` does not run again for this replacement. Persist important artifacts outside the sandbox, and do not rely on `onSession` as the only place that applies security-critical configuration.
294
+ Reattachment still depends on the backend retaining its physical sandbox state. If a persisted Vercel sandbox is missing or its saved filesystem snapshot is no longer available, eve deletes the unusable record and creates a replacement from the current template when one is configured. Files and other changes made after the original sandbox was created are not restored automatically. Because the durable session still has the same sandbox key, `onSession` does not run again for this replacement. Persist important artifacts outside the sandbox, and do not rely on `onSession` as the only place that applies security-critical configuration.
295
295
 
296
296
  When the eve server stops, no sandbox compute outlives it. `eve dev` stops the sandboxes it started when the dev server closes, and a self-hosted production server stops every open sandbox on shutdown (`SIGTERM`/`SIGINT`). Session state persists across the stop — the next server start reattaches each durable session from its stopped container, VM, or snapshot. Custom `SandboxBackend` adapters implement `stop()` for authored runtime calls and `shutdown()` for server teardown. Both stop the underlying compute while keeping the session reattachable from persisted state where the backend supports it; authored `stop()` failures reject, while process-wide shutdown collects and logs failures without blocking teardown.
297
297
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eve",
3
- "version": "0.53.0",
3
+ "version": "0.54.0",
4
4
  "private": false,
5
5
  "description": "Filesystem-first framework for durable backend AI agents that run anywhere.",
6
6
  "keywords": [