Functions
flowchartAsTool
Function: flowchartAsTool()
flowchartAsTool(
opts):Tool
Defined in: src/core/flowchartAsTool.ts:203
Wrap a footprintjs FlowChart as a Tool the Agent's LLM can call.
On execute:
- Constructs a fresh
FlowChartExecutor(flowchart)per call (so consecutive invocations don't share state). - Attaches each
opts.recordersentry viaexecutor.attachCombinedRecorder— the SAME recorder instances attach to every invocation's fresh executor (see the option's JSDoc for the shared-state / runId implications). - Calls
executor.run({ input: args, env: { signal } })with the LLM-supplied args + the agent's abort signal. - If the run paused, throws an Error with the checkpoint attached
(
error.checkpoint) so the agent loop can surface it. Polished agent-side pause integration is v2.6 work. - If the run completed, calls
resultMapper(snapshot)(or the default JSON.stringify) and returns the string. - If the run threw, the error propagates — the Agent's tool-call handler converts it to a synthetic error string for the LLM to see + recover from.
