Multi-Agent Workflow Chain Orchestration Pipeline Generator
Synthesize self-documenting workflow chain orchestration scripts and visualization pipelines for autonomous agent graphs.
Deploy this template to turn complex agent workflow topologies into typed, documented, and resilient orchestration scripts. It builds the state graph, failure handling, and automated architectural diagram exports.
Role: Lead Developer Experience Technical Writer with deep expertise in autonomous workflow graph orchestration.
Context
- Agent Orchestration Framework: {{orchestration_framework}}
- Chain Topology Specification: {{chain_topology_spec}}
- Error & Fallback Policy: {{retry_fallback_policy}}
- Observability Sink: {{telemetry_sink}}
- Docstring Format Standard: {{docstring_convention}}
- Max Execution Timeout: {{execution_timeout_ms}}
Task
Author an automated documentation generator and workflow harness script that parses multi-agent handoff definitions, generates self-documenting executable workflow code, and outputs a dynamic runtime visualization pipeline for the specified agent graph.
Method
- Ingest {{chain_topology_spec}} to derive node dependencies, inter-agent communication channels, and conditional transition edges.
- Structure execution nodes according to {{orchestration_framework}} idioms, wrapping agent calls with standardized telemetry collectors targeting {{telemetry_sink}}.
- Synthesize comprehensive parameter, state, and edge documentation formatted according to {{docstring_convention}}.
- Implement resilient execution loops governed by {{retry_fallback_policy}} to handle network jitter and agent hallucinations.
- Integrate timeout wrappers enforcing {{execution_timeout_ms}} on all asynchronous branch executions.
- Generate an automated documentation extractor routine within the script that renders Mermaid.js sequence diagrams directly from the runtime graph.
- Embed a local simulation harness executing dry-run state transitions across all documented branches.
Constraints
- Generated code MUST be fully typed with complete Python type annotations.
- The output script MUST NOT use blocking synchronous calls in multi-agent routing steps.
- Error handling MUST explicitly route unrecoverable failures to fallback branches.
- Documentation generator function MUST be runnable directly via CLI arguments.
Output format
Provide a unified executable script structured as:
- Configuration & Telemetry Setup (targeting {{telemetry_sink}})
- Node State Definitions & Agent Interfaces (with {{docstring_convention}} docstrings)
- Graph Assembly & Dynamic Router Class
- Markdown/Mermaid Documentation Generator Engine
- Interactive Simulation Main Block
Self-review
- Confirm every transition branch defined in {{chain_topology_spec}} is mapped to an executable node.
- Verify timeout settings correctly reference {{execution_timeout_ms}} across all async tasks.
- Ensure markdown export creates valid, parseable Mermaid diagrams without syntax errors.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.