This repository was archived by the owner on Feb 24, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -262,7 +262,9 @@ export abstract class Agent extends BaseSingleActionAgent {
262262 /**
263263 * Construct a scratchpad to let the agent continue its thought process
264264 */
265- constructScratchPad ( steps : AgentStep [ ] ) : string | BaseChatMessage [ ] {
265+ async constructScratchPad (
266+ steps : AgentStep [ ]
267+ ) : Promise < string | BaseChatMessage [ ] > {
266268 return steps . reduce (
267269 ( thoughts , { action, observation } ) =>
268270 thoughts +
@@ -280,7 +282,7 @@ export abstract class Agent extends BaseSingleActionAgent {
280282 inputs : ChainValues ,
281283 suffix ?: string
282284 ) : Promise < AgentAction | AgentFinish > {
283- const thoughts = this . constructScratchPad ( steps ) ;
285+ const thoughts = await this . constructScratchPad ( steps ) ;
284286 const newInputs : ChainValues = {
285287 ...inputs ,
286288 agent_scratchpad : suffix ? `${ thoughts } ${ suffix } ` : thoughts ,
Original file line number Diff line number Diff line change @@ -65,8 +65,8 @@ export class ChatAgent extends Agent {
6565 return new ChatAgentOutputParser ( ) ;
6666 }
6767
68- constructScratchPad ( steps : AgentStep [ ] ) : string {
69- const agentScratchpad = super . constructScratchPad ( steps ) ;
68+ async constructScratchPad ( steps : AgentStep [ ] ) : Promise < string > {
69+ const agentScratchpad = await super . constructScratchPad ( steps ) ;
7070 if ( agentScratchpad ) {
7171 return `This was your previous work (but I haven't seen any of it! I only see what you return as final answer):\n${ agentScratchpad } ` ;
7272 }
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ export class ChatConversationalAgent extends Agent {
7575 }
7676 }
7777
78- constructScratchPad ( steps : AgentStep [ ] ) : BaseChatMessage [ ] {
78+ async constructScratchPad ( steps : AgentStep [ ] ) : Promise < BaseChatMessage [ ] > {
7979 const thoughts : BaseChatMessage [ ] = [ ] ;
8080 for ( const step of steps ) {
8181 thoughts . push ( new AIChatMessage ( step . action . log ) ) ;
You can’t perform that action at this time.
0 commit comments