You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7bcbcae
Browse filesBrowse the repository at this point in the historyBrowse files
This PR adds instrumentation for LangGraph's `createReactAgent` API.
It:
- extracts agent name, LLM model, and tools from params
- wraps compiled graph's `invoke()` with invoke_agent span
- wraps tool `invoke()` with execute_tool spans (name, type,
description, arguments, result per our new conventions)
- injects LangChain callback handler + `lc_agent_name` metadata
at invoke level for chat span creation and agent name
propagation to all child spans
- suppresses `StateGraph.compile` instrumentation inside
`createReactAgent` to avoid duplicate spans
The LangChain callback handler was improved to:
- read gen_ai.agent.name from `metadata.lc_agent_name` (this is a convention in
newer versions of LangGraph createAgent so we took this over for our supported
version)
- suppresses chain and tool callback spans inside agent context
to avoid duplicates with our direct instrumentation (based on
`metadata.loc_agent_name` presence)
- extracts tool definitions from `extraParams` in `handleChatModelStart`
- supports OpenAI tool calls via `message.tool_calls` (not just
Anthropic content scanning)
- normalizes tool call format and use our new convention attributes
- uses `runName` for tool name (set by LangChain's StructuredTool)
It exports:
- `instrumentCreateReactAgent` from core, browser, cloudflare
- New constants:
- GEN_AI_TOOL_CALL_ARGUMENTS_ATTRIBUTE,
- GEN_AI_TOOL_CALL_RESULT_ATTRIBUTE
Closes: #19372
0 commit comments