codex-parallel-subagents

Run multiple AI agent threads in parallel with bounded concurrency. Use for parallel file processing, multi-package updates, batch codebase operations, or fan-out tasks. Uses the MoonBit Codex SDK for agent orchestration.

$ Installieren

git clone https://github.com/moonbit-community/codex-sdk /tmp/codex-sdk && cp -r /tmp/codex-sdk/skills/codex-parallel-subagents ~/.claude/skills/codex-sdk

// tip: Run this command in your terminal to install the skill


name: codex-parallel-subagents description: Run multiple AI agent threads in parallel with bounded concurrency. Use for parallel file processing, multi-package updates, batch codebase operations, or fan-out tasks. Uses the MoonBit Codex SDK for agent orchestration.

Codex Parallel Subagents

Run multiple AI agent threads concurrently with bounded parallelism and collect results safely.

When to use this skill

  • Running multiple agent tasks in parallel
  • Fan-out work across files, packages, or repositories
  • Batch processing with rate limiting
  • Streaming progress from concurrent tasks
  • Collecting structured outputs from multiple agents

Quick navigation

NeedResource
New to Codex SDKreferences/codex-basics.md
Advanced optionsreferences/codex-advanced.md
Async patternsreferences/async-basics.md
Troubleshootingreferences/troubleshooting.md

Production-ready assets

Copy these to jumpstart your implementation:

AssetDescriptionRun
parallel_batchReentrant batch processing with stdin/file input, offset/limit, JSON outputmoon run -C assets/parallel_batch assets/parallel_batch
package_analyzerDiscover and summarize all MoonBit packagesmoon run -C assets/package_analyzer assets/package_analyzer

How to use these assets

  1. Copy the asset directory to your project
  2. Customize run_task() (or the main processing function) for your use case
  3. Adjust structs (TaskInput, etc.) if you need additional fields
  4. Set environment variables as needed (CODEX_WORKDIR, PARALLELISM)

See each asset's README for detailed usage and options.

Key rules

  1. One thread per task - never share threads across concurrent tasks
  2. Use semaphores - guard parallel runs with @async.Semaphore::new(n) to avoid rate limits
  3. Set working directory - use ThreadOptions::new(working_directory=...) for task isolation
  4. Allow failures - use allow_failure=true and capture errors per task
  5. Avoid conflicts - for tasks that modify shared resources (e.g., building software, editing same files), use git worktrees or separate directories to isolate each agent