Star
The Star pattern places one hub agent at the centre with several specialist spokes. The hub fans out questions to the relevant spoke, collects each reply, and synthesises a final answer. Spokes never talk to each other; everything routes through the hub.
Classic (non-beta) primitives: DefaultPattern with OnContextCondition routing, spoke handoffs returning to centre, ContextVariables tracking results.
Key Characteristics#
- Single hub. The hub picks which spoke to query, waits for the reply, then either delegates to another spoke or terminates with a synthesis.
- Dynamic
Handoff. A single parameterisedask_spoke(spoke, query)tool returnsHandoff(target=spoke), so the framework routes the next turn directly to the chosen spoke. No per-spoke graph rules are needed for the delegation edge —Handoff.targetis authoritative. - WAL-gated synthesis. The
synthesisetool reads the WAL viaHubInjectfor each spoke's reply marker (e.g."[weather]:") and refuses with a briefpending: ...status string until all required spokes have replied. The graph'sToolCalled("synthesise")rule terminates the workflow once the gate opens; the display code reads the stored synthesis fromcontext_vars["synthesis"]after close.
Routing Mechanics#
- Spokes return to hub.
FromSpeaker(<spoke>) → AgentTarget(hub)rotates control back after each spoke replies. - Sender prefixing. Spoke replies in this demo are prefixed with the spoke name in square brackets — e.g.
[weather]: Partly cloudy .... The defaultWindowedSummaryprojection drops sender identity (each envelope becomes a plain user-role message), so an explicit prefix lets the hub LLM attribute each reply correctly when synthesising.
Parallel-call defence
Without mitigation, real Sonnet would emit ask_spoke for all three spokes plus synthesise in a single round, flooding the trace with parallel tool calls before the first spoke even replies. The fix is at the model layer: set Anthropic's tool_choice knob via AnthropicConfig.extra_body:
AnthropicConfig(
model="claude-sonnet-4-6",
extra_body={"tool_choice": {"type": "auto", "disable_parallel_tool_use": True}},
)
Sonnet now emits exactly one tool call per response. Each round becomes a clean ask_spoke → spoke reply → ask_spoke sequence, and synthesise lands only when the hub genuinely sees all three replies.
OpenAI exposes the analogous parallel_tool_calls=False as a typed field on OpenAIConfig; Gemini's behaviour is naturally serial. The technique — disable parallel tool calls when a hub's protocol requires one tool per turn — is portable; only the config knob is provider-specific.
Agent Flow#
sequenceDiagram
participant User as user
participant Hub as hub
participant Weather as weather
participant Sports as sports
participant Finance as finance
User->>Hub: question
Hub->>Weather: Handoff(target="weather")
Weather->>Hub: [weather]: Partly cloudy ...
Hub->>Sports: Handoff(target="sports")
Sports->>Hub: [sports]: The Riverhawks ...
Hub->>Finance: Handoff(target="finance")
Finance->>Hub: [finance]: S&P 500 closed ...
Hub->>Hub: synthesise reads WAL, set_context("synthesis", ...)
Note over Hub: ToolCalled("synthesise") → TerminateTarget("answered") Migration Notes#
| Classic | Beta |
|---|---|
Coordinator routes by inspecting ContextVariables | Hub routes via a parameterised ask_spoke tool returning Handoff(target=spoke) |
Spoke replies carry ReplyResult.target=AgentTarget(coordinator) | FromSpeaker(<spoke>) → AgentTarget(hub) rule rotates control back |
| Synthesis triggered by checking aggregated context | Synthesis triggered by an explicit synthesise tool call; the tool reads the WAL via HubInject, gates on required markers, and stores the result via set_context |
Code#
Tip
The hub uses real Sonnet (the routing decision is the LLM-driven part of the demo). The spokes use TestConfig with pre-canned deterministic replies so the synthesis turn can quote them cleanly without LLM-quality noise.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
Output#
session: 4f2e...
user: What's the weather like and how did the local football team do? Also a quick word on the markets.
[tool] ask_spoke(weather): What is the current weather like?
hub: [Handed off via ask_spoke] What is the current weather like?
weather: [weather]: Partly cloudy, 68°F, light southwesterly breeze; no precipitation expected.
[tool] ask_spoke(sports): How did the local football team do?
hub: [Handed off via ask_spoke] How did the local football team do?
sports: [sports]: The Riverhawks won 2-1 last night, with the winning goal scored in the 87th minute.
[tool] ask_spoke(finance): Quick market summary
hub: [Handed off via ask_spoke] Quick market summary
finance: [finance]: S&P 500 closed up 0.4% on cooling inflation data ahead of next week's Fed meeting.
[tool] synthesise(headline='Daily Roundup')
hub: [Handed off via synthesise]
closed: reason='answered'
--- final synthesis ---
**Daily Roundup**
- [weather]: Partly cloudy, 68°F, light southwesterly breeze; no precipitation expected.
- [sports]: The Riverhawks won 2-1 last night, with the winning goal scored in the 87th minute.
- [finance]: S&P 500 closed up 0.4% on cooling inflation data ahead of next week's Fed meeting.