test_agent_tool_return_direct() — langchain Function Reference
Architecture documentation for the test_agent_tool_return_direct() function in test_agent.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD ca756be3_835d_6412_c888_717773e675a1["test_agent_tool_return_direct()"] 47a7b285_8e60_f78f_282d_429958c446fa["test_agent.py"] ca756be3_835d_6412_c888_717773e675a1 -->|defined in| 47a7b285_8e60_f78f_282d_429958c446fa style ca756be3_835d_6412_c888_717773e675a1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/tests/unit_tests/agents/test_agent.py lines 316–339
def test_agent_tool_return_direct() -> 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,
)
output = agent.run("when was langchain made")
assert output == "misalignment"
Domain
Subdomains
Source
Frequently Asked Questions
What does test_agent_tool_return_direct() do?
test_agent_tool_return_direct() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/agents/test_agent.py.
Where is test_agent_tool_return_direct() defined?
test_agent_tool_return_direct() is defined in libs/langchain/tests/unit_tests/agents/test_agent.py at line 316.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free