@loopstack/delegate-error-example-workflow
v0.23.4
Published
A workflow demonstrating how tool validation errors and runtime errors are handled by DelegateToolCalls and fed back to the LLM.
Downloads
1,002
Maintainers
Readme
title: Delegate Error Handling Example description: Example showing how delegate tool-call loops handle failure modes — schema validation errors, runtime errors, failing sub-workflows, LLM error recovery
@loopstack/delegate-error-example-workflow
Demonstrates how delegate tool-call loops handle different tool failure modes and feed structured error results back to the LLM for recovery.
By using this example you'll get...
- A multi-turn LLM workflow using
LlmGenerateTextTool+LlmDelegateToolCallsTool - Three failure types in one flow: schema validation error, runtime error, and failing sub-workflow
- Error propagation back into the conversation via
LlmUpdateToolResultTool
Installation
npm install @loopstack/delegate-error-example-workflowThis example uses @loopstack/claude-module through @loopstack/llm-provider-module, so configure Claude credentials before running.
Then register the module in your app:
import { StudioApp } from '@loopstack/common';
import { DelegateErrorExampleModule, DelegateErrorWorkflow } from '@loopstack/delegate-error-example-workflow';
@StudioApp({
title: 'Delegate Error Example',
workflows: [DelegateErrorWorkflow],
})
@Module({
imports: [DelegateErrorExampleModule],
})
export class MyAppModule {}How It Works
- The workflow seeds an instruction asking the model to intentionally trigger tool failures first.
- The LLM generates tool calls (
strict_schema,runtime_error,failing_sub_workflow). - Delegate execution runs tools and callback updates merge results into pending delegate state.
- Completed tool results are posted back as
tool_resultblocks so the LLM can self-correct. - The workflow ends when the model reaches
end_turnand stores the final message.
Public API
DelegateErrorExampleModuleDelegateErrorWorkflow
Dependencies
@loopstack/common@loopstack/llm-provider-module@loopstack/claude-module
