_construct_scratchpad() — langchain Function Reference
Architecture documentation for the _construct_scratchpad() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 3a5094fa_f1ec_4d12_ae46_7af52ecae3e1["_construct_scratchpad()"] 37dfdb3a_fc75_8e43_a082_e000915175c2["ConversationalChatAgent"] 3a5094fa_f1ec_4d12_ae46_7af52ecae3e1 -->|defined in| 37dfdb3a_fc75_8e43_a082_e000915175c2 style 3a5094fa_f1ec_4d12_ae46_7af52ecae3e1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/agents/conversational_chat/base.py lines 120–132
def _construct_scratchpad(
self,
intermediate_steps: list[tuple[AgentAction, str]],
) -> list[BaseMessage]:
"""Construct the scratchpad that lets the agent continue its thought process."""
thoughts: list[BaseMessage] = []
for action, observation in intermediate_steps:
thoughts.append(AIMessage(content=action.log))
human_message = HumanMessage(
content=self.template_tool_response.format(observation=observation),
)
thoughts.append(human_message)
return thoughts
Domain
Subdomains
Source
Frequently Asked Questions
What does _construct_scratchpad() do?
_construct_scratchpad() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/conversational_chat/base.py.
Where is _construct_scratchpad() defined?
_construct_scratchpad() is defined in libs/langchain/langchain_classic/agents/conversational_chat/base.py at line 120.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free