Skip to main content

legio

A queue-based agentic orchestration engine. Independent library, domain-free: all domain knowledge lives in patterns (YAML as data) and a tool registry provided by the consumer. The library never knows about any specific consumer; validation happens through the in-repo examples (examples/) and external consumer repositories kept separate (AGENTS.md rule 7).

Quick start

uv run legio server --config examples/transform/legio.yaml --host 127.0.0.1 --port 8000

Then submit and poll status (see docs/CONSUMER_GUIDE.md for the full walkthrough; the headless transform example boots with no LLM needed and runs from the repo root).

Docs surface

  • docs/CONSUMER_GUIDE.md — executable walkthrough: register a tool → write a pattern → configure → boot → submit → status (validated by CI).
  • docs/GLOSSARY.md — canonical definitions for the identifiers and architecture terms.
  • docs/ARCHITECTURE.md — the architecture (read before any work).
  • docs/AGENT_LIFECYCLE.md — the class/instance lifecycle (§4.8) and the three schemas (§4.11).
  • docs/CONTRIBUTING.md — methodology, development flow, review checklist.
  • docs/PLAN.md — the plan and issue roadmap; docs/CONTRACTS/ holds the per-issue approved specs.
  • docs/DEPENDENCIES.md — the approved dependency list.
  • docs/JOURNALS/ — turn-by-turn journaling; read the latest before working.

Examples

examples/ ships five self-contained, domain-free example nodes — each with its own patterns/ (Schema 1 YAML), tools.yaml (Schema 3), node-local tools.py and legio.yaml (LEG-017): transform, summarize, extract-and-summarize, distribute-summary and document_processing. Each node is copy-and-adapt: its relative paths resolve against its own legio.yaml and its tools resolve beside it, so the quick-start command runs from the repo root unchanged. The same files are exercised by the test suite — drift breaks the build (LEG-100, no bitrot; LEG-104 boots the shipped config as a subprocess).

Engine in one breath

The public API never pushes (polling only, next_run_at scheduling): the host drives runtime.manager.run() one pass per dispatch; each standing agent polls its own beaver queue; the immutable Schema 2 FlowToken (schema_version, level_route, current_index, end_of_level_queue, level, launcher_class, task_id, branch_id, root) travels the routes (payload and message_type live on the ExecutionRequest/ExecutionResult messages, not on the token); the final result lands on the agent's shared final-result queue and is collected into the task's outbox record that /status reads. Errors are typed (legio.errors) and never silent (rule 9); every module logs structured key=value events under the legio.* tree (rule 11).

Core capabilities (current)

  • Schemas: S1 one-spec-per-pattern YAML with mandatory symmetric contracts; S2 the route token; S3 available_tools (implementation + policy).
  • Standing agents: atomic tool and linguistic agents materialized at boot, and unified composite agents whose branches reference other agents by name (the built-in composite build merges the branch payloads under the composite's output_as; a non-merge composition overrides the seam).
  • Dynamic lifecycle: class/instance verbs (create/enable/disable/destroy), pools as capacity intent, bring-up leaves-first over the served catalog.
  • Runtime surface: REST submit/status plus class/instance verb classes over beaver queues with a client token store; legio server and legio agent <verb> CLI.
  • Federation: per-node catalogs, roster-based step routing over a beaver routing proxy, an inbound peer allowlist (federation.allowlist, 403 for an unknown peer) — peers never widen scope (rule 9).

State

R-0..R-9 core is shipped on the three-schema, decoupled polling engine (exact per-issue status lives in docs/CONTRACTS/ and docs/JOURNALS/). R-10 (Hardening & release) is the current track: the LEG-103 audit-hardening series (contract-first slices, all green) and this session's LEG-100 docs & examples hardening (consumer guide + glossary + example tree) await maintainer review; LEG-101 (semver, packaging, changelog, tags) and LEG-102 come next on the release track.

Development

make ci mirrors the CI gate exactly: lint (ruff check) + format check (ruff format --check) + typecheck (pyright) + full pytest, all green. Convenience targets: make sync, make lint, make format, make format-check, make typecheck, make test, make build (wheel/archive), make validate-release (release-artifact smoke), make clean, make tag/make release (maintainer only; release runs release-guard first). Everything in this repo is English (AGENTS.md rule 1); work is per-issue, contract-first, and every turn ends with a journal commit.

Developed By

Legio is a collaborative open-source project co-developed by:

  • GIA-UH — Grupo de Inteligencia Artificial, Universidad de La Habana
  • Syalia S.R.L.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for legio 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for legio 0.1.6
File Size Uploaded
legio-0.1.6.tar.gz 111.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for legio 0.1.6
File Interpreter ABI Platform
legio-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 242.1 kB

Release files / legio-0.1.6.tar.gz

Download URL legio-0.1.6.tar.gz
Size 111.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7ec99286fbf60b4be4ecf7dd56f1c9fdcad960826ead0f5798fdae79fd1a630c
BLAKE2b-256 checksum
How to use checksums
ce1dacc19fe8ac1ad243ed7b5616c3732f6e5e18047a7b41825ba3296609b3ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.10","id":"oracular","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / legio-0.1.6-py3-none-any.whl

Download URL legio-0.1.6-py3-none-any.whl
Size 130.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d63e2e00d8adfa4b6b3ea47689ac00ef2c1577afcb9782c59b91ac7b809f1f1f
BLAKE2b-256 checksum
How to use checksums
6cf9eb7dec5bf151567518f12d80934863e8908845afe41696ad8d4dcdc77590
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.10","id":"oracular","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.1.7

2 release files

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page