codex-parallel-subagents
Use when building MoonBit tools on this repo's Codex SDK that spawn multiple agent threads in parallel or in batch, including bounded concurrency, per-task threads, streaming events, and collecting session IDs or structured outputs.
When & Why to Use This Skill
The Codex Parallel Subagents skill is a specialized developer tool designed for the Codex SDK to manage and orchestrate multiple AI agent threads concurrently. It solves the complexity of scaling agentic workflows by providing bounded parallelism, ensuring that high-volume tasks—such as repository-wide analysis or batch data processing—are executed efficiently without hitting rate limits. By utilizing semaphores and isolated working directories, it enables safe, multi-threaded agent execution and structured output collection, making it essential for building high-performance, autonomous AI systems in MoonBit.
Use Cases
- Batch Processing: Execute large-scale AI tasks across multiple files or datasets simultaneously while maintaining strict concurrency limits to avoid API rate-limiting.
- Repository-Wide Analysis: Automatically discover, analyze, and summarize all packages within a software repository by fanning out specialized agent threads.
- Concurrent Data Extraction: Scale the extraction of structured information from diverse sources using isolated threads to ensure task independence and data integrity.
- Real-time Progress Monitoring: Implement streaming events from multiple parallel agents to provide live status updates for complex, long-running background workflows.
| name | codex-parallel-subagents |
|---|---|
| description | "[DEPRECATED] Run multiple AI agent threads in parallel with bounded concurrency. Use evolving-workflow instead." |
Codex Parallel Subagents
DEPRECATED: This skill is deprecated. Use evolving-workflow instead, which provides a declarative workflow API with built-in parallel execution support via
.concurrency(n).
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
| Need | Resource |
|---|---|
| New to Codex SDK | references/codex-basics.md |
| Advanced options | references/codex-advanced.md |
| Async patterns | references/async-basics.md |
| Troubleshooting | references/troubleshooting.md |
Production-ready assets
Copy these to jumpstart your implementation:
| Asset | Description | Run |
|---|---|---|
| parallel_batch | Reentrant batch processing with stdin/file input, offset/limit, JSON output | moon run -C assets/parallel_batch assets/parallel_batch |
| package_analyzer | Discover and summarize all MoonBit packages | moon run -C assets/package_analyzer assets/package_analyzer |
How to use these assets
- Copy the asset directory to your project
- Customize
run_task()(or the main processing function) for your use case - Adjust structs (
TaskInput, etc.) if you need additional fields - Set environment variables as needed (
CODEX_WORKDIR,PARALLELISM)
See each asset's README for detailed usage and options.
Key rules
- One thread per task - never share threads across concurrent tasks
- Use semaphores - guard parallel runs with
@async.Semaphore::new(n)to avoid rate limits - Set working directory - use
ThreadOptions::new(working_directory=...)for task isolation - Allow failures - use
allow_failure=trueand capture errors per task - 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