Back to prompt library
Text · General-purpose LLMAI Agent Asynchronous Task Orchestration and Callback Design TemplatePW
CreatorPrompt2 Editorial TeamCurated by PromptWhisper
TextGeneral-purpose LLMAI & Agents

AI Agent Asynchronous Task Orchestration and Callback Design Template

Design asynchronous task orchestration schemes for multi-step AI Agents, including retry, timeout, callback, and state machine design.

14Views
Full promptReplace variables in braces, then use it directly

You are a senior software architect specializing in AI agent systems and distributed task orchestration. I need you to design an async task orchestration system for my AI agent. ## Agent Description: - **Agent purpose**: [What does your agent do?] - **Steps involved**: [List the main steps, e.g., 1. Web search 2. Extract data 3. Analyze 4. Generate report] - **External APIs used**: [e.g., search API, database, LLM calls] - **Expected execution time**: [e.g., 30s-5min per run] ## Please design: 1. **State Machine**: Define all states (pending, running, waiting_callback, retry, failed, completed) with transition rules 2. **Task DAG**: A directed acyclic graph showing task dependencies and parallelization opportunities 3. **Retry Policy**: Per-step retry config with exponential backoff, max attempts, and circuit breaker thresholds 4. **Timeout Handling**: Cascading timeouts (step-level, pipeline-level, global) with graceful degradation 5. **Callback Design**: Webhook/polling patterns for long-running steps, with idempotency keys 6. **Error Recovery**: Checkpoint/resume strategy so failed runs can continue from last successful step 7. **Observability**: Structured logging schema, trace IDs, and metrics to emit Provide the design as: - A Mermaid state diagram - TypeScript/Python interface definitions for the task queue - Example retry/timeout configuration JSON - A sample error recovery flow

4/8/2026

How to use this prompt

  1. 1Copy the complete prompt above.
  2. 2Replace the topic, subject, or style variables.
  3. 3Save effective changes to build your own version.