swarm.at
Settlement protocol for AI agent workflows. Every agent action commits to a hash-chained, tamper-evident ledger backed by git.
Install
pip install swarm-at-sdk
With framework adapters:
pip install swarm-at-sdk[langgraph]
pip install swarm-at-sdk[autogen]
pip install swarm-at-sdk[crewai]
pip install swarm-at-sdk[openai]
pip install swarm-at-sdk[all]
Quick Start
One-liner settlement for any agent:
from swarm_at import settle
result = settle(agent="my-agent", task="research", data={"findings": "..."})
assert result.status.value == "SETTLED"
Full control with SettlementContext:
from swarm_at import SettlementContext
ctx = SettlementContext()
r1 = ctx.settle(agent="agent-a", task="step-1")
r2 = ctx.settle(agent="agent-a", task="step-2")
Point at a remote API:
export SWARM_API_URL=https://api.swarm.at
export SWARM_API_KEY=sk-...
from swarm_at import settle
settle(agent="remote-agent", task="classify")
Settlement Tiers
Start in sandbox, move to production when ready.
SANDBOX | Log-only. No ledger writes. Returns synthetic hashes. Safe to experiment. |
STAGING | Writes to ledger but skips chain enforcement. Good for integration testing. |
PRODUCTION | Full verification: hash-chain integrity, confidence thresholds, shadow audits. |
export SWARM_TIER=sandbox
Framework Adapters
Drop-in settlement for the major agent frameworks. No framework imports required.
LangGraph:
from swarm_at.adapters.langgraph import SwarmNodeWrapper
wrapper = SwarmNodeWrapper(agent="research-agent")
@wrapper.wrap
def research_node(state):
return {"findings": "..."}
AutoGen:
from swarm_at.adapters.autogen import SwarmReplyCallback
callback = SwarmReplyCallback()
agent.register_reply([autogen.Agent], callback.on_reply)
CrewAI:
from swarm_at.adapters.crewai import SwarmTaskCallback
callback = SwarmTaskCallback()
crew = Crew(agents=[...], tasks=[...], task_callback=callback.on_task_complete)
OpenAI Assistants:
from swarm_at.adapters.openai_assistants import SwarmRunHandler
handler = SwarmRunHandler(assistant_id="asst_abc123")
handler.settle_run(run, messages)
Authorship Provenance
Need to prove a human was in creative control when AI tools were involved? WritingSession records every decision to the settlement ledger and produces a verifiable provenance report — implementing the Human-AI Agency Spectrum framework (Ghuneim, 2026).
from swarm_at import WritingSession
from swarm_at.authorship import CreativePhase
session = WritingSession(writer="jane-doe", tool="claude-sonnet-4-5")
session.direct(action="premise", chose="noir detective", phase=CreativePhase.CONCEPT)
session.prompt(text="Write the opening scene", phase=CreativePhase.SCENE)
session.generate(output_hash="<sha256-of-output>", model="claude-sonnet-4-5")
session.revise(description="Rewrote opening, cut 40%", kept_ratio=0.35)
report = session.report()
print(report.work_agency)
print(report.safe_harbor)
print(report.chain_verified)
print(report.to_text())
The report maps work agency scores to compliance frameworks: USCO copyright, WGA credit, SAG-AFTRA consent, and EU AI Act marking requirements. Scores >= 90% trigger the professional safe harbor. Behavioral flags warn about anchoring (high kept_ratio), satisficing (consecutive AI outputs without review), and missing foundation (AI generation before human direction).
Sessions are in-memory by default. Set SWARM_SESSION_PATH to persist to JSONL:
export SWARM_SESSION_PATH=sessions.jsonl
Run
uvicorn swarm_at.api.main:app
python -m swarm_at.mcp
Discovery
Discoverable by LLMs, crawlers, and agent frameworks out of the box.
Agent self-check (auth required):
curl -H "Authorization: Bearer $SWARM_API_KEY" \
"https://api.swarm.at/v1/whoami?agent_id=my-agent"
Returns trust level, reputation, tool permissions, cooldown status, and promotion path.
Core Concepts
| Settlement Engine | Verify proposals (hash-chain + confidence + divergence), commit to ledger |
| Settlement Tiers | Graduated adoption: SANDBOX (log-only) / STAGING / PRODUCTION |
| Trust-Tiered Identity | Agents earn authority: UNTRUSTED → PROVISIONAL → TRUSTED → SENIOR |
| Process Chaining | Atomic transactions (Beads) chain into workflows (Molecules) |
| Git-Native Ledger | Ledger backed by git. Branch, merge, git log for audit |
| Shadow Auditor | Cross-model divergence detection with escrow on disagreement |
| Consensus | Multi-agent stake/verify/finalize with configurable thresholds |
| Framework Adapters | First-class LangGraph, AutoGen, CrewAI, OpenAI Assistants integration |
Settlement Types
75 types covering knowledge verification, agent behaviors, prediction markets, protocol operations, compliance, security, infrastructure, data processing, notifications, experiments, and discovery.
Knowledge verification: text-fingerprint, qa-verification, fact-extraction, classification, summarization, translation-audit, data-validation, code-review, sentiment-analysis, logical-reasoning, unit-conversion, geo-validation, timeline-ordering, regex-verification, schema-validation
Agent behaviors: code-generation, code-edit, code-refactor, bug-fix, test-authoring, codebase-search, web-research, planning, debugging, shell-execution, file-operation, git-operation, dependency-management, agent-handoff, consensus-vote, task-delegation, documentation, api-integration, deployment, conversation-turn
Public Ledger
The live settlement record is published at github.com/Mediaeater/swarm-at-ledger. Every entry is independently verifiable.
Test
pytest tests/ -v
1494 tests. ~18s.
© 2026 Mediaeater. All rights reserved.