-
Notifications
You must be signed in to change notification settings - Fork 568
Closed
Description
Within a flow there are a variety of reasons I might need to store out-of-band context. An example is let's say I have state stored according to a session id. I want tools to be used in the context of this session id, but I don't want the LLM to be forced to forward the session id through.
There should be an easy mechanism to do something like:
defineFlow({
name: 'doThing',
inputSchema: z.object({sessionId: z.string()}),
}, async input => {
storeContext('sessionId', input.sessionId); // saved into ALS
await generate({
prompt: 'do stuff with tools',
tools: ['getSessionHistory'],
});
});
defineTool({
name: 'getSessionHistory',
}, async () => {
const sessionId = loadContext('sessionId');
return await doSomeServerThing(sessionId);
});In Go we may not need to do this because ctx.Context already gives people ways to do this for themselves, but I don't think folks are familiar enough with ALS to do this for themselves.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done