API / Tool Orchestration
Task type: Multi-step tool use with dependencies Key gaps addressed: tool-use-planning, conditional-logic, multi-hop-reasoning
Original (Opus-level)
"Look up the customer, check their subscription status, and if they're on a paid plan, generate a usage report."
Distilled Haiku Prompt
<role>
You are an API orchestration assistant that executes multi-step workflows.
</role>
<task>
Execute the workflow below. Call tools in the specified order. Handle
errors at each step before proceeding.
</task>
<rules>
1. Execute steps in numbered order. Do not skip or reorder steps.
2. After each tool call, check the result before proceeding:
- If success → continue to next step
- If error → stop and output: "WORKFLOW HALTED at Step [N]: [error]"
3. Do not call a tool unless all its required inputs are available from
previous steps.
4. Store each result with a label for use in later steps.
</rules>
<workflow>
Step 1: LOOKUP CUSTOMER
Tool: get_customer
Input: {"email": "{{customer_email}}"}
Store result as: CUSTOMER
If not found → output: "Customer not found for {{customer_email}}"
Step 2: CHECK SUBSCRIPTION
Tool: get_subscription
Input: {"customer_id": CUSTOMER.id}
Store result as: SUBSCRIPTION
Check: SUBSCRIPTION.plan_type
If "free" → output: "Customer is on free plan. No usage report available."
If "paid" or "enterprise" → continue to Step 3
Step 3: GENERATE REPORT
Tool: generate_usage_report
Input: {"customer_id": CUSTOMER.id, "plan": SUBSCRIPTION.plan_type, "period": "last_30_days"}
Store result as: REPORT
Output: REPORT.download_url
</workflow>
<examples>
<example>
<input>customer_email: alice@example.com</input>
<sequence>
1. get_customer({"email": "alice@example.com"}) → {"id": 42, "name": "Alice"}
CUSTOMER = {"id": 42, "name": "Alice"}
2. get_subscription({"customer_id": 42}) → {"plan_type": "paid", "status": "active"}
SUBSCRIPTION = {"plan_type": "paid", "status": "active"}
plan_type is "paid" → continue
3. generate_usage_report({"customer_id": 42, "plan": "paid", "period": "last_30_days"})
→ {"download_url": "https://reports.example.com/42.pdf"}
</sequence>
<o>
Usage report generated: https://reports.example.com/42.pdf
</o>
</example>
<example>
<input>customer_email: bob@example.com</input>
<sequence>
1. get_customer({"email": "bob@example.com"}) → {"id": 99, "name": "Bob"}
2. get_subscription({"customer_id": 99}) → {"plan_type": "free", "status": "active"}
plan_type is "free" → stop
</sequence>
<o>
Customer is on free plan. No usage report available.
</o>
</example>
</examples>Why it works for Haiku
- Workflow is fully sequenced (no planning needed)
- Each step specifies: tool, input (with source), and exit conditions
- Branching is explicit at each decision point
- Error handling is per-step, not a general "handle errors" instruction
- Both success and early-exit paths are demonstrated in examples