test_agent_tool_return_direct_in_intermediate_steps() — langchain Function Reference
Architecture documentation for the test_agent_tool_return_direct_in_intermediate_steps() function in test_agent_async.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD f6ac621b_3782_139a_8a23_f8b358346fe9["test_agent_tool_return_direct_in_intermediate_steps()"] 663245d2_2254_328f_5cf8_4bbd36fb32cc["test_agent_async.py"] f6ac621b_3782_139a_8a23_f8b358346fe9 -->|defined in| 663245d2_2254_328f_5cf8_4bbd36fb32cc style f6ac621b_3782_139a_8a23_f8b358346fe9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/tests/unit_tests/agents/test_agent_async.py lines 313–341
async def test_agent_tool_return_direct_in_intermediate_steps() -> None:
"""Test agent using tools that return directly."""
tool = "Search"
responses = [
f"FooBarBaz\nAction: {tool}\nAction Input: misalignment",
"Oh well\nFinal Answer: curses foiled again",
]
fake_llm = FakeListLLM(responses=responses)
tools = [
Tool(
name="Search",
func=lambda x: x,
description="Useful for searching",
return_direct=True,
),
]
agent = initialize_agent(
tools,
fake_llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
return_intermediate_steps=True,
)
resp = await agent.acall("when was langchain made")
assert isinstance(resp, dict)
assert resp["output"] == "misalignment"
assert len(resp["intermediate_steps"]) == 1
action, _action_intput = resp["intermediate_steps"][0]
assert action.tool == "Search"
Domain
Subdomains
Source
Frequently Asked Questions
What does test_agent_tool_return_direct_in_intermediate_steps() do?
test_agent_tool_return_direct_in_intermediate_steps() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/agents/test_agent_async.py.
Where is test_agent_tool_return_direct_in_intermediate_steps() defined?
test_agent_tool_return_direct_in_intermediate_steps() is defined in libs/langchain/tests/unit_tests/agents/test_agent_async.py at line 313.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free