_get_agent() — langchain Function Reference
Architecture documentation for the _get_agent() function in test_agent_async.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 3f4a2a33_35f0_c575_3ea6_003b91ce484c["_get_agent()"] 663245d2_2254_328f_5cf8_4bbd36fb32cc["test_agent_async.py"] 3f4a2a33_35f0_c575_3ea6_003b91ce484c -->|defined in| 663245d2_2254_328f_5cf8_4bbd36fb32cc 78621a5c_7ab7_b520_854c_ed21436db574["test_agent_bad_action()"] 78621a5c_7ab7_b520_854c_ed21436db574 -->|calls| 3f4a2a33_35f0_c575_3ea6_003b91ce484c 1db5bd9b_725f_bb12_8e78_8802e4da6f33["test_agent_stopped_early()"] 1db5bd9b_725f_bb12_8e78_8802e4da6f33 -->|calls| 3f4a2a33_35f0_c575_3ea6_003b91ce484c style 3f4a2a33_35f0_c575_3ea6_003b91ce484c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/tests/unit_tests/agents/test_agent_async.py lines 54–82
def _get_agent(**kwargs: Any) -> AgentExecutor:
"""Get agent for testing."""
bad_action_name = "BadAction"
responses = [
f"I'm turning evil\nAction: {bad_action_name}\nAction Input: misalignment",
"Oh well\nFinal Answer: curses foiled again",
]
fake_llm = FakeListLLM(cache=False, responses=responses)
tools = [
Tool(
name="Search",
func=lambda x: x,
description="Useful for searching",
),
Tool(
name="Lookup",
func=lambda x: x,
description="Useful for looking up things in a table",
),
]
return initialize_agent(
tools,
fake_llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
verbose=True,
**kwargs,
)
Domain
Subdomains
Source
Frequently Asked Questions
What does _get_agent() do?
_get_agent() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/agents/test_agent_async.py.
Where is _get_agent() defined?
_get_agent() is defined in libs/langchain/tests/unit_tests/agents/test_agent_async.py at line 54.
What calls _get_agent()?
_get_agent() is called by 2 function(s): test_agent_bad_action, test_agent_stopped_early.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free