_prepare_intermediate_steps() — langchain Function Reference
Architecture documentation for the _prepare_intermediate_steps() function in agent.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD ec593113_cca6_1902_3a34_7e9c8b098e7b["_prepare_intermediate_steps()"] 493d4ce4_2303_08e0_2337_2bee34fe2662["AgentExecutor"] ec593113_cca6_1902_3a34_7e9c8b098e7b -->|defined in| 493d4ce4_2303_08e0_2337_2bee34fe2662 3ad3236e_1a51_9e04_5055_95c7d2147238["_iter_next_step()"] 3ad3236e_1a51_9e04_5055_95c7d2147238 -->|calls| ec593113_cca6_1902_3a34_7e9c8b098e7b c61b7dc2_6e22_7735_1fa0_744874e0c701["_aiter_next_step()"] c61b7dc2_6e22_7735_1fa0_744874e0c701 -->|calls| ec593113_cca6_1902_3a34_7e9c8b098e7b style ec593113_cca6_1902_3a34_7e9c8b098e7b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/agents/agent.py lines 1718–1729
def _prepare_intermediate_steps(
self,
intermediate_steps: list[tuple[AgentAction, str]],
) -> list[tuple[AgentAction, str]]:
if (
isinstance(self.trim_intermediate_steps, int)
and self.trim_intermediate_steps > 0
):
return intermediate_steps[-self.trim_intermediate_steps :]
if callable(self.trim_intermediate_steps):
return self.trim_intermediate_steps(intermediate_steps)
return intermediate_steps
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _prepare_intermediate_steps() do?
_prepare_intermediate_steps() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/agent.py.
Where is _prepare_intermediate_steps() defined?
_prepare_intermediate_steps() is defined in libs/langchain/langchain_classic/agents/agent.py at line 1718.
What calls _prepare_intermediate_steps()?
_prepare_intermediate_steps() is called by 2 function(s): _aiter_next_step, _iter_next_step.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free