traceloop / traceloop/openllmetry

๐Ÿ› Bug Report: `gen_ai.request.model` set to `unknown` for LangGraph/LangChain

Open
#3,098 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.4k
Forks
1.1k
Avg merge
8d 14h
Merged PRs (30d)
2

Description

Which component is this bug for?

Langchain Instrumentation

๐Ÿ“œ Description

Both gen_ai.request.model and gen_ai.response.model are set to unknown for Spans generated by Tool invocation tasks orchestrated by LangGraph.

Sample Code

llm = init_chat_model(
    "us.anthropic.claude-3-5-haiku-20241022-v1:0",
    model_provider="bedrock_converse",
)

## Define search tool
from langchain_community.tools import DuckDuckGoSearchRun
search = DuckDuckGoSearchRun()
tools = [search]
llm_with_tools = llm.bind_tools(tools)

Sample Spans

{
    "name": "ChatBedrockConverse.chat",
    "context": {
        "trace_id": "0x686db07fa79973ed8f91c2890df88f62",
        "span_id": "0x03b083f096667e17",
        "trace_state": "[]"
    },
    "kind": "SpanKind.CLIENT",
    "parent_id": "0x43105f4fbe80e5d7",
    "start_time": "2025-07-08T23:57:54.893220Z",
    "end_time": "2025-07-08T23:57:57.336534Z",
    "status": {
        "status_code": "UNSET"
    },
    "attributes": {
        "traceloop.workflow.name": "LangGraph",
        "traceloop.entity.path": "chatbot",
        "gen_ai.system": "Langchain",
        "llm.request.type": "chat",
        "gen_ai.request.model": "unknown",
        "gen_ai.response.model": "unknown",
        "llm.request.functions.0.name": "duckduckgo_search",
        "llm.request.functions.0.description": "A wrapper around DuckDuckGo Search. Useful for when you need to answer questions about current events. Input should be a search query.",
        "llm.request.functions.0.parameters": "{\"properties\": {\"query\": {\"description\": \"search query to look up\", \"type\": \"string\"}}, \"required\": [\"query\"], \"type\": \"object\"}",
        "gen_ai.prompt.0.role": "user",
        "gen_ai.prompt.0.content": "tell me a joke",
        "gen_ai.prompt.1.role": "assistant",
        "gen_ai.prompt.1.tool_calls.0.id": "tooluse_sfylHPX7SmGH58ACbxr19Q",
        "gen_ai.prompt.1.tool_calls.0.name": "duckduckgo_search",
        "gen_ai.prompt.1.tool_calls.0.arguments": "{\"query\": \"best clean jokes currently popular\"}",
        "gen_ai.prompt.2.role": "tool",
        "gen_ai.prompt.2.content": "Jun 17, 2025 \u00b7 Discover 135+ hilarious clean jokes perfect for adults! Find funny appropriate jokes, adult clean humor, and family-friendly laughs. Jun 21, 2025 \u00b7 Looking for funny, clever, clean jokes for adults that make you laugh without crossing any lines? Whether you\u2019re at a dinner party, happy hour, or just need something witty to \u2026 May 27, 2025 \u00b7 Discover our collection of hilarious, family-friendly jokes that prove clean humor packs the biggest punch! From clever wordplay and dad jokes to knock-knock classics and \u2026 Mar 12, 2025 \u00b7 Enjoy a collection of the best clean jokes perfect for all ages! From classic one-liners to kid-friendly chuckles, spread joy and laughter with these lighthearted, family-friendly jokes. By \u2026 Nov 15, 2024 \u00b7 These jokes from Ask Reddit are perfect for adults, kids, and everyone in between! 1. Just got attacked by 6 dwarves. Not Happy. 2. A priest, a minister, and a rabbit walk into a \u2026",
        "gen_ai.prompt.2.tool_call_id": "tooluse_sfylHPX7SmGH58ACbxr19Q",
        "gen_ai.completion.0.content": "Alright, here's a classic clean joke for you:\n\nWhy don't scientists trust atoms?\nBecause they make up everything! \n\n*Ba dum tss* \ud83d\ude04 It's a bit of science humor that plays on the double meaning of \"make up\" - both as creating something and as being untrustworthy. I hope it brought a smile to your face!\n\nWould you like to hear another joke?",
        "gen_ai.completion.0.role": "assistant",
        "gen_ai.usage.prompt_tokens": 704,
        "gen_ai.usage.completion_tokens": 96,
        "llm.usage.total_tokens": 800,
        "gen_ai.usage.cache_read_input_tokens": 0
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.33.1",
            "service.name": "langgraph-min",
            "aws.log.group.names": "test_trace-min",
            "cloud.resource_id": "fastapi-app",
            "telemetry.auto.version": "0.1.3-aws",
            "aws.local.service": "langgraph-min",
            "aws.service.type": "gen_ai_agent"
        },
        "schema_url": ""
    }
}
๐Ÿ‘Ÿ Reproduction steps
  1. Add opentelemetry-instrumentation-langchain as a dependency to enable observability for LangGraph Agents.
  2. Send a prompt to the Agent that triggers a tool invocation, interacting with a Claude model via AWS Bedrock.
๐Ÿ‘ Expected behavior

OpenTelemetry span includes the gen_ai.request.model attribute populated with the correct model name.

๐Ÿ‘Ž Actual Behavior with Screenshots

gen_ai.request.model attribute is populated with unknown

๐Ÿค– Python Version

3.10

๐Ÿ“ƒ Provide any additional context for the Bug.

No response

๐Ÿ‘€ Have you spent some time to check if this bug has been raised before?
  • I checked and didn't find similar issue
Are you willing to submit PR?

None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up โ€” it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the opentelemetry-instrumentation-langchain path that handles LangGraph tool-invocation spans, using the provided AWS Bedrock sample as the reproduction. Compare the emitted request and response model attributes with the model configured through init_chat_model. Done means the span reports the correct model name instead of unknown for this flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.