Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions libs/code/deepagents_code/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1542,9 +1542,9 @@ def _get_repository_metadata() -> RepositoryMetadata | None:
return repo


# coding-agent-v1 contract literals (LSEN-277). See `build_coding_agent_metadata`.
CODING_AGENT_KIND = "coding_agent"
"""Fixed `ls_agent_kind` literal identifying the coding-agent trace class."""
# coding-agent-v1 contract literals. See `build_coding_agent_metadata`.
CODING_AGENT_PURPOSE = "coding"
"""Fixed `ls_agent_purpose` literal identifying the coding-agent trace class."""

CODING_AGENT_INTEGRATION = "deepagents-code"
"""Stable `ls_integration` id for this plugin (unchanged for backward-compat)."""
Expand All @@ -1568,9 +1568,9 @@ def build_coding_agent_metadata(
) -> dict[str, Any]:
"""Build the shared coding-agent-v1 trace-metadata block.

Implements the `coding-agent-v1` contract (LSEN-277) for Deep Agents Code:
Implements the `coding-agent-v1` contract 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
markers, and repo/git/cwd attribution. The six 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.

Expand Down Expand Up @@ -1603,7 +1603,7 @@ def build_coding_agent_metadata(
The contract metadata dict with unknown keys omitted.
"""
metadata: dict[str, Any] = {
"ls_agent_kind": CODING_AGENT_KIND,
"ls_agent_purpose": CODING_AGENT_PURPOSE,
Comment thread
mdrxy marked this conversation as resolved.
"ls_integration": CODING_AGENT_INTEGRATION,
"ls_agent_runtime": CODING_AGENT_RUNTIME,
"thread_id": thread_id,
Expand Down Expand Up @@ -1650,7 +1650,7 @@ def build_stream_config(
) -> RunnableConfig:
"""Build the LangGraph stream config dict.

Stamps the shared `coding-agent-v1` trace-metadata contract (LSEN-277) via
Stamps the shared `coding-agent-v1` trace-metadata contract via
`build_coding_agent_metadata` — identity block, plugin/runtime versions,
turn markers, and repo/git/cwd attribution — onto `metadata`. Metadata set
here propagates trace-wide to every run in the graph (root, llm, tool, and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
},
"keys": [
{
"key": "ls_agent_kind",
"key": "ls_agent_purpose",
"appliesTo": ["root", "llm", "tool", "subagent", "interrupted"],
"type": "string",
"allowedValues": ["coding_agent"],
"allowedValues": ["coding"],
"requirement": "always",
"requiredWhereKnown": false
},
Expand Down
6 changes: 3 additions & 3 deletions libs/code/tests/unit_tests/test_coding_agent_metadata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Contract tests for the coding-agent-v1 trace-metadata standard (LSEN-277).
"""Contract tests for the coding-agent-v1 trace-metadata standard.

These load the machine-readable contract (`validator.json`, vendored under
`data/`) and assert that the metadata Deep Agents Code stamps onto its
Expand Down Expand Up @@ -173,7 +173,7 @@ def test_identity_block(self) -> None:
sandbox_type=None,
user_id=None,
)
assert metadata["ls_agent_kind"] == "coding_agent"
assert metadata["ls_agent_purpose"] == "coding"
assert metadata["ls_integration"] == "deepagents-code"
assert metadata["ls_agent_runtime"] == "Deep Agents Code"
assert metadata["ls_trace_schema_version"] == "coding-agent-v1"
Expand Down Expand Up @@ -251,5 +251,5 @@ def test_unknown_keys_omitted(self) -> None:
"sandbox_type",
):
assert absent not in metadata
assert metadata["ls_agent_kind"] == "coding_agent"
assert metadata["ls_agent_purpose"] == "coding"
assert metadata["thread_id"] == "t1"
2 changes: 1 addition & 1 deletion libs/code/tests/unit_tests/tui/test_textual_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ def test_coding_agent_identity_block_present(self) -> None:
from deepagents_code._version import __version__

metadata = build_stream_config("t-id", assistant_id=None)["metadata"]
assert metadata["ls_agent_kind"] == "coding_agent"
assert metadata["ls_agent_purpose"] == "coding"
assert metadata["ls_integration"] == "deepagents-code"
assert metadata["ls_agent_runtime"] == "Deep Agents Code"
assert metadata["ls_trace_schema_version"] == "coding-agent-v1"
Expand Down