← Back to Leaderboard
Lhuggingface

huggingface/legion

Harbor-based orchestration for coding agents in separate containers

View on GitHub ↗
AI FrameworkQuickstart ↓
Engineering Health (Methodology)
B+ · 64/100
Maintenance Activity
● Updated today
Latest Release
Rolling commits (main)
Commercial License Check
Custom / Check Repo

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption12/25
Release Cadence11/20
License Clarity6/20
DockerSelf-HostedCLI
Total Stars
★ 125
24h Growth
+4
7d Growth
+24
Forks
12

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

huggingface/legion Star History (2026-10-13 - 2026-12-04) DAILY STAR HISTORY (38-DAY D1 TELEMETRY) +124 in 52d · avg +2/day 132 66 0 2026-10-13: ★ 12026-10-17: ★ 22026-10-24: ★ 22026-10-31: ★ 32026-11-04: ★ 32026-11-08: ★ 32026-11-12: ★ 32026-11-16: ★ 32026-11-20: ★ 32026-11-24: ★ 42026-11-28: ★ 1052026-12-02: ★ 1172026-12-04: ★ 125 ★ 125 10-13 11-08 12-04

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

Legion adds team orchestration around Harbor: each agent runs as a Trial in its own container, while Legion launches agents, maintains their sessions, and reports progress and model usage. Specs define the task, model endpoint, team size, and role instructions. The mini-swarm configuration demonstrates that the controller and worker can run locally while agent execution and the message board run on separate hosted services.

The Python 3.12+ stack declares Typer, Pydantic, PyYAML, FastAPI, and Uvicorn, and pins harbor[e2b] to 0.25.0 and msgboard[hf] to a Git commit. The extension point is a Python module exposing a TOOLS mapping. Legion packages the selected functions for agents and describes them in their instructions; a tool list in the spec replaces the default board tools rather than extending them.

Key Capabilities & Differentiators

Teams can share instructions through team_file or specialize through agents.roles; supported coding harnesses are Pi, Codex, and Claude Code. A spec loop can send prompts automatically, or an operator can target a role with legion prompt --swarm my-team --type agent. Model calls can use Hugging Face Inference Providers or an OpenAI-compatible endpoint you operate.

The message board lets agents exchange findings without sharing a task container. The four-agent escape-room example uses separate task copies with one board; ProgramBench adds a shared Hugging Face repository for exchanging code. Tasks can be selected from a Hugging Face dataset at a pinned revision. For local runs, legion status shows state and usage, and the run bundle under .legion/ supports later inspection of outcomes and rewards from Python.

Trade-offs & Limitations

Use Harbor directly for independent trials, or run Pi, Codex, or Claude Code directly for a single interactive coding session. Legion earns its extra operational layer when separate agents need coordinated roles, shared findings, and team-level run visibility. Containers separate task environments, but shared boards and repositories still need access controls, and the inference credential enters every agent container.

For hosted runs, scope inference separately from infrastructure permissions and include both sandbox and inference charges in cost estimates. Stopping a mini-swarm run does not delete its board Space; clean up only a Space created for that run, after its workers stop. CLI, spec, and API changes can break integrations without deprecation, so pin a Legion commit and test upgrades against representative specs. Licensing is unspecified and should be resolved before commercial adoption.

Hardware & Deployment Guide

Install with Python 3.12+, Git, and uv, then use uv sync and uv run legion. Rootless Podman is the default task-container backend; Docker with Compose is supported for local runs only. Hugging Face Jobs and Slurm are execution options, and the root contains Dockerfile.controller and Dockerfile.worker. The mini-swarm path needs neither local container engine: its controller and worker run locally, agents run in paid HF Sandboxes, and the board runs on a Space.

The local Docker quickstart requires no Jobs or Space permissions, but private Hub tasks still require Hub read access and model calls require a reachable inference endpoint. Self-hosting does not by itself establish a fully offline deployment. Size task compute for the chosen images and concurrent agents, and size model serving separately if you host it. The manifest version is 0.0.1, no latest release is listed, and docs/migrations.md maps the former Flock names and breaking spec changes.

Execution unit: Each agent runs in its own container as a Harbor Trial; the manifest pins harbor[e2b]==0.25.0.
Role configuration: team_file supplies shared instructions, while agents.roles defines distinct roles using Pi, Codex, or Claude Code.
Task versioning: task.repo, task.revision, and task.selector locate and pin a Harbor task independently of Legion code.
Tool selection: Spec entries such as message_board.* and calculator.add select Python tools; an explicit list replaces the defaults.
Observability: legion status reports agent state and model usage; local runs persist logs and a run bundle under .legion/.
Credential isolation: The HF Sandbox configuration rejects HF_TOKEN as the inference key; agents receive a separately scoped inference credential.
Best For

Engineering and research teams running collaborative Harbor tasks that need per-agent environments, configurable roles, shared findings, and run-level usage tracking.

Skip If

You need only one coding session or independent trials, or require stable interfaces, confirmed commercial licensing, or a verified fully offline deployment.

Reviewed on 2026-12-01 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

DockerSelf-HostedCLI
git clone https://github.com/huggingface/legion
cd legion
uv sync

Comparison vs. Top Agents & Frameworks Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
legion ★125+24Python—Harbor-based orchestration for coding agents in separate containers
browser-use122.7k+477PythonMITPython REPL and CDP for adaptive browser automation
langchain150.4k+299PythonMITModular Python framework for building agents across model providers
agentscope37.2k+342PythonApache-2.0Python ReAct SDK and FastAPI service for observable, interruptible agent workflo

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/huggingface/legion.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

huggingface/legion Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about legion

How do I integrate an existing Harbor task without changing Legion?

Point task.repo at a Hugging Face dataset containing a self-contained Harbor task, pin task.revision to a published commit, and select the task with task.selector. You do not need to modify Legion. If you explicitly list Python tools in the spec, include message_board.* to retain the board tools.

Does the Legion host need a GPU, and how should I size it?

When inference runs remotely, size the Legion host for the controller and worker plus any task containers running there. Start with the CPU, RAM, and disk needs of a single task, then measure at your intended agent count. If you also host the model, size GPU memory separately for that model and its inference concurrency. No fixed RAM or VRAM baseline is specified.

Does self-hosting make Legion suitable for commercial use?

The repository license is unspecified. Self-hosting is technically supported, but that does not establish commercial use, modification, or redistribution rights. Confirm Legion's license with the maintainers before commercial adoption, and review dependency licenses and any terms for hosted services you use.

When should I use Legion instead of Harbor directly or a standalone coding harness?

Use Harbor directly when you mainly need independent trials. Choose Legion when agents need separate task environments but must exchange findings, run under distinct roles, and be monitored as one team. For a single coding session, running the chosen harness directly avoids the extra orchestration layer.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining huggingface/legion? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature huggingface/legion on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare