traceloop / traceloop/openllmetry
๐ Bug Report: TypeError: unsupported operand type(s) for +=: 'async_generator_asend' and 'async_generator_asend'
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
When using LangChain instrumentation on an AgentExecutor, the error specified in the title occurs.
๐ Reproduction steps
- Add LangChain Instrumentation to application, either manually or through automated instrumentation.
- Make a call to any LangChain AgentExecutor, e.g. in the following LangServe context for a simple chat app:
agent = create_tool_calling_agent(model, tools, agent_prompt)
agent_executor = AgentExecutor(
agent=agent,
tools=tools,
)
add_routes(
app,
agent_executor.with_types(input_type=Input, output_type=Output),
path="/chat",
)
- By default,
stream_runnableis set toTrue, which then throws the error in the title. Settingstream_runnabletoFalseallows the agent executor to run without issue.
๐ Expected behavior
No error - AgentExecutor chain should complete without issue, traces should be available at destination specified in instrumentation.
๐ Actual Behavior with Screenshots
chat-app-langchain | File "/usr/local/lib/python3.11/site-packages/langchain/agents/agent.py", line 560, in aplan
chat-app-langchain | final_output += chunk
chat-app-langchain | TypeError: unsupported operand type(s) for +=: 'async_generator_asend' and 'async_generator_asend'
Which links to the following LangChain agent code: https://github.com/langchain-ai/langchain/blob/master/libs/langchain/langchain/agents/agent.py#L560C18-L561C14
๐ค Python Version
Tried with both 3.11 and 3.12
๐ Provide any additional context for the Bug.
Tried with opentelemetry-instrumentation==0.46b0 and both langchain==0.2.1 and langchain==0.2.2.
Exception is thrown across multiple agent types.
๐ 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?
Yes I am willing to submit a PR!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up โ it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with LangChain AgentExecutor and stream_runnable=True, then inspect the linked langchain/agents/agent.py entry point around the aplan failure and the LangChain instrumentation path. Done means the AgentExecutor completes with streaming enabled, no TypeError occurs on Python 3.11 or 3.12, and traces remain available at the configured destination.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai, observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100