-
Notifications
You must be signed in to change notification settings - Fork 164
Open
Labels
Description
Issue you'd like to raise.
When using configure_claude_agent_sdk() with Claude Agent SDK, tool invocations made by subagents (defined via agents and mcp_servers) are not recorded in LangSmith traces.
Only the main agent conversation appears.
Reproduction
import asyncio
from typing import Any
from claude_agent_sdk import (
ClaudeAgentOptions,
ClaudeSDKClient,
AgentDefinition,
tool,
create_sdk_mcp_server
)
from langsmith.integrations.claude_agent_sdk import configure_claude_agent_sdk
configure_claude_agent_sdk()
@tool("add_numbers", "Add two integers.", {"a": int, "b": int})
async def add_numbers(args: dict[str, Any]) -> dict[str, Any]:
a, b = args["a"], args["b"]
return {"content": [{"type": "text", "text": f"{a} + {b} = {a + b}"}]}
math_helper = create_sdk_mcp_server(name="math-helper", version="1.0.0", tools=[add_numbers])
async def main():
subagent = AgentDefinition(
description="Performs arithmetic tasks.",
prompt="You are a math specialist.",
tools=["add_numbers"],
)
options = ClaudeAgentOptions(
mcp_servers={"math-helper": math_helper},
allowed_tools=["mcp__math-helper__add_numbers"],
agents={"math-helper": subagent},
system_prompt="You are the main orchestrator. Delegate math to math-helper.",
)
async with ClaudeSDKClient(options=options) as client:
await client.query("Ask the math-helper agent to add 3 and 5.")
async for msg in client.receive_response():
print(msg)
if __name__ == "__main__":
asyncio.run(main())Observed
- Only main
claude.conversationtrace appears in LangSmith. - No trace for subagent
math-helperor its tooladd_numbers.
Example output:
LangSmith should record nested traces for subagents and their tool calls, e.g.:
claude.conversation
└── math-helper
└── Tool: add_numbers(a=3, b=5)
Environment
| Component | Version |
|---|---|
| claude-agent-sdk | 0.1.4 |
| langsmith | 0.4.38 |
| Python | 3.13.3 |
| Model | kimi-k2-0905-preview |
Suggestion:
No response