Skip to main content

Config-driven worker spawning for multi-agent systems. tmux + nohup backends, signal handling, health checks.

Project description

cervellaswarm-spawn-workers

Config-driven worker spawning for multi-agent systems.

Part of CervellaSwarm - Build AI agent teams that remember.

Features

  • Auto-detect backend: tmux (preferred) or nohup (universal fallback)
  • Config-driven: Spawn teams from team.yaml files
  • Signal handling: Graceful shutdown on SIGINT/SIGTERM
  • Health checks: Monitor worker status, uptime, and liveness
  • File-based state: .ready / .working / .done task markers
  • Cross-platform: Works on macOS and Linux

Quick Start

pip install cervellaswarm-spawn-workers
# Spawn a single worker
cervella-spawn --worker backend --specialty backend

# Spawn a team from config
cervella-spawn --team team.yaml

# Check worker status
cervella-spawn --status

# Kill all workers
cervella-spawn --kill

# List available specialties
cervella-spawn --list

How It Works

team.yaml ──→ TeamLoader ──→ SpawnManager ──→ Backend (tmux/nohup)
                                   │
                              PromptBuilder
                                   │
                          claude -p --append-system-prompt
  1. TeamLoader reads your team.yaml and extracts agent configurations
  2. PromptBuilder generates English system prompts with specialty focus
  3. SpawnManager launches workers via the detected backend
  4. Workers check tasks_dir/ for .ready files, claim with .working, finish with .done

team.yaml Format

name: my-project
version: "1.0.0"
process: hierarchical

agents:
  - name: backend
    type: worker
    specialty: backend
    model: sonnet

  - name: tester
    type: worker
    specialty: tester
    model: sonnet

spawn:
  max_workers: 5
  tasks_dir: .swarm/tasks
  logs_dir: .swarm/logs
  backend: tmux  # or "nohup", omit for auto-detect

CLI Reference

cervella-spawn [OPTIONS]

Options:
  --team PATH          Spawn workers from team.yaml config
  --worker NAME        Spawn a single worker by name
  --status             Show worker status (alive/dead/uptime)
  --kill               Kill all workers gracefully
  --list               List available worker specialties
  --specialty TYPE     Worker specialty (default: generic)
  --prompt TEXT        Custom system prompt for the worker
  --tasks-dir DIR      Tasks directory (default: .swarm/tasks)
  --logs-dir DIR       Logs directory (default: .swarm/logs)
  --max-workers N      Max concurrent workers (default: 5)
  --backend TYPE       Force backend: tmux or nohup
  --claude-bin PATH    Path to claude CLI binary
  --version            Show version

Available Specialties

Specialty Focus Area
backend Python, FastAPI, databases, API design
frontend React, CSS, Tailwind, UI/UX, accessibility
tester Testing, debugging, QA, validation
docs Documentation, README, guides, tutorials
devops Deployment, CI/CD, Docker, infrastructure
data SQL, analytics, database design, ETL
security Security audits, vulnerability assessment
researcher Technical research, analysis, reports
reviewer Code review, best practices, architecture
generic General-purpose tasks across all domains

Python API

from cervellaswarm_spawn_workers import SpawnManager, load_team

# Spawn from team config
team = load_team(Path("team.yaml"))
manager = SpawnManager(max_workers=5)
result = manager.spawn_team(team)
print(f"Spawned: {result.spawned}, Failed: {result.failed}")

# Spawn a single worker
worker = manager.spawn_worker(
    name="backend",
    specialty="backend",
)

# Check status
for status in manager.get_status():
    print(f"{status.name}: {'ALIVE' if status.alive else 'DEAD'}")

# Cleanup
manager.kill_all()

How It Compares

Feature CervellaSwarm CrewAI AutoGen LangGraph
Config-driven spawn team.yaml agents.yaml No No
Subprocess isolation tmux/nohup threads threads in-process
Backend auto-detect Yes N/A N/A N/A
Signal handling SIGINT/SIGTERM No No No
File-based state .ready/.working/.done No No No
Worker health check CLI --status No max_turns No
Cross-platform macOS + Linux Yes Yes Yes
Dependencies 1 (pyyaml) 20+ 15+ 10+

Honest note: CrewAI and AutoGen excel at in-process agent orchestration with rich LLM routing. CervellaSwarm targets a different niche: subprocess-isolated workers with file-based coordination, ideal for long-running tasks where process isolation and crash recovery matter.

Architecture

The package has 4 core modules:

  • backend - Execution backends (tmux/nohup) with auto-detection
  • team_loader - YAML config parser compatible with agent-templates
  • spawner - SpawnManager lifecycle (spawn, monitor, kill, cleanup)
  • prompt_builder - English system prompt generation with specialties

Development

git clone https://github.com/rafapra3008/cervellaswarm.git
cd cervellaswarm/packages/spawn-workers
pip install -e ".[test]"
pytest

License

Apache-2.0 - See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cervellaswarm_spawn_workers-0.1.0.tar.gz (32.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cervellaswarm_spawn_workers-0.1.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file cervellaswarm_spawn_workers-0.1.0.tar.gz.

File metadata

File hashes

Hashes for cervellaswarm_spawn_workers-0.1.0.tar.gz
Algorithm Hash digest
SHA256 23703ab933cd3525531b16ffb358d7d87a7c83dedb2b6d07375f97d9423eb3f4
MD5 47e10ab0f2dfae3e7207fcf619bb3167
BLAKE2b-256 e365e0e0dfea03fa63ce07e75048f40478b450c3ba152428008cda6351304b6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for cervellaswarm_spawn_workers-0.1.0.tar.gz:

Publisher: publish-spawn-workers.yml on rafapra3008/cervellaswarm-internal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cervellaswarm_spawn_workers-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cervellaswarm_spawn_workers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 889c2815cf2f0693252ca44d11b223297ed8dfa6e99c1ab7cd2b0f6971c1d5a3
MD5 9d53c7ef5db44bc47724e0e5d49ab2fe
BLAKE2b-256 fa8ba691fe04177eab7838208fd056cd6a3a5be3285ace5ece7a08899f2d76cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for cervellaswarm_spawn_workers-0.1.0-py3-none-any.whl:

Publisher: publish-spawn-workers.yml on rafapra3008/cervellaswarm-internal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page