Skip to content

Conversation

@constantinius
Copy link
Contributor

@linear
Copy link

linear bot commented Nov 7, 2025

@constantinius constantinius requested review from a team November 7, 2025 17:00
result2 = agent_executor.invoke({
"input": "Calculate a 18% tip on a $45.50 bill"
})
result2 = agent.invoke({"input": "Calculate a 18% tip on a $45.50 bill"})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: create_agent expects {"messages": ...} input, but test-langchain2/main_tool.py:51 and 57-59 use {"input": ...}, causing a KeyError.
Severity: CRITICAL | Confidence: 0.95

🔍 Detailed Analysis

The create_agent function in LangChain v1 expects input in a {"messages": [{"role": "user", "content": "..."}]} format. At test-langchain2/main_tool.py:51 and test-langchain2/main_tool.py:57-59, the agent is invoked with an outdated {"input": "..."} format. This mismatch will cause the agent to not find the expected messages key, leading to a KeyError or ValidationError during execution.

💡 Suggested Fix

Update the input format at test-langchain2/main_tool.py:51 and test-langchain2/main_tool.py:57-59 from {"input": "..."} to {"messages": [{"role": "user", "content": "..."}]} to match LangChain v1's create_agent expectations.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: test-langchain2/main_tool.py#L51

Potential issue: The `create_agent` function in LangChain v1 expects input in a
`{"messages": [{"role": "user", "content": "..."}]}` format. At
`test-langchain2/main_tool.py:51` and `test-langchain2/main_tool.py:57-59`, the agent is
invoked with an outdated `{"input": "..."}` format. This mismatch will cause the agent
to not find the expected `messages` key, leading to a `KeyError` or `ValidationError`
during execution.

Did we get this right? 👍 / 👎 to inform future reviews.

@constantinius constantinius merged commit aa1730a into main Nov 17, 2025
5 checks passed
@constantinius constantinius deleted the constantinius/feat/langchain/v1-updates branch November 17, 2025 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants