Tool Chain

Explicitly define sequences of tool calls for complex workflows.

category: Tool Composition
arcade.dev/patterns

Context

Multi-step processes with well-defined order.

Problem

Agents may not know the correct sequence of tools for complex tasks.

Solution

Define explicit chains:
- Step definitions: Ordered list of tools
- Data passing: How outputs feed next inputs
- Checkpoints: Where to resume on failure
- Completion criteria: When the chain is done

Examples

Python
# Define a chain for customer onboarding
ONBOARDING_CHAIN = ToolChain(
    name="customer_onboarding",
    steps=[
        Step("create_account", outputs=["account_id"]),
        Step("setup_billing", inputs=["account_id"], outputs=["billing_id"]),
        Step("send_welcome_email", inputs=["account_id"]),
        Step("schedule_kickoff", inputs=["account_id"])
    ]
)

@tool
def run_onboarding(customer_data: CustomerData) -> OnboardingResult:
    """Run the complete customer onboarding chain."""
    return ONBOARDING_CHAIN.execute(customer_data)

Considerations

  • Document the chain's purpose and steps
  • Handle step failures with compensation or retry
  • Allow resuming from checkpoints
  • For long running chains, return an execution ID and instructions for how to check the status

Related Patterns

More in Tool Composition