Verified on 2026-11-20 against
strands-agents1.63.0,strands-agents-tools0.8.11, Python 3.11 and Bedrock inus-east-1. Every number below came out of a real run. E9 aggregates those runs and says so. The scripts and raw output live in https://github.com/pinxiong/strands-in-action/tree/master/usecases/10-mixed. The model isamazon.nova-pro-v1:0.
The task in this post is the same small task from the last four posts. A fixture holds three invented per-node token counts. An agent has to add them with a sum_tokens tool and save a short brief with a save_draft tool. Earlier posts ran that task on a swarm, a graph, a workflow tool and a second OS process reached over A2A. This post puts three orchestrators in one process at the same time. A Graph fixes the order, the vended Workflow tool runs a deterministic sub-process and a Swarm handles one layer of research. There is no socket and no second process. Here "orchestrating" means composing these three pieces into one run, not coordinating agents by hand.
Three orchestrators in one process do not share one context. A Graph hands a node the text of its parents' results. A Workflow tool hands the next task a rendered string. A Swarm hands its members a key-value SharedContext. The composition works only because I wrote the adapters. The orchestrators compose at the API level and do not compose at the data level. That is the whole finding: the adapters are the work.
The title is a claim about evidence. Inside one process you can still inspect each object in memory, so the boundary is not a network. It is a rendering step. This post answers three questions with nine experiments: which fields cross from one orchestrator into the next, how an inner failure is marked on the outer result and what the composition costs. The short answer is that only text crosses, an inner tool failure can be reported as success and the two mixed runs use 74.5% and 192.8% more model tokens than the pure Graph baseline E1.
One scope note before the trace. This is the open-source Strands Agents SDK, a Python library that runs inside your own process. Bedrock supplies the model. The eight runs that reach Bedrock share one fixture, short prompts and one process; E9 only reads their evidence and makes no model call. That is a bench for inspecting a boundary, not a sample of production traffic. The numbers describe what the runtime reports. They say nothing about answer quality.
One naming note before the source. GraphState.results holds one NodeResult per completed node. A condition predicate is a function the Graph calls to decide whether an edge fires. SharedContext is the Swarm's nested dictionary of keys per node. task_results is the Workflow tool's persisted record of each task. MultiAgentBase is the SDK base class that both Swarm and Graph inherit from, so a Graph node can take one as its executor. @tool is the SDK decorator that turns a plain Python function into a tool an Agent can call. An adapter is code I wrote to move a value from one of those structures into a message the next orchestrator can read. A sentinel is a value I planted to see whether it survives the crossing. I call a failure swallowed when a tool raises and the agent loop turns the exception into text. I call a failure agent-level when the exception escapes that loop. Two different numbers here carry the word "tokens". accumulated_usage.totalTokens is what the runtime says a run spent, such as 4829 for E1. The 3640 in each brief is a fixture figure: sum_tokens adds three invented per-node counts from data/brief-input.json. That number belongs to the task, not to a measurement of model use. The four earlier posts each end with a list of what their paradigm gives up. This post starts from those lists and does not restate the shared task.
When not to use this
Do not mix orchestrators when a downstream step has to branch on a result. E6 below shows that a condition predicate can read structured NodeResult fields, but a downstream node prompt gets only str(NodeResult) text. E8 shows that a condition predicate cannot see a failure that lives in the Workflow tool's task_results. A branch that needs a status, a token count or a per-task success flag has to read them from a structure it owns. A mixed run does not give it one.
Do not mix them when the inner failure has to be auditable. E7 shows a tool that raises inside a nested Swarm leaving the outer Graph completed. E8 shows the Workflow tool reporting 100.0% success while one of its tasks recorded an error on disk. Only an agent-level exception made the outer Graph fail. A compliance gate cannot sit on a text string that says success.
Do not mix them on a linear chain. In E1, E2, E3, E4 and E5 the ledger records the same two fixture numbers every time: 3640 tokens and $0.002912. The briefs differ in wording but carry no new fact. E9 shows the two mixed runs using 74.5% and 192.8% more model tokens than the pure Graph baseline E1, with wall clock up to 3.02x longer. I had planned a parallel research layer inside the Swarm. The run produced a serial handoff, not parallel work. That was the first sign the composition was decorative.
There is one thing mixing buys. A Graph can schedule a Swarm as a node, so a deterministic state machine can contain one layer of autonomous handoffs. None of the three pure baselines did that. A Swarm refused to host a Graph node and the Workflow tool is not a Graph node at all. If you need exactly that shape, and you accept a text-only boundary that you cannot audit, mixing is a real option. It is not a way to get more data power or more reliability.
Three channels, one process
The Graph keeps the richest record. Every finished node becomes a NodeResult in state.results, and _build_result exposes that dictionary on the GraphResult a caller holds.
# strands/multiagent/graph.py:1164-1181 -- verbatim, strands-agents 1.63.0 node.result = node_result node.execution_time = node_result.execution_time if node_result.status == Status.INTERRUPTED: yield self._activate_interrupt(node, node_result.interrupts) return if node_result.status == Status.FAILED: node.execution_status = Status.FAILED self.state.failed_nodes.add(node) else: node.execution_status = Status.COMPLETED self.state.completed_nodes.add(node) self.state.results[node.node_id] = node_result self.state.execution_order.append(node) # Accumulate metrics self._accumulate_metrics(node_result) # strands/multiagent/graph.py:1327-1352 -- verbatim, strands-agents 1.63.0 def _build_result(self, interrupts: list[Interrupt]) -> GraphResult: """Build graph result from current state. Args: interrupts: List of interrupts collected during execution. Returns: GraphResult with current state. """ return GraphResult( status=self.state.status, results=self.state.results, accumulated_usage=self.state.accumulated_usage, accumulated_metrics=self.state.accumulated_metrics, execution_count=self.state.execution_count, execution_time=self._execution_time_with_active_interval(self.state.execution_time), total_nodes=self.state.total_nodes, completed_nodes=len(self.state.completed_nodes), failed_nodes=len(self.state.failed_nodes), interrupted_nodes=len(self.state.interrupted_nodes), execution_order=self.state.execution_order, edges=self.state.edges, entry_points=self.state.entry_points, interrupts=interrupts, invocation_context=self._current_invocation_context, ) A condition predicate receives the state itself, so it can read those fields.
# strands/multiagent/graph.py:209-224 -- verbatim, strands-agents 1.63.0 def should_traverse(self, state: GraphState, *, invocation_state: dict[str, Any]) -> bool: """Check if this edge should be traversed based on condition. Args: state: The current graph execution state. invocation_state: Runtime context passed during graph invocation. New-style conditions (EdgeConditionWithContext) receive this parameter. Legacy conditions (Callable[[GraphState], bool]) are called with state only. """ condition = self.condition if condition is None: return True if self._check_is_context_condition(condition): return condition(state, invocation_state=invocation_state) legacy_condition = cast(LegacyEdgeCondition, condition) return legacy_condition(state) The next Graph node does not receive that state. _build_node_input renders each dependency with str() and puts the resulting text into the prompt.
# strands/multiagent/graph.py:1284-1325 -- verbatim, strands-agents 1.63.0 # Get satisfied dependencies dependency_results = {} for edge in self.edges: if ( edge.to_node == node and edge.from_node in self.state.completed_nodes and edge.from_node.node_id in self.state.results ): if edge.should_traverse(self.state, invocation_state=self._current_invocation_state): dependency_results[edge.from_node.node_id] = self.state.results[edge.from_node.node_id] if not dependency_results: # No dependencies - return task as ContentBlocks if isinstance(self.state.task, str): return [ContentBlock(text=self.state.task)] else: return cast(list[ContentBlock], self.state.task) # Combine task with dependency outputs node_input = [] # Add original task if isinstance(self.state.task, str): node_input.append(ContentBlock(text=f"Original Task: {self.state.task}")) else: # Add task content blocks with a prefix node_input.append(ContentBlock(text="Original Task:")) node_input.extend(cast(list[ContentBlock], self.state.task)) # Add dependency outputs node_input.append(ContentBlock(text="\nInputs from previous nodes:")) for dep_id, node_result in dependency_results.items(): node_input.append(ContentBlock(text=f"\nFrom {dep_id}:")) # Get all agent results from this node (flattened if nested) agent_results = node_result.get_agent_results() for result in agent_results: agent_name = getattr(result, "agent_name", "Agent") result_text = str(result) node_input.append(ContentBlock(text=f" - {agent_name}: {result_text}")) return node_input str(NodeResult) delegates to the inner result. For a nested orchestrator that inner result is a MultiAgentResult, and its __str__ builds one line of text per node.
# strands/multiagent/base.py:66-90 -- verbatim, strands-agents 1.63.0 def __str__(self) -> str: """Return a human-readable string representation of the node result. Delegates to the inner result's string representation: - AgentResult: Uses AgentResult.__str__ (extracts text content) - MultiAgentResult: Uses MultiAgentResult.__str__ (recursive) - Exception: Uses the exception's string representation Returns: String representation of the node's result. """ return str(self.result) def get_agent_results(self) -> list[AgentResult]: """Get all AgentResult objects from this node, flattened if nested.""" if isinstance(self.result, Exception): return [] # No agent results for exceptions elif isinstance(self.result, AgentResult): return [self.result] else: # Flatten nested results from MultiAgentResult flattened = [] for nested_node_result in self.result.results.values(): flattened.extend(nested_node_result.get_agent_results()) return flattened # strands/multiagent/base.py:165-187 -- verbatim, strands-agents 1.63.0 def __str__(self) -> str: """Return a human-readable string representation of the multi-agent result. Priority order: 1. Interrupts (if present) → stringified list of interrupt dicts 2. Node results → each node's string output, prefixed with node name Returns: String representation based on the priority order above. """ if self.interrupts: return str([interrupt.to_dict() for interrupt in self.interrupts]) parts = [] for node_name, node_result in self.results.items(): # Remove only the single trailing newline that AgentResult.__str__ appends # as a framework separator, preserving all user-owned whitespace (leading # indentation, internal markdown hard-break spaces, payload trailing newlines). node_str = str(node_result).removesuffix("\n") if node_str: parts.append(f"{node_name}: {node_str}") return "\n".join(parts) The Swarm keeps a different structure. SharedContext is a nested dictionary, and a handoff writes the caller's context into it.
# strands/multiagent/swarm.py:129-143 -- verbatim, strands-agents 1.63.0 @dataclass class SharedContext: """Shared context between swarm nodes.""" context: dict[str, dict[str, Any]] = field(default_factory=dict) def add_context(self, node: SwarmNode, key: str, value: Any) -> None: """Add context.""" self._validate_key(key) self._validate_json_serializable(value) if node.node_id not in self.context: self.context[node.node_id] = {} self.context[node.node_id][key] = value # strands/multiagent/swarm.py:677-701 -- verbatim, strands-agents 1.63.0 def _handle_handoff(self, target_node: SwarmNode, message: str, context: dict[str, Any]) -> None: """Handle handoff to another agent.""" # If task is already completed, don't allow further handoffs if self.state.completion_status != Status.EXECUTING: logger.debug( "task_status=<%s> | ignoring handoff request - task already completed", self.state.completion_status, ) return current_node = cast(SwarmNode, self.state.current_node) self.state.handoff_node = target_node self.state.handoff_message = message # Store handoff context as shared context if context: for key, value in context.items(): self.shared_context.add_context(current_node, key, value) logger.debug( "from_node=<%s>, to_node=<%s> | handing off from agent to agent", current_node.node_id, target_node.node_id, ) The next Swarm member still reads text. _build_node_input serializes the dictionary into a bullet list in the prompt.
# strands/multiagent/swarm.py:761-769 -- verbatim, strands-agents 1.63.0 # Include actual shared context, not just a mention shared_context = context_info.get("shared_context", {}) if shared_context: context_text += "Shared knowledge from previous agents:\n" for node_name, context in shared_context.items(): if context: # Only include if node has contributed context context_text += f"• {node_name}: {context}\n" context_text += "\n" The Swarm's own result carries node_history. It does not carry shared_context.
# strands/multiagent/swarm.py:1088-1100 -- verbatim, strands-agents 1.63.0 def _build_result(self, interrupts: list[Interrupt]) -> SwarmResult: """Build swarm result from current state.""" return SwarmResult( status=self.state.completion_status, results=self.state.results, accumulated_usage=self.state.accumulated_usage, accumulated_metrics=self.state.accumulated_metrics, execution_count=len(self.state.node_history), execution_time=self.state.execution_time, node_history=self.state.node_history, interrupts=interrupts, invocation_context=self._current_invocation_context, ) The Workflow tool keeps a third structure on disk. Each task writes a record with a status, a result and metrics.
# strands_tools/workflow.py:660-667 -- verbatim, strands-agents-tools 0.8.11 workflow["task_results"][task_id] = { **workflow["task_results"][task_id], "status": ("completed" if result["status"] == "success" else "error"), "result": content, "completed_at": datetime.now(timezone.utc).isoformat(), "metrics": result.get("metrics"), } completed_tasks.add(task_id) The upstream record is spliced into the next task's prompt as text.
# strands_tools/workflow.py:413-430 -- verbatim, strands-agents-tools 0.8.11 # Build context from dependent tasks context = [] if task.get("dependencies"): for dep_id in task["dependencies"]: dep_result = workflow["task_results"].get(dep_id, {}) if dep_result.get("status") == "completed" and dep_result.get("result"): # Format the dependency results dep_content = [] for msg in dep_result["result"]: if isinstance(msg, dict) and msg.get("text"): dep_content.append(msg["text"]) if dep_content: context.append(f"Results from {dep_id}:\n" + "\n".join(dep_content)) # Build comprehensive task prompt with context task_prompt = task["description"] if context: task_prompt = "Previous task results:\n" + "\n\n".join(context) + "\n\nCurrent Task:\n" + task_prompt The caller of workflow(action="start") receives one dictionary with content and status. The content block holds a single sentence.
# strands_tools/workflow.py:690-709 -- verbatim, strands-agents-tools 0.8.11 # Workflow completed workflow["status"] = "completed" workflow["completed_at"] = datetime.now(timezone.utc).isoformat() self.store_workflow(workflow_id, workflow) # Calculate success rate completed_count = sum(1 for result in workflow["task_results"].values(Source:https://dev.to/aws-builders/orchestrating-agents-three-orchestrators-one-process-4agc