{"slug": "enjambre-a-durable-kernel-for-swarms-of-ai-agents-python-mcp", "title": "Enjambre – a durable kernel for swarms of AI agents (Python, MCP)", "summary": "Enjambre, a new open-source Python kernel for coordinating swarms of AI agents, has been released with a single PyYAML dependency and support for Python 3.10 or newer on Linux, macOS and Windows. The kernel provides a SQLite-backed process registry with heartbeats, expiring leases for GPUs and API quotas, a durable priority queue with idempotency keys and dead-letter states, a DAG scheduler, proof-of-delivery checks on files, directories and URLs, a code-enforced policy gate, a router that weighs measured success, latency, declared cost and energy, and an MCP server for any MCP client. Enjambre was extracted from a real swarm running day and night on a solar-powered workstation and a small cloud server, and its demo runs four scripted agents through a research, draft, review and publish pipeline without a model or API key.", "body_md": "**A small, honest operating system for swarms of AI agents.**\n\n*Enjambre* is Spanish for *swarm*. It takes the agents you already have (Claude Code, Codex, a\nlocal model behind Ollama, a hosted API, your own scripts) and gives them what a team of\nprocesses needs to work together without lying to each other: a kernel, a queue, leases, a\npermission gate, a router and a shared memory you can see.\n\n```\npip install .            # from a clone; one dependency (PyYAML)\nenjambre demo            # open http://127.0.0.1:8765\n```\n\nRuns on Linux, macOS and Windows with Python 3.10 or newer; every change is tested on all three.\n\nThe demo needs no model and no API key. Four scripted agents run a small editorial pipeline: research, draft, review, publish. The critic stumbles once so you can watch a retry. The writer tries to publish without permission and the gate stops it before it runs. The router explains every choice it makes.\n\nSingle agents are easy now. Swarms fail in boring, expensive ways:\n\n- A worker dies holding the GPU, and nobody notices for ten hours.\n- A task is reported as done, and the file it promised does not exist.\n- A nightly job looks offline two thirds of the time because it only runs every 30 minutes.\n- A rule written in the prompt is ignored the one time it matters.\n- A failed step leaves everything downstream waiting forever.\n\nenjambre was extracted from a real swarm that runs day and night on a solar-powered workstation and a small cloud server. Every mechanism below exists because one of those failures happened.\n\n| **Kernel** | One SQLite file. Processes report heartbeats and their state ( *alive* ,*stale* ,*offline* ) is derived from the age of the last one, never declared. | \n| **Leases** | GPUs, API quotas, browsers: every lock expires on its own. A crashed holder cannot block anyone for long. | \n| **Durable queue** | Priorities, atomic claims, idempotency keys, task leases that long jobs renew, automatic retries, a dead-letter state that always records a reason. | \n| **DAG** | Tasks wait for their dependencies, receive upstream results as *data* (never as instructions), and die visibly when something upstream fails. Retrying the upstream task brings them back. | \n| **Proof of delivery** | A task can declare what must exist when it is done, and agents declare artifacts. The kernel checks files, directories and URLs itself, and a file older than the task does not count. Record the verdict, or enforce it. | \n| **Policy gate** | Rules travel with every prompt, and permissions are enforced in code before any agent runs. A broken edit of the policy never replaces the last good one. | \n| **Router** | Picks an agent from measured success and latency, declared cost, and energy. Agents on solar power win while the sun is up. Every decision comes with a readable reason. | \n| **Adapters** | `cli` for any command-line agent (no shell, isolated environment),`openai` for any OpenAI-compatible endpoint,`scripted` for demos and tests. | \n| **MCP server** | Any MCP client can heartbeat, lease, claim, renew and complete tasks, check permissions and query memory. | \n| **Memory graph** | A folder of markdown notes becomes a 3D graph you can explore, search and teach with. Links to notes nobody wrote yet show up in red. | \n| **Dashboard** | Live board, agents, leases, trace and task timelines. No build step, no framework, strict Content Security Policy. | \n\n```\nmy-swarm/\n├── swarm.yaml        agents, router, scheduler, kernel, memory\n├── policy.yaml       rules and permissions (hot-reloaded)\n├── prompts/<id>.md   the role of each agent\n└── memory/           markdown notes, shown as the memory graph\nenjambre init my-swarm     # start from the demo template\nenjambre up my-swarm       # API + dashboard + scheduler\n```\n\nPut the folder in git and every change to your swarm has an author, a date and a revert.\n\n```\nagents:\n  coder:\n    adapter: cli\n    energy: solar            # this machine runs on panels: prefer it while the sun is up\n    options:\n      command: [\"claude\", \"-p\"]\n      env: [ANTHROPIC_API_KEY]   # the only variables the child process can see\n\n  reviewer:\n    adapter: cli\n    options:\n      command: [\"codex\", \"exec\", \"{prompt}\"]\n      stdin: false               # the prompt goes in as an argument (never through a shell)\n      env: [OPENAI_API_KEY]\n\n  local:\n    adapter: openai\n    options:\n      base_url: http://localhost:11434/v1\n      model: qwen3:8b\n\n  researcher:\n    adapter: openai\n    cost: 0.5\n    options:\n      base_url: https://openrouter.ai/api/v1\n      model: deepseek/deepseek-chat\n      api_key_env: OPENROUTER_API_KEY   # the name of the variable, never the key\n\nrouter:\n  weights: {success: 35, latency: 15, cost: 20, energy: 30}\n  solar_window: {start: \"09:30\", end: \"17:30\", timezone: Europe/Madrid}\n```\n\nOn Windows, CLIs installed with npm are `.cmd` launchers. enjambre finds them, but only\npasses them the prompt through stdin (`stdin: true`, the default): `cmd.exe` would re-parse a\nprompt given as an argument.\n\nAgents answer with a small JSON contract (`status`, `result`, `artifacts`...). The scheduler\nappends it to every prompt, together with the agent's role, the policy and the results of\nupstream tasks.\n\n```\n# policy.yaml\nrules:\n  - id: verify\n    rule: Never report work as done without a check that passed.\noperations:\n  publish: [editor]          # only the editor may run tasks with operation: publish\nagents:\n  writer:\n    forbidden: [Publishing anything yourself.]\n    vetoed_operations: [publish]\n# Claude Code\nclaude mcp add enjambre -- enjambre mcp --dir ./my-swarm\n\n# a remote swarm started with `ENJAMBRE_TOKEN=... enjambre up --host 0.0.0.0`\nclaude mcp add enjambre -e ENJAMBRE_TOKEN=... -- enjambre mcp --url http://swarm-host:8765\n# Codex (~/.codex/config.toml)\n[mcp_servers.enjambre]\ncommand = \"enjambre\"\nargs = [\"mcp\", \"--dir\", \"/path/to/my-swarm\"]\n```\n\nTools: `swarm_status`, `heartbeat`, `acquire_resource`, `release_resource`, `enqueue_task`,\n`claim_task`, `renew_task`, `complete_task`, `get_task`, `list_tasks`, `cancel_task`,\n`retry_task`, `policy_for`, `check_permission`, `memory_query`, `memory_node`.\n\n``` python\nfrom enjambre import AgentResult, Kernel\n\nk = Kernel(\"swarm.db\")\nresearch = k.enqueue(\"Collect benchmark numbers\", agent=\"scout\")[\"id\"]\nchart = k.enqueue(\"Draw the chart\", depends_on=[research], proof=\"/tmp/chart.png\")[\"id\"]\n\ntask = k.claim(\"scout\")                                   # atomic\nk.complete(task[\"id\"], \"scout\", AgentResult.completed(\"numbers collected\"))\nk.claim(\"plotter\")[\"id\"] == chart                         # unblocked\nenjambre demo | init DIR | up [DIR] | run [DIR] | mcp\nenjambre enqueue \"Title\" --agent writer --after TASK_ID --proof /abs/path\nenjambre tasks | ps | memory \"query\"\n```\n\n`enjambre run` processes the queue until it is idle and exits, which makes a swarm usable\nfrom CI.\n\nenjambre is not an agent framework and not a prompt library. Frameworks such as LangGraph or CrewAI compose model calls inside one program. enjambre sits one level below: it coordinates separate agents and processes, on one machine or several, that already know how to do their job. You can run agents built with any framework inside it.\n\n- **Honest state.** Liveness is derived, fitness is measured, and a missing measurement is`None` , never a decorative zero.\n- **Leases everywhere.** Locks, running tasks and resources all expire. Recovery is the\ndefault, not a cleanup script.\n- **Verification is recorded before it is enforced.** A verification gate that blocked closing\ntasks once cut a swarm's throughput by 90%. Start with`proof_mode: record` , switch to`enforce` when your agents declare their artifacts.\n- **Data is not instructions.** Upstream results are labelled as data in every prompt.\n- **Small on purpose.** Standard library plus PyYAML. One SQLite file. No build step for the UI.\n\nDetails in [docs/architecture.md](https://github.com/santibccc-sudo/enjambre-os/blob/main/docs/architecture.md).\n\nThe API binds to `127.0.0.1` by default and refuses other addresses without `ENJAMBRE_TOKEN`.\nCLI agents run without a shell and see only the environment variables you list. API keys are\nread from environment variables and rejected if written into `swarm.yaml`. See\n[SECURITY.md](https://github.com/santibccc-sudo/enjambre-os/blob/main/SECURITY.md).\n\n- **Evolution loop** : the swarm proposes changes to its own genome from measured fitness, a\nhuman approves, and a regression triggers an automatic revert.\n- **Versioned memory segments** with atomic writes and rollback per agent.\n- Rate-limit buckets per provider, OpenTelemetry export, a Postgres backend for larger swarms.\n\nMIT. Made by GreenAI Network. Bundled third-party code is listed in\n[THIRD_PARTY_NOTICES.md](https://github.com/santibccc-sudo/enjambre-os/blob/main/THIRD_PARTY_NOTICES.md).", "url": "https://wpnews.pro/news/enjambre-a-durable-kernel-for-swarms-of-ai-agents-python-mcp", "canonical_source": "https://github.com/santibccc-sudo/enjambre-os", "published_at": "2026-09-20 08:55:30+00:00", "updated_at": "2026-09-20 09:23:01.180619+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-infrastructure", "developer-tools", "ai-tools"], "entities": ["Enjambre", "Claude Code", "Codex", "Ollama", "PyYAML", "SQLite", "MCP"], "alternates": {"html": "https://wpnews.pro/news/enjambre-a-durable-kernel-for-swarms-of-ai-agents-python-mcp", "markdown": "https://wpnews.pro/news/enjambre-a-durable-kernel-for-swarms-of-ai-agents-python-mcp.md", "text": "https://wpnews.pro/news/enjambre-a-durable-kernel-for-swarms-of-ai-agents-python-mcp.txt", "jsonld": "https://wpnews.pro/news/enjambre-a-durable-kernel-for-swarms-of-ai-agents-python-mcp.jsonld"}}