Introduction: From Sequential to Parallel Workflows

In the previous lesson, you created custom subagents that extend Claude's capabilities with domain-specific expertise. However, all subagent executions have been synchronous - you request a task and wait for completion before continuing.

This works well for quick tasks, but many development tasks take much longer. Asking the docs-quality-reviewer to audit 120 documentation files might take 5-10 minutes, during which you're blocked from asking questions, making code changes, or working on other parts of your project.

Asynchronous subagent execution solves this by allowing subagents to run in the background. When you request a long-running task, Claude immediately returns control while the subagent works independently. This transforms your interaction from a single-threaded assistant into a parallel workflow where multiple specialists work simultaneously.

Async capabilities include:

  • Background execution: Launch tasks and continue other work
  • Progress monitoring: Check task status without blocking
  • Automatic notifications: Receive alerts when tasks complete
  • Parallel execution: Run multiple analyses simultaneously

You might have the docs-quality-reviewer auditing documentation while you implement a plugin. When the audit completes, you receive results and can ask follow-up questions without losing your plugin work context.

Running Subagents in the Background

Claude supports background execution through two complementary approaches:

Natural Language Approach:

Claude interprets your intent and handles backgrounding when appropriate. This is intuitive for interactive work.

Explicit Syntax:

The run_in_background: true parameter guarantees asynchronous execution and returns a task identifier for later reference. This approach provides precision for reproducible pipelines and team workflows.

Both approaches result in the same background behavior. After launching, you can continue other work:

When to use background execution:

  • Background: Long-running, independent tasks not needing immediate attention (comprehensive audits, extensive analyses)
  • Blocking: Quick tasks or when results inform your next immediate action (finding function definitions, interactive feature discussions)

Session and Task Lifecycle:

Background tasks execute within your current Claude session. If you exit Claude while a task is running, the task terminates immediately and cannot be resumed. Completed task results remain in your conversation history and are accessible when you resume the session later (claude --resume).

Monitoring Task Progress

Claude provides multiple ways to check on background tasks:

Conversational Checks:

Claude provides a human-readable summary with progress indicators.

Explicit Status Commands:

The block: false parameter returns immediate status without waiting for completion. Progress indicators vary by task type.

Overview with /tasks:

Use /tasks to see a dashboard of all active and recently completed tasks with elapsed time, resource usage, and progress indicators.

When tasks complete, Claude automatically notifies you with results available.

Retrieving Completed Task Results

Automatic Notifications:

When a background task finishes, Claude notifies you:

Explicit Retrieval:

Omitting block: false returns full results immediately if complete, or waits for completion if still running.

Result Persistence:

Completed task results persist in your conversation history and remain available when you resume the session (claude --resume). You can reference results in follow-up questions:

Claude references the task results context without needing re-explanation.

Executing Multiple Tasks in Parallel

Launch multiple tasks simultaneously for compound time savings:

Or using explicit syntax:

Multiple subagents work independently. Check progress with /tasks, and when all complete, Claude notifies you with results available simultaneously. Generally, 3-5 background tasks work well on most machines without resource contention.

Summary

You've completed the fourth lesson on asynchronous subagent operations. You learned how to transform Claude from a single-threaded assistant into a parallel workflow orchestrator through:

  • Launch: Request tasks conversationally or with explicit syntax (run_in_background: true)
  • Monitor: Check progress naturally or explicitly (TaskOutput(task_id: ..., block: false)) or use /tasks for overview
  • Retrieve: Receive automatic notifications or explicitly request results (TaskOutput(task_id: ...))
  • Parallel execution: Launch multiple tasks simultaneously for time savings

Task lifecycle: Running tasks terminate if you exit Claude and cannot be resumed. Completed task results persist in conversation history and remain available when you resume the session (claude --resume).

These async capabilities enable you to run comprehensive analyses without blocking your workflow. You can launch audits at session start, continue implementing features, and review results when convenient.

The upcoming practice exercises provide hands-on experience with async workflows using the Docusaurus project. You'll use both natural language and explicit syntax to launch background tasks, monitor progress, retrieve results, and run parallel analyses. On CodeSignal, the environment comes pre-configured, letting you focus on workflow patterns.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal