| Name | Type | Description |
|---|---|---|
thread_id* | str | Stable conversation id; also set as top-level |
turn_id* | str | None | Per-turn id (uuid4 / message id), or |
turn_number* | int | None | 1-based per-thread turn index, or |
cwd* | str | Current working directory, or empty string when unavailable. |
git_branch* | str | None | |
sandbox_type* | str | None | |
user_id* | str | None |
Build the shared coding-agent-v1 trace-metadata block.
Implements the coding-agent-v1 contract (LSEN-277) for Deep Agents Code:
one helper that stamps the identity block, plugin/runtime versions, turn
markers, and repo/git/cwd attribution. The seven identity/version keys and
thread_id are always present; the optional keys whose value is unknown are
omitted (per the contract), so callers can pass None for any of them.
Because Deep Agents Code is itself the runtime ā there is no separate CLI
package ā ls_integration_version and ls_agent_runtime_version both come
from the deepagents-code package version (__version__). The underlying
deepagents SDK version is surfaced separately as
dcode_client_deepagents_version by build_stream_config.
Scope-restricted contract keys are intentionally NOT produced here:
approval_policy (root/interrupted only) and ls_subagent_id /
ls_subagent_type (subagent only). This metadata propagates trace-wide
through the LangGraph stream config (and, for subagents, the per-key config
merge of langgraph#7926 / deepagents#3634), so any key placed here lands on
every descendant run. Emitting a run-type-scoped key would therefore leak it
onto run types outside its contract appliesTo set ā a hard validator
failure ā and the LangGraph runtime exposes no clean per-run-type metadata
seam to scope them. See build_stream_config for the full rationale.
Current branch name, or None.
Sandbox provider name, or None/"none" when inactive.
Stable pseudonymous user id, or None.