Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to serialize / deserialize steps in AgentExecutor #194

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

carlosdp
Copy link

@carlosdp carlosdp commented Mar 2, 2023

Small change that allows for asynchronous continuation of an AgentExecutor when some of the steps are longer running tasks. Example:

// CustomTool = a tool with returnDirect = true

const result = executor.call({ input }); // CustomTool returns direct with "wait", so we need to wait for a long task to finish

const serializedSteps = result.serializeSteps();

//... later

const toolResult; // contains result from CustomTool long running task

executor.deserializeSteps(serializedSteps, toolResult); // replaces the last Observation with the actual result. at the moment, CustomTool needs to be smart enough to respond with returnDirect = false now

const result = executor.call({ input }); // continue as usual, repeat

I just pulled this out of the custom executor fork I made for a project of mine, so not fully thought through, but I think this pattern makes sense.

@nfcampos nfcampos added the question Further information is requested label Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants