Implementing Multi-Agent Orchestration with Workflow Patterns: Strands and Temporal Examples

Implementing multi-agent orchestration with workflow patterns decomposes complex AI tasks into deterministic pipelines of specialized agents, coordinating their execution through either lightweight in-process sequences or durable distributed workflows.

The awesome-ai-apps repository by Arindam200 provides production-ready reference implementations for implementing multi-agent orchestration with workflow patterns, demonstrating how to break down sophisticated workloads into manageable, reusable agent components. By treating agents as discrete units within a deterministic control flow, these patterns enable clear data lineage, simplified debugging, and modular extensibility across both prototyping and production environments.

Workflow-Driven Orchestration with Strands

The Strands framework (integrated with Agno in this repository) enables rapid construction of multi-agent pipelines through deterministic sequential execution. Each agent encapsulates a specific capability—such as research, analysis, or writing—into a reusable unit with its own system prompt and optional tools.

Three-Agent Research Pipeline Architecture

The implementation in course/aws_strands/06_multi_agent_pattern/06_4_workflow_agent/main.py demonstrates a three-stage research workflow where data flows unidirectionally from information gathering to final report generation:

  • Researcher Agent (lines 20-32): Configured with the http_request tool to gather web information and return concise findings with source URLs.
  • Analyst Agent (lines 33-44): Validates facts and extracts key insights from the research output, rating accuracy and identifying critical observations.
  • Writer Agent (lines 45-53): Synthesizes the analysis into a structured final report with clear formatting.

Implementing Sequential Execution

The orchestration logic resides in the run_research_workflow() function (lines 56-85), which explicitly passes string outputs between agents to maintain a transparent data flow:

def run_research_workflow(user_input: str):
    # 1️⃣ Research

    research_response = researcher_agent(
        f"Research: '{user_input}'. Use tools to find reliable sources with URLs."
    )
    # 2️⃣ Analysis

    analyst_response = analyst_agent(
        f"Analyze these findings about '{user_input}':\n\n{research_response}"
    )
    # 3️⃣ Writing

    final_report = writer_agent(
        f"Create a report on '{user_input}' based on:\n\n{analyst_response}"
    )
    return {
        "query": user_input,
        "research": str(research_response),
        "analysis": str(analyst_response),
        "report": str(final_report),
    }

A secondary validation function, run_fact_check() (lines 88-115), applies the same pattern for claim verification. This approach ensures separation of concerns—each agent handles a single responsibility with a concise prompt, improving model reliability and making the pipeline extensible without modifying existing agent definitions.

Production-Grade Stateful Workflows with Temporal

For workloads requiring durability, automatic retries, and distributed execution, the repository provides a Temporal-based implementation in advance_ai_agents/temporal_agents/temporal_transaction_processing_ai_agent/temporal/workflows.py. This pattern maintains the same multi-agent decomposition but adds persistence and fault tolerance.

Defining Explicit Workflow States

The Temporal workflow uses explicit state management to survive worker crashes and network interruptions:

  • WorkflowState enum (lines 23-34): Defines lifecycle states including EMBEDDING_GENERATED, AI_ANALYSIS_COMPLETE, COMPLETED, and FAILED.
  • WorkflowExecutionState dataclass (lines 36-49): Stores mutable execution data including embeddings, similar transaction references, decision results, and timing metrics.

Building Durable Multi-Agent Pipelines

The TransactionProcessingWorkflow class (lines 50-130) orchestrates activities such as generate_embedding, search_similar_transactions, apply_business_rules, and analyze_transaction_with_ai while maintaining deterministic execution through workflow.now() for timestamps:

@workflow.defn
class TransactionProcessingWorkflow:
    @workflow.run
    async def run(self, transaction_details: TransactionDetails) -> Dict:
        await self._execute_with_state_tracking(
            "generate_embedding", self._generate_embedding,
            transaction_details, WorkflowState.EMBEDDING_GENERATED
        )
        # Additional stages: search_similar_transactions, apply_business_rules, etc.

        self.state.current_state = WorkflowState.COMPLETED
        return {
            "transaction_id": self.state.transaction_id,
            "decision": self.state.decision_result.decision,
            "processing_time_ms": self.state.processing_time_ms,
            "state": self.state.current_state.value,
        }

Key production features include automatic retries via RetryPolicy configuration (lines 68-78) and compensation logic that updates transaction status to "failed" on errors (lines 145-152), ensuring data consistency even when AI services fail.

Comparing Workflow Patterns: Strands vs Temporal

When implementing multi-agent orchestration with workflow patterns, selecting the appropriate framework depends on your reliability requirements:

  • Strands workflows provide lightweight, in-process execution ideal for prototyping. They offer deterministic sequencing and clear data flow without external dependencies, making them perfect for rapid iteration in course/aws_strands/06_multi_agent_pattern/06_4_workflow_agent/main.py.
  • Temporal workflows add distributed durability, state persistence, and automatic retry mechanisms suitable for production financial or healthcare applications. The checkpointing of WorkflowExecutionState after each activity ensures that multi-agent pipelines can resume from exact points of failure.

Both patterns share the architectural principle of specialized agents with single responsibilities connected by explicit data contracts, allowing you to migrate from Strands prototypes to Temporal production workflows without redesigning core agent logic.

Summary

  • Decompose tasks into specialized agents (researcher, analyst, writer) with discrete system prompts and tools to improve reliability and maintainability.
  • Use Strands (course/aws_strands/06_multi_agent_pattern/06_4_workflow_agent/main.py) for rapid prototyping of sequential multi-agent pipelines where deterministic in-process execution suffices.
  • Use Temporal (advance_ai_agents/temporal_agents/temporal_transaction_processing_ai_agent/temporal/workflows.py) when you need durable state management, automatic retries via RetryPolicy, and failure recovery for production workloads.
  • Maintain explicit data flow by passing structured outputs between agents, enabling debugging and allowing intermediate state inspection.
  • Design for extensibility by keeping agent definitions modular, allowing new stages to be inserted into workflows without modifying existing agent implementations.

Frequently Asked Questions

What is multi-agent orchestration with workflow patterns?

Multi-agent orchestration with workflow patterns coordinates multiple AI agents through predefined, deterministic pipelines where each specialized agent performs a specific task and passes structured output to the next stage. According to the awesome-ai-apps source code, this approach separates concerns between data gathering (researcher), validation (analyst), and synthesis (writer) agents while maintaining clear data lineage through the workflow function.

How do I implement a basic sequential workflow with Strands?

Define specialized Agent instances from the Strands framework with distinct system prompts and optional tools like http_request, then create an orchestration function that invokes each agent sequentially. As demonstrated in course/aws_strands/06_multi_agent_pattern/06_4_workflow_agent/main.py, pass the previous agent's string output as context to the next agent's invocation, returning a structured dictionary containing all intermediate results for transparency.

What advantages does Temporal provide over simple sequential workflows?

Temporal adds durability through automatic state checkpointing after each activity, handles transient failures via configurable RetryPolicy with exponential backoff, and provides compensation logic for transaction rollback. The TransactionProcessingWorkflow class in advance_ai_agents/temporal_agents/temporal_transaction_processing_ai_agent/temporal/workflows.py demonstrates how WorkflowExecutionState survives worker crashes, enabling pipelines to resume exactly where they left off rather than restarting from the beginning.

Can I migrate from a Strands workflow to Temporal without rewriting agents?

Yes, the architectural patterns are compatible because both treat agents as discrete units with explicit input/output contracts. You can port the business logic from Strands agent calls into Temporal activities while preserving the agent definitions, gaining distributed execution and fault tolerance without redesigning the prompts or tools. The core research-to-analysis-to-writing flow remains structurally identical whether using run_research_workflow() or TransactionProcessingWorkflow.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →