# How Parallel Sub-Agents Generate Multiple Animations Simultaneously in Video-Use

> Learn how parallel sub-agents in browser-use/video-use generate multiple animations simultaneously. Discover how independent processes and isolated directories reduce rendering time to the slowest animation.

- Repository: [Browser Use/video-use](https://github.com/browser-use/video-use)
- Tags: deep-dive
- Published: 2026-07-03

---

**Parallel sub-agents generate multiple animations simultaneously by spawning independent processes for each animation slot, with each sub-agent receiving a self-contained brief and writing output to isolated directories, reducing total wall-time to the duration of the slowest render.**

The browser-use/video-use repository implements a skill-based animation pipeline designed for concurrent execution. When projects require multiple motion graphics or kinetic typography elements, the system leverages parallel sub-agents to generate multiple animations simultaneously, ensuring that processing time scales with the slowest render rather than the sum of all renders.

## Why Parallelism is Mandatory

According to [`SKILL.md`](https://github.com/browser-use/video-use/blob/main/SKILL.md) §10, the workflow explicitly mandates parallel execution for multiple animations. The hard rule states: "Parallel sub-agents for multiple animations. Never sequential. Spawn N at once via the `Agent` tool; total wall time ≈ slowest one."

This architectural constraint prevents the linear bottleneck that would occur if animations rendered one after another. By spawning all sub-agents concurrently, the system bounds the total wall-clock time to the duration of the slowest individual animation, regardless of how many slots are active.

## The Slot-Based Isolation Architecture

Each parallel sub-agent operates within a dedicated workspace. For every animation, the system creates a unique directory at `<edit>/animations/slot_<id>/`, as documented in [`SKILL.md`](https://github.com/browser-use/video-use/blob/main/SKILL.md) §81. This directory houses the source files, render scripts, and final video output—typically `render.mp4`—for that specific sub-agent.

This slot-based isolation prevents filesystem race conditions. Because each parallel process writes exclusively to its own slot folder, multiple sub-agents can encode video simultaneously without risking filename collisions or resource contention.

## Orchestrating Concurrent Sub-Agents with the Agent Tool

The top-level `Agent` tool serves as the orchestration layer. When invoked with multiple briefs, it launches sub-agents concurrently using background processes or asynchronous calls, enabling the system to generate multiple animations simultaneously across available CPU cores or distributed workers.

### Self-Contained Briefs Eliminate Blocking

Every sub-agent receives a complete brief that includes the goal, output path, technical specifications, style palette, and frame-by-frame timeline. According to [`SKILL.md`](https://github.com/browser-use/video-use/blob/main/SKILL.md) §249-260, these briefs follow a strict "do not ask questions" rule, ensuring deterministic execution without blocking for user input or inter-agent communication.

Because each brief explicitly defines the output path within its assigned slot directory, sub-agents execute as embarrassingly parallel tasks. They require no shared state, no message passing, and no synchronization during the rendering phase.

### Concurrent Execution Model

The `Agent` tool accepts a list of brief paths and spawns a separate process for each one. For example, when generating two animations simultaneously, the tool creates distinct sub-agent instances that execute the following workflow:

1. Parse the brief and load technical requirements (resolution, codec, frame rate)
2. Generate animation frames according to the specified timeline
3. Encode the final video to `edit/animations/slot_<id>/render.mp4`
4. Terminate without waiting for sibling processes

The parent process monitors completion across all slots, proceeding to integration only after every sub-agent finishes its isolated render task.

## Integrating Parallel Outputs into the Final Timeline

Once all sub-agents complete, the system aggregates results through the Edit Decision List ([`edl.json`](https://github.com/browser-use/video-use/blob/main/edl.json)). The [`helpers/render.py`](https://github.com/browser-use/video-use/blob/main/helpers/render.py) script reads the `overlays` section of this JSON file to composite each animation clip at the appropriate timestamp.

As specified in [`SKILL.md`](https://github.com/browser-use/video-use/blob/main/SKILL.md) Rule 4, the integration applies the PTS-shift rule: `setpts=PTS-STARTPTS+T/TB`. This FFmpeg filter aligns each overlay with the output timeline, ensuring that animations rendered in parallel slots appear at their designated `start_in_output` times regardless of when each sub-agent actually finished processing.

The `overlays` array in [`edl.json`](https://github.com/browser-use/video-use/blob/main/edl.json) references each slot's `render.mp4` file, allowing the final compositor to treat parallel outputs as sequential layers in the master timeline.

## Practical Implementation Example

To implement parallel sub-agents for multiple animations, first create the isolated slot directories and write self-contained briefs for each animation:

```bash

# Create slot directories

mkdir -p edit/animations/slot_1 edit/animations/slot_2

# Write brief for first animation slot

cat > edit/animations/slot_1/brief.txt <<'EOF'
You are building ONE animation: a kinetic‑typography title.
Output path: edit/animations/slot_1/render.mp4
Resolution: 1920x1080, 30 fps, codec=h264, crf=23
Palette: bg=#0a0a0a, accent=#ff5a00
Timeline: 0‑0.5s fade‑in, 0.5‑3s typewriter reveal, 3‑3.5s fade‑out
EOF

# Write brief for second animation slot

cat > edit/animations/slot_2/brief.txt <<'EOF'
You are building ONE animation: a product UI mockup walkthrough.
Output path: edit/animations/slot_2/render.mp4
Resolution: 1920x1080, 30 fps, codec=vp9, pix_fmt=yuva420p
Palette: bg=#ffffff, accent=#0066ff
Timeline: 0‑1s slide‑in, 1‑4s hover‑highlight, 4‑5s slide‑out
EOF

```

Next, invoke the `Agent` tool with multiple brief arguments to spawn parallel sub-agents:

```bash
Agent \
  --brief edit/animations/slot_1/brief.txt \
  --brief edit/animations/slot_2/brief.txt \
  --output-dir edit/animations

```

The `Agent` tool launches both sub-agents simultaneously. Each process writes its result to its designated slot folder without blocking the other.

Finally, construct the [`edl.json`](https://github.com/browser-use/video-use/blob/main/edl.json) to reference the parallel outputs:

```json
{
  "version": 1,
  "sources": {},
  "ranges": [],
  "grade": "warm_cinematic",
  "overlays": [
    {"file": "edit/animations/slot_1/render.mp4", "start_in_output": 0.0, "duration": 3.5},
    {"file": "edit/animations/slot_2/render.mp4", "start_in_output": 10.0, "duration": 5.0}
  ],
  "subtitles": "edit/master.srt",
  "total_duration_s": 87.4
}

```

[`helpers/render.py`](https://github.com/browser-use/video-use/blob/main/helpers/render.py) processes this EDL, applying the PTS-shift calculation to align each parallel-rendered animation at its specified timestamp in the final output.

## Summary

- **Parallel execution is mandatory**: The [`SKILL.md`](https://github.com/browser-use/video-use/blob/main/SKILL.md) explicitly forbids sequential processing, requiring all animation sub-agents to spawn simultaneously via the `Agent` tool.
- **Slot isolation prevents conflicts**: Each sub-agent writes to a dedicated `edit/animations/slot_<id>/` directory, eliminating race conditions during parallel execution.
- **Self-contained briefs enable autonomy**: Sub-agents receive complete specifications including output paths and technical parameters, allowing them to run without inter-process communication.
- **Wall-time equals the slowest render**: Parallel sub-agents generate multiple animations simultaneously, bounding total processing time to the duration of the slowest individual animation.
- **PTS shifting synchronizes outputs**: The [`helpers/render.py`](https://github.com/browser-use/video-use/blob/main/helpers/render.py) script uses FFmpeg's `setpts` filter to align parallel-rendered clips with the master timeline defined in [`edl.json`](https://github.com/browser-use/video-use/blob/main/edl.json).

## Frequently Asked Questions

### What is the maximum number of parallel sub-agents supported?

The system architecture supports as many parallel sub-agents as the underlying infrastructure allows. Since each sub-agent operates within an isolated slot directory and receives a self-contained brief, the limitation depends on available CPU cores, memory, and the `Agent` tool's concurrency configuration rather than hardcoded limits in the video-use repository.

### How does the system prevent filename collisions between parallel renders?

Each sub-agent must write output to a unique path specified in its brief, specifically within `edit/animations/slot_<id>/render.mp4`. Because the slot ID is unique per animation and the brief explicitly defines the output location, parallel processes never attempt to write to the same filesystem location, preventing collisions without requiring file locking mechanisms.

### What happens if one sub-agent fails while others succeed?

The brief format includes a strict "do not ask questions" rule, designed to make sub-agents deterministic and self-healing where possible. However, if a sub-agent fails completely, the slot directory will lack a valid `render.mp4`. When [`helpers/render.py`](https://github.com/browser-use/video-use/blob/main/helpers/render.py) processes the EDL, it expects all referenced overlay files to exist; missing animations would typically cause the final render to fail or skip that overlay depending on the error handling implemented in the rendering pipeline.

### How does PTS shifting work for animation alignment?

The PTS (Presentation Timestamp) shift uses the FFmpeg expression `setpts=PTS-STARTPTS+T/TB` to reset each animation's timeline to zero and then offset it by the `start_in_output` value specified in the EDL. This allows animations rendered independently in parallel slots to be precisely positioned in the final composite timeline, ensuring that a slot rendered at wall-clock time 0:05:00 can appear at output time 0:00:10 without temporal drift.