Engineering

Building Multi-Agent Orchestration from Scratch

January 17, 2026

The biggest technical challenge so far: getting AI agents to delegate work to each other.

Most AI frameworks treat agents as isolated units. You pick a model, give it tools, and chat. But what happens when a task needs a researcher AND a writer AND a code analyst? You'd have to manually copy-paste between sessions.

Iris solves this with a recursive delegation system. The main agent can call SendToSubAgent to hand off a subtask to a specialist. That specialist runs in its own conversation context, uses its own tools and system prompt, and returns the result. The parent agent receives the output and continues.

The tricky parts:

Cycle detection - Agent A delegates to Agent B, which delegates back to Agent A. Infinite loop. We track visited agent IDs in an OrchestrationContext that flows through the entire call tree.

Depth limits - Even without cycles, you don't want 10 levels of delegation. Configurable max depth with budget tracking.

Parallel execution - Sometimes you need three specialists working simultaneously. ParallelSubAgents dispatches tasks as a Laravel Bus batch, polls for completion, and collects results. Falls back to sequential if the queue isn't available.

The silent model problem - After receiving a sub-agent's result, some open models (especially thinking models) process it internally but produce no visible output. Just a <think> block and nothing else. We detect this and inject the sub-agent output directly as a fallback.

Built on Laravel AI SDK + Prism, running through Chutes AI as the primary provider. The orchestration context, trace visibility, and sub-conversation display all came together over about two weeks of iteration.