Skip to content

Multiple Agents in One Pipeline ​

examples/12-multiple-agents.halo

How to use different agents (LLMs) in a single pipeline WHY: Different tasks need different model capabilities/costs

Open in the playground →

halo
// ============================================================
// STEP 12: Multiple Agents in One Pipeline
// ============================================================
// LEARN: How to use different agents (LLMs) in a single pipeline
// WHY:  Different tasks need different model capabilities/costs
// ============================================================

// Cheap agent for simple tasks
agent Quick [openai/gpt-4o-mini, temp: 0.0]

// Powerful agent for complex tasks
agent Smart [anthropic/claude-3-5-sonnet, temp: 0.7]

// Specialized agent for creative tasks
agent Creative [google/gemini-1.5-pro, temp: 0.9]

pipeline ProcessIdea(idea: String) -> Result:
  idea
    // Step 1: Quick initial analysis (cheap)
    |> Quick.prompt("Is this idea feasible? Yes/No + one reason.")
    
    // Step 2: Deep analysis (powerful)
    |> Smart.prompt("Expand on this idea in detail")
    
    // Step 3: Generate creative variations (creative)
    |> Creative.prompt("Generate 3 creative variations")
    |> System.Print()

// Cost optimization: Use cheap models for simple tasks,
// reserve expensive models for complex reasoning.

curl -fsSL https://halolang.com/install.sh | sh