Skip to content

Commit 24146c0

Browse files
eyurtsevCopilot
andauthored
test(sdk): assert default toolruntime config in end-to-end test (#2324)
Adds end-to-end coverage for tools that accept ToolRuntime by capturing runtime.config inside a tool and asserting the default config injected by create_deep_agent, including recursion_limit and the deepagents metadata fields set in graph.py. This keeps the test scoped to the default graph behavior rather than invoke-time overrides. Created with [Deep Agents CLI](https://docs.langchain.com/oss/python/deepagents/cli/overview) using gpt-5.4 (provider: openai). --------- Co-authored-by: Copilot <[email protected]>
1 parent 92f5507 commit 24146c0

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

libs/deepagents/deepagents/graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def create_deep_agent( # noqa: C901, PLR0912 # Complex graph assembly logic wi
323323
cache=cache,
324324
).with_config(
325325
{
326-
"recursion_limit": 10_001,
326+
"recursion_limit": 9_999,
327327
"metadata": {
328328
"ls_integration": "deepagents",
329329
"versions": {"deepagents": __version__},

libs/deepagents/tests/unit_tests/test_end_to_end.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ def test_main_agent_streaming_metadata_includes_tags_and_config_metadata(self) -
196196
assert first_metadata.get("request_id") == "req-main-123"
197197
assert first_metadata.get("tenant") == "acme-main"
198198

199-
def test_tool_runtime_config_includes_tags_and_metadata(self) -> None:
200-
"""Test tool runtime config includes caller-provided tags and metadata."""
199+
def test_tool_runtime_config_includes_default_graph_metadata(self) -> None:
200+
"""Test tool runtime config includes the defaults from `create_deep_agent`."""
201201
captured_config: dict[str, Any] | None = None
202202

203203
@tool
@@ -238,10 +238,12 @@ def foo(runtime: ToolRuntime) -> str:
238238
},
239239
)
240240

241-
metadata = captured_config["metadata"]
242-
assert metadata["ls_integration"] == "deepagents"
243-
assert metadata["lc_agent_name"] == "supervisor"
244-
assert captured_config.get("tags") == ["tool-tag", "tool-session-456"]
241+
assert captured_config is not None
242+
assert captured_config["recursion_limit"] == agent.config["recursion_limit"]
243+
assert captured_config["tags"] == ["tool-tag", "tool-session-456"]
244+
assert captured_config["metadata"]["ls_integration"] == "deepagents"
245+
assert captured_config["metadata"]["lc_agent_name"] == "supervisor"
246+
assert "deepagents" in captured_config["metadata"]["versions"]
245247

246248
def test_deep_agent_with_fake_llm_with_tools(self) -> None:
247249
"""Test deepagent with tools using a fake LLM model.

0 commit comments

Comments
 (0)