sovereign-agent 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sovereign_agent-0.2.0/LICENSE +19 -0
- sovereign_agent-0.2.0/PKG-INFO +405 -0
- sovereign_agent-0.2.0/README.md +365 -0
- sovereign_agent-0.2.0/pyproject.toml +106 -0
- sovereign_agent-0.2.0/setup.cfg +4 -0
- sovereign_agent-0.2.0/sovereign_agent/__init__.py +189 -0
- sovereign_agent-0.2.0/sovereign_agent/_internal/__init__.py +1 -0
- sovereign_agent-0.2.0/sovereign_agent/_internal/atomic.py +145 -0
- sovereign_agent-0.2.0/sovereign_agent/_internal/extras.py +42 -0
- sovereign_agent-0.2.0/sovereign_agent/_internal/isolation.py +419 -0
- sovereign_agent-0.2.0/sovereign_agent/_internal/landlock_shim.py +369 -0
- sovereign_agent-0.2.0/sovereign_agent/_internal/llm_client.py +287 -0
- sovereign_agent-0.2.0/sovereign_agent/_internal/paths.py +132 -0
- sovereign_agent-0.2.0/sovereign_agent/cli/__init__.py +466 -0
- sovereign_agent-0.2.0/sovereign_agent/config.py +142 -0
- sovereign_agent-0.2.0/sovereign_agent/discovery.py +203 -0
- sovereign_agent-0.2.0/sovereign_agent/errors.py +240 -0
- sovereign_agent-0.2.0/sovereign_agent/executor/__init__.py +718 -0
- sovereign_agent-0.2.0/sovereign_agent/halves/__init__.py +34 -0
- sovereign_agent-0.2.0/sovereign_agent/halves/loop.py +151 -0
- sovereign_agent-0.2.0/sovereign_agent/halves/structured.py +173 -0
- sovereign_agent-0.2.0/sovereign_agent/halves/verifiers.py +426 -0
- sovereign_agent-0.2.0/sovereign_agent/handoff/__init__.py +122 -0
- sovereign_agent-0.2.0/sovereign_agent/ipc/__init__.py +25 -0
- sovereign_agent-0.2.0/sovereign_agent/ipc/approval.py +395 -0
- sovereign_agent-0.2.0/sovereign_agent/ipc/protocol.py +190 -0
- sovereign_agent-0.2.0/sovereign_agent/ipc/watcher.py +200 -0
- sovereign_agent-0.2.0/sovereign_agent/memory/__init__.py +326 -0
- sovereign_agent-0.2.0/sovereign_agent/observability/__init__.py +24 -0
- sovereign_agent-0.2.0/sovereign_agent/observability/judges.py +163 -0
- sovereign_agent-0.2.0/sovereign_agent/observability/report.py +110 -0
- sovereign_agent-0.2.0/sovereign_agent/observability/trace.py +100 -0
- sovereign_agent-0.2.0/sovereign_agent/orchestrator/__init__.py +27 -0
- sovereign_agent-0.2.0/sovereign_agent/orchestrator/credentials.py +48 -0
- sovereign_agent-0.2.0/sovereign_agent/orchestrator/main.py +472 -0
- sovereign_agent-0.2.0/sovereign_agent/orchestrator/mounts.py +196 -0
- sovereign_agent-0.2.0/sovereign_agent/orchestrator/worker.py +417 -0
- sovereign_agent-0.2.0/sovereign_agent/orchestrator/worker_entrypoint.py +148 -0
- sovereign_agent-0.2.0/sovereign_agent/planner/__init__.py +311 -0
- sovereign_agent-0.2.0/sovereign_agent/scheduler/__init__.py +15 -0
- sovereign_agent-0.2.0/sovereign_agent/scheduler/drift_corrected.py +174 -0
- sovereign_agent-0.2.0/sovereign_agent/session/__init__.py +42 -0
- sovereign_agent-0.2.0/sovereign_agent/session/directory.py +435 -0
- sovereign_agent-0.2.0/sovereign_agent/session/queue.py +356 -0
- sovereign_agent-0.2.0/sovereign_agent/session/resume.py +267 -0
- sovereign_agent-0.2.0/sovereign_agent/session/state.py +163 -0
- sovereign_agent-0.2.0/sovereign_agent/tickets/__init__.py +27 -0
- sovereign_agent-0.2.0/sovereign_agent/tickets/manifest.py +98 -0
- sovereign_agent-0.2.0/sovereign_agent/tickets/state.py +79 -0
- sovereign_agent-0.2.0/sovereign_agent/tickets/ticket.py +253 -0
- sovereign_agent-0.2.0/sovereign_agent/tools/__init__.py +17 -0
- sovereign_agent-0.2.0/sovereign_agent/tools/builtin/__init__.py +280 -0
- sovereign_agent-0.2.0/sovereign_agent/tools/registry.py +370 -0
- sovereign_agent-0.2.0/sovereign_agent/voice/__init__.py +70 -0
- sovereign_agent-0.2.0/sovereign_agent.egg-info/PKG-INFO +405 -0
- sovereign_agent-0.2.0/sovereign_agent.egg-info/SOURCES.txt +58 -0
- sovereign_agent-0.2.0/sovereign_agent.egg-info/dependency_links.txt +1 -0
- sovereign_agent-0.2.0/sovereign_agent.egg-info/entry_points.txt +2 -0
- sovereign_agent-0.2.0/sovereign_agent.egg-info/requires.txt +25 -0
- sovereign_agent-0.2.0/sovereign_agent.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2026 Rod Rivera and sovereign-agent contributors
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
Full license text: https://www.apache.org/licenses/LICENSE-2.0.txt
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sovereign-agent
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A framework for building always-on AI agents that you actually own
|
|
5
|
+
Author: Rod Rivera
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/sovereignagents/sovereign-agent
|
|
8
|
+
Project-URL: Repository, https://github.com/sovereignagents/sovereign-agent
|
|
9
|
+
Project-URL: Issues, https://github.com/sovereignagents/sovereign-agent/issues
|
|
10
|
+
Keywords: agent,llm,always-on,ai,orchestration
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Requires-Python: >=3.12
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: openai>=1.40
|
|
21
|
+
Requires-Dist: typer>=0.12
|
|
22
|
+
Requires-Dist: croniter>=2.0
|
|
23
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
24
|
+
Provides-Extra: evidently
|
|
25
|
+
Requires-Dist: evidently>=0.4; extra == "evidently"
|
|
26
|
+
Provides-Extra: otel
|
|
27
|
+
Requires-Dist: opentelemetry-api>=1.25; extra == "otel"
|
|
28
|
+
Requires-Dist: opentelemetry-sdk>=1.25; extra == "otel"
|
|
29
|
+
Requires-Dist: opentelemetry-exporter-otlp>=1.25; extra == "otel"
|
|
30
|
+
Provides-Extra: voice
|
|
31
|
+
Requires-Dist: speechmatics-python; extra == "voice"
|
|
32
|
+
Requires-Dist: elevenlabs; extra == "voice"
|
|
33
|
+
Provides-Extra: rasa
|
|
34
|
+
Requires-Dist: rasa-pro; extra == "rasa"
|
|
35
|
+
Provides-Extra: docker
|
|
36
|
+
Requires-Dist: docker>=7.0; extra == "docker"
|
|
37
|
+
Provides-Extra: all
|
|
38
|
+
Requires-Dist: sovereign-agent[docker,evidently,otel,voice]; extra == "all"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
# sovereign-agent
|
|
42
|
+
|
|
43
|
+
**The eight architectural decisions every serious agent system converges on — implemented as a library you can use, and a tutorial you can read.**
|
|
44
|
+
|
|
45
|
+
Debug by `cat`. Crash-recover by `ls`. Teach by reading the same code that runs in production.
|
|
46
|
+
|
|
47
|
+
<p align="center">
|
|
48
|
+
<a href="https://github.com/sovereignagents/sovereign-agent/actions/workflows/ci.yml"><img alt="CI status" src="https://github.com/sovereignagents/sovereign-agent/actions/workflows/ci.yml/badge.svg"></a>
|
|
49
|
+
<a href="https://pypi.org/project/sovereign-agent/"><img alt="PyPI version" src="https://img.shields.io/pypi/v/sovereign-agent.svg"></a>
|
|
50
|
+
<a href="https://pypi.org/project/sovereign-agent/"><img alt="Python versions" src="https://img.shields.io/pypi/pyversions/sovereign-agent.svg"></a>
|
|
51
|
+
<a href="LICENSE"><img alt="License" src="https://img.shields.io/pypi/l/sovereign-agent.svg"></a>
|
|
52
|
+
<a href="https://github.com/sovereignagents/sovereign-agent/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/sovereignagents/sovereign-agent.svg?style=social"></a>
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install sovereign-agent
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
from sovereign_agent import run_task, register_tool
|
|
61
|
+
|
|
62
|
+
@register_tool
|
|
63
|
+
def get_weather(city: str) -> dict:
|
|
64
|
+
"""Look up current weather for a city."""
|
|
65
|
+
return {"city": city, "temperature": 18, "condition": "rainy"}
|
|
66
|
+
|
|
67
|
+
result = run_task("What's the weather in Edinburgh?")
|
|
68
|
+
print(result.summary)
|
|
69
|
+
# → "Weather in Edinburgh: 18°C, rainy."
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The agent ran a planner, called `get_weather`, wrote a trace, and saved every artifact to `sessions/sess_<id>/`. Inspect it with `ls -R sessions/sess_<id>`. That's not a metaphor — it's how you debug this system.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## What sovereign-agent is, exactly
|
|
77
|
+
|
|
78
|
+
Two things in one repository:
|
|
79
|
+
|
|
80
|
+
**A production library** you `pip install` and use to build agents.
|
|
81
|
+
**A build-from-scratch curriculum** that reconstructs the library in five chapters with tests, so you learn by implementing.
|
|
82
|
+
|
|
83
|
+
Both point at the same code. A CI check (`tools/verify_chapter_drift.py`) ensures the chapter code and the production library stay identical. This is the fastai pattern — the library and the course teach each other.
|
|
84
|
+
|
|
85
|
+
sovereign-agent is **not** trying to be the next Claude Code or OpenHands. It's the thing you read to understand *why* they and every other production agent system converged on the same eight architectural decisions.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## The eight decisions (this is the product)
|
|
90
|
+
|
|
91
|
+
Every production agent system I've read the internals of — Claude Code, OpenHands, Aider, SWE-agent, Devin, Cognition's public work — has independently arrived at the same eight decisions. sovereign-agent is those decisions, made explicit, with code you can run.
|
|
92
|
+
|
|
93
|
+
1. **Sessions are directories.** `sessions/sess_<12hex>/` contains everything — memory, IPC, state, logs, artifacts. No database. No shared tables.
|
|
94
|
+
2. **State is forward-only.** A session never transitions backwards. Retries are new sessions, linked to the old one.
|
|
95
|
+
3. **Tickets for every operation.** Append-only audit trail. Tickets are to your agent what commits are to a git repo.
|
|
96
|
+
4. **Manifests verify by SHA-256.** Detect accidental edits, disk corruption, and tampering. Not cryptographic security — this is about catching the mistakes you actually make.
|
|
97
|
+
5. **Atomic rename for IPC.** Two halves of the agent communicate by writing files. No brokers, no Kafka, no Redis. POSIX's `rename()` is the only IPC primitive you need until proven otherwise.
|
|
98
|
+
6. **Lock at the session level.** Not finer (deadlocks), not coarser (unscalable). One serialization boundary per session gives you multi-file consistency for free.
|
|
99
|
+
7. **Parse JSON defensively.** The LLM is lying. Write a parser that handles what the model *actually* produces, not what the prompt *instructed* it to produce.
|
|
100
|
+
8. **Register tools explicitly.** Prompts are advisory; the registry is physics. When the model persistently reaches for a tool you don't want used, remove the tool — don't write the third negative instruction.
|
|
101
|
+
|
|
102
|
+
Each decision *removes* a class of bugs rather than handling them. That's why the decisions age well.
|
|
103
|
+
|
|
104
|
+
Full walk-through in [`docs/architecture.md`](docs/architecture.md) — this is the text of the three-hour lecture.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## The ninth thing nobody converges on, but should: dataflow integrity
|
|
109
|
+
|
|
110
|
+
The framework can guarantee that tools were called, tickets were written, manifests verified, state advanced. **That is necessary but not sufficient.** You also need to verify the LLM *used* its tool outputs.
|
|
111
|
+
|
|
112
|
+
Every scenario in this repo ships with a dataflow integrity audit. The research-assistant scenario checks that every arXiv ID cited in the report was actually returned by `web_lookup` — not fabricated from training data. The code-reviewer scenario checks that the review references findings the analyzer actually returned.
|
|
113
|
+
|
|
114
|
+
This is not a hypothetical concern:
|
|
115
|
+
|
|
116
|
+
> *One morning I had a framework with 148 passing tests and three clean scenarios. I ran the code reviewer against a real LLM for the first time. It produced a perfectly-formatted review of code that did not exist — named `add`, `multiply`, `divide`. The framework reported ✓ success, ✓ manifest, ✓ complete. Every structural guarantee held. The output was pure fiction.*
|
|
117
|
+
|
|
118
|
+
"It ran" is not "it worked." The library gives you the first; your scenario has to verify the second. Every example in this repo demonstrates the pattern. See [class slides §06](docs/class-slides.md) for the production healthcare anecdote that underscores why this is not optional.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Install
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
pip install sovereign-agent # core
|
|
126
|
+
pip install "sovereign-agent[all]" # + optional extras (voice, observability, Docker)
|
|
127
|
+
pip install "sovereign-agent[dev]" # + development tooling
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Requires Python 3.12+.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## The two halves
|
|
135
|
+
|
|
136
|
+
The decision-8 principle — *prompts are advisory, registries are physics* — generalizes. Not every constraint is a tool registry. Some constraints are rules. sovereign-agent ships a **loop half** (ReAct-style LLM reasoning) and a **structured half** (deterministic Python) that communicate by atomic-rename IPC.
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from sovereign_agent import LoopHalf, StructuredHalf, Rule
|
|
140
|
+
|
|
141
|
+
loop = LoopHalf(planner=planner, executor=executor)
|
|
142
|
+
|
|
143
|
+
structured = StructuredHalf(rules=[
|
|
144
|
+
Rule(name="commit_under_cap",
|
|
145
|
+
condition=lambda d: d["deposit"] <= 300,
|
|
146
|
+
action=commit_booking),
|
|
147
|
+
Rule(name="escalate_over_cap",
|
|
148
|
+
condition=lambda d: d["deposit"] > 300,
|
|
149
|
+
escalate_if=lambda d: True),
|
|
150
|
+
])
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The loop decides what to try. The structured half decides what's allowed. No amount of prompt engineering can bypass a rule — the business constraint lives in Python where it belongs.
|
|
154
|
+
|
|
155
|
+
This isn't new. It's how every financial, regulatory, or high-stakes agent system eventually ends up structured. The name varies ("policy layer," "guardrails," "rules engine") but the pattern is the same. sovereign-agent makes it the default.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## What ships in v0.2
|
|
160
|
+
|
|
161
|
+
Five capabilities that came out of running sovereign-agent against real LLMs and hitting real failures:
|
|
162
|
+
|
|
163
|
+
**Parallel tool dispatch.** Tools marked `parallel_safe=True` run concurrently. Writes and handoffs serialize automatically. Five 0.3s calls finish in 0.31s instead of 1.5s.
|
|
164
|
+
|
|
165
|
+
**Worker isolation without Docker.** Linux ≥5.13 gets kernel-level Landlock. macOS gets `sandbox-exec`. No container runtime needed. Tool compromise can't escape the session directory.
|
|
166
|
+
|
|
167
|
+
**Session resume.** Resume any terminal session as a new child. Parent context auto-prepends to the child's `SESSION.md`. Chains preserve ancestry. Forward-only state is preserved — resumes are new sessions, never edits of the old.
|
|
168
|
+
|
|
169
|
+
**Verifier protocol.** Rule conditions accept callables, scikit-learn classifiers, or LLM judges. Same audit trail, different backend. Decision 6 generalized.
|
|
170
|
+
|
|
171
|
+
**Human-in-the-loop approval.** Tools return `requires_human_approval=True`. The executor exits cleanly, writes the request to disk, and resumes when a human decides — seconds, hours, or days later. Nothing in memory.
|
|
172
|
+
|
|
173
|
+
Each is ~200-400 lines of code with tests. See `examples/` for end-to-end scenarios that use each one.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## The architecture in one picture
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
181
|
+
│ LOOP HALF Planner → Executor → Tools │
|
|
182
|
+
│ (reasoning) ReAct-style, free-form LLM │
|
|
183
|
+
│ │
|
|
184
|
+
│ ▼ handoff via ipc/handoff_to_structured.json │
|
|
185
|
+
│ │
|
|
186
|
+
│ STRUCTURED HALF Deterministic rules, classifiers, │
|
|
187
|
+
│ (constraints) LLM judges — whatever you configure. │
|
|
188
|
+
│ Binds what's allowed. │
|
|
189
|
+
└─────────────────────────────────────────────────────────────┘
|
|
190
|
+
│
|
|
191
|
+
▼
|
|
192
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
193
|
+
│ sessions/sess_a382a2149fc1/ │
|
|
194
|
+
│ ├── session.json # state machine, forward-only │
|
|
195
|
+
│ ├── SESSION.md # the system prompt │
|
|
196
|
+
│ ├── workspace/ # tool outputs, agent artifacts │
|
|
197
|
+
│ ├── memory/ # persistent facts across runs │
|
|
198
|
+
│ ├── ipc/ # atomic-rename message passing │
|
|
199
|
+
│ ├── tickets/ # every operation recorded │
|
|
200
|
+
│ └── logs/trace.jsonl # every event, every tool call │
|
|
201
|
+
└─────────────────────────────────────────────────────────────┘
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Debugging by `cat`
|
|
207
|
+
|
|
208
|
+
This is the visceral version of "sessions are directories." Last week I debugged five separate failures across three scenarios. Every one was diagnosed from three lines of JSONL:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
$ cat sessions/sess_5ab10359c72a/logs/trace.jsonl
|
|
212
|
+
{"event_type": "executor.tool_called", "payload":
|
|
213
|
+
{"tool": "read_file", "arguments": {"path": "workspace/source.py"},
|
|
214
|
+
"success": false, "summary": "file not found"}}
|
|
215
|
+
{"event_type": "executor.tool_called", "payload":
|
|
216
|
+
{"tool": "list_files", "arguments": {"path": "workspace"},
|
|
217
|
+
"success": true, "summary": "0 entries"}}
|
|
218
|
+
{"event_type": "executor.tool_called", "payload":
|
|
219
|
+
{"tool": "complete_task", "arguments":
|
|
220
|
+
{"result": {"status": "failed",
|
|
221
|
+
"reason": "No source file found in workspace"}}}}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
The LLM never tried the analyzer tool. It looked for files that weren't there, gave up, marked the session complete. Three lines and I knew the fix (decision 8: remove the directory-listing tool from the registry; the model reaches for it reflexively).
|
|
225
|
+
|
|
226
|
+
No SELECT queries. No vendor viewer. No SDK. `cat`.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Three surfaces, one codebase
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
sovereign-agent/
|
|
234
|
+
├── sovereign_agent/ # the library you pip install
|
|
235
|
+
├── chapters/ # 5 tutorial chapters (minitorch-style, fill in the TODOs)
|
|
236
|
+
├── examples/ # 8 reference scenarios (research, code review, HITL, etc.)
|
|
237
|
+
├── docs/ # architecture, API stability, class slides
|
|
238
|
+
└── tests/ # 267 tests — library + chapters + examples
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
- **If you want to ship an agent today** → read `sovereign_agent/` and pick scenarios from `examples/`
|
|
242
|
+
- **If you want to understand how it works** → read the chapters. Each one rebuilds a piece of the library. Your tests pass when you're done.
|
|
243
|
+
- **If you want the full lecture** → `docs/class-slides.md` (3 hours, 122 slides, the full 8-decisions walkthrough with the actual traces from the debugging session)
|
|
244
|
+
|
|
245
|
+
The chapter/library drift check (`tools/verify_chapter_drift.py`) runs in CI. If you change the library and forget to update the chapter, or vice versa, CI fails. The tutorial can't rot.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Lineage
|
|
250
|
+
|
|
251
|
+
sovereign-agent stands on three lineages:
|
|
252
|
+
|
|
253
|
+
**Teaching artifacts with real libraries** — the pattern:
|
|
254
|
+
- [`fastai`](https://github.com/fastai/fastai) (Jeremy Howard) — the library + course pattern. sovereign-agent's biggest debt.
|
|
255
|
+
- [`minitorch`](https://github.com/minitorch/minitorch) (Sasha Rush) — rebuild-the-framework pedagogy. Chapters work like this.
|
|
256
|
+
- [`LLMs-from-scratch`](https://github.com/rasbt/LLMs-from-scratch) (Sebastian Raschka) — book + code as the same artifact. Reading order matters.
|
|
257
|
+
- [`nanoGPT`](https://github.com/karpathy/nanoGPT) (Andrej Karpathy) — small, readable, no magic.
|
|
258
|
+
|
|
259
|
+
**Production agent systems that converged on the same architecture**:
|
|
260
|
+
- [NanoClaw](https://github.com/qwibitai/nanoclaw) (Gavriel Cohen) — TypeScript reference implementation. Read `src/group-queue.ts`; two hours of reading and you'll see where sovereign-agent's patterns come from.
|
|
261
|
+
- [Claude Code](https://www.anthropic.com/news/claude-code) — session-as-directory, sub-agent isolation.
|
|
262
|
+
- [OpenHands](https://github.com/All-Hands-AI/OpenHands) — closest OSS cousin architecturally.
|
|
263
|
+
- [Aider](https://github.com/paul-gauthier/aider) — per-repo state in `.aider/`, same pattern simpler scope.
|
|
264
|
+
- [SWE-agent](https://arxiv.org/abs/2405.15793), [Devin](https://www.cognition.ai/blog) — per-task sandboxes.
|
|
265
|
+
|
|
266
|
+
**Papers that shaped the module design**:
|
|
267
|
+
- [ReAct](https://arxiv.org/abs/2210.03629) — the executor loop.
|
|
268
|
+
- [Reflexion](https://arxiv.org/abs/2303.11366) — memory patterns.
|
|
269
|
+
- [MemGPT](https://arxiv.org/abs/2310.08560) — hierarchical memory.
|
|
270
|
+
- [Voyager](https://arxiv.org/abs/2305.16291) — procedural memory; file-based skills.
|
|
271
|
+
- [SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering](https://arxiv.org/abs/2405.15793) — "give the agent a typewriter, not a console."
|
|
272
|
+
|
|
273
|
+
See [`CREDITS.md`](CREDITS.md) for the full list.
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Quick-start with a real LLM
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
# Configure your LLM endpoint (Nebius, OpenAI, or any OpenAI-compatible provider)
|
|
281
|
+
cp .env.example .env
|
|
282
|
+
# edit: set NEBIUS_KEY=sk-... and optionally swap models
|
|
283
|
+
|
|
284
|
+
# Verify everything is wired up — Python, uv, .env, models, imports, CI
|
|
285
|
+
make doctor
|
|
286
|
+
|
|
287
|
+
# Run a real scenario end-to-end
|
|
288
|
+
make example-research-real
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
A real-LLM run prints every step, every tool call, and finishes with a dataflow integrity audit. Expected output for `example-research-real`:
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
▶ research-assistant (real LLM)
|
|
295
|
+
planner: MiniMaxAI/MiniMax-M2.5
|
|
296
|
+
executor: Qwen/Qwen3-235B-A22B-Instruct-2507
|
|
297
|
+
✓ plan produced: 1 subgoal, loop half
|
|
298
|
+
✓ web_lookup("retrieval augmented generation") → 2 results
|
|
299
|
+
✓ write_file(report.md) — 287 bytes
|
|
300
|
+
✓ complete_task
|
|
301
|
+
|
|
302
|
+
=== Dataflow integrity audit ===
|
|
303
|
+
web_lookup calls: 1, successful hits: 2, unique papers returned: 2
|
|
304
|
+
✓ all 2 arXiv ID(s) came from web_lookup
|
|
305
|
+
titles from web_lookup referenced in report: 2/2
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
If the model fabricates a paper the audit catches it and flags ✗ with the fabricated ID. This pattern is what you want to copy into your own scenarios.
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Launch-checklist-as-Makefile
|
|
313
|
+
|
|
314
|
+
The Makefile is also the documentation for the release workflow:
|
|
315
|
+
|
|
316
|
+
```
|
|
317
|
+
make doctor # 15-check tabular status — Python, uv, .env, imports, CI
|
|
318
|
+
make preflight # lint + drift + pytest collection + demo importability
|
|
319
|
+
make test # 267 tests
|
|
320
|
+
make ci-real-estimate # cost preview for a full ci-real run (no API calls)
|
|
321
|
+
make ci-real # run every -real scenario against a live LLM
|
|
322
|
+
make pre-publish # audit for secrets, PII, forbidden files before public push
|
|
323
|
+
make ready-to-ship # preflight + pre-publish + build — ends "next: git tag..."
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
`make help` groups every target by category. `make doctor` output is tabular; paste it into an issue and a maintainer has full diagnostic context.
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## Where things live
|
|
331
|
+
|
|
332
|
+
sovereign-agent is a well-behaved Python library. It never writes to your CWD when you `import sovereign_agent`. Different entry points write to different places by design:
|
|
333
|
+
|
|
334
|
+
| Entry point | Artifacts go to | Why |
|
|
335
|
+
|---|---|---|
|
|
336
|
+
| `sovereign-agent run <task>` (production) | `./sessions/` (your CWD) | Your deployment, your call |
|
|
337
|
+
| `python -m chapters.<n>.demo` | `$XDG_DATA_HOME/sovereign-agent/demos/` | Persists for inspection; outside your git tree |
|
|
338
|
+
| `python -m examples.<n>.run` (offline) | tempdir, auto-cleans | Deterministic dev runs |
|
|
339
|
+
| `python -m examples.<n>.run --real` | `$XDG_DATA_HOME/sovereign-agent/examples/` | Real-LLM runs burn tokens; keep artifacts |
|
|
340
|
+
|
|
341
|
+
Override via `SOVEREIGN_AGENT_DATA_DIR=<path>`.
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Status
|
|
346
|
+
|
|
347
|
+
**v0.2.0 alpha.** The 67 public APIs in `sovereign_agent.__all__` are stable within the 0.2.x series — bug fixes flow through, breaking changes will bump to 0.3.0. See [`docs/API.md`](docs/API.md) for the full semver contract.
|
|
348
|
+
|
|
349
|
+
- ✅ Framework: sessions, tickets, IPC, parallelism, isolation, resume, verifiers, HITL
|
|
350
|
+
- ✅ 267 tests (library + chapter drift + mocked real-path integration)
|
|
351
|
+
- ✅ 8 reference scenarios, all with dataflow integrity checks
|
|
352
|
+
- ✅ 5 tutorial chapters, CI-enforced against production code
|
|
353
|
+
- 🚧 Voice pipeline, observability backends (Evidently/Langfuse/OTel) — shipped as skeletons
|
|
354
|
+
- 🚧 Vector-DB memory backends — v0.3
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## What sovereign-agent is not
|
|
359
|
+
|
|
360
|
+
It's not trying to replace Claude Code for daily coding or LangGraph for orchestration-heavy workflows. It's not a framework I'm trying to grow into the next big thing. It's not abandoned; it's not vibe-coded; it's not a thin wrapper over LangChain.
|
|
361
|
+
|
|
362
|
+
**What it is:** a substrate for teaching the eight architectural decisions, plus a library that implements them cleanly enough that you can use it for real work. fastai for agents.
|
|
363
|
+
|
|
364
|
+
If you want an agent you can own, audit, reproduce, teach, and — crucially — understand at the bottom of the stack, this is probably the smallest codebase in the world that gives you all five.
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Learn more
|
|
369
|
+
|
|
370
|
+
- 📖 [**`docs/architecture.md`**](docs/architecture.md) — the 8 decisions in detail, with code
|
|
371
|
+
- 🎓 [**`docs/class-slides.md`**](docs/class-slides.md) — the 3-hour lecture, 122 slides, full debugging journey
|
|
372
|
+
- 🧭 [**`chapters/`**](chapters/) — rebuild the framework yourself in 5 runnable chapters
|
|
373
|
+
- 🧪 [**`examples/`**](examples/) — 8 reference scenarios, each with a dataflow integrity audit
|
|
374
|
+
- 📋 [**`docs/API.md`**](docs/API.md) — semver contract for the 67 public symbols
|
|
375
|
+
- 📝 [**`CHANGELOG.md`**](CHANGELOG.md) — what shipped and when
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Contributing
|
|
380
|
+
|
|
381
|
+
Pull requests, issues, and architectural criticism are welcome. See [`CONTRIBUTING.md`](CONTRIBUTING.md).
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
git clone https://github.com/sovereignagents/sovereign-agent
|
|
385
|
+
cd sovereign-agent
|
|
386
|
+
make first-run # install, preflight, sanity check
|
|
387
|
+
make test # 267 tests, ~20s
|
|
388
|
+
make demo-ch5 # see a working agent end-to-end
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
## Credits
|
|
394
|
+
|
|
395
|
+
**NanoClaw** (Gavriel Cohen) is the TypeScript reference implementation whose patterns — session-as-directory, group-queue serialization, tickets, filesystem IPC — sovereign-agent ports and extends in Python.
|
|
396
|
+
|
|
397
|
+
sovereign-agent is also built by reading and comparing production agent systems ([Claude Code](https://www.anthropic.com/news/claude-code), [OpenHands](https://github.com/All-Hands-AI/OpenHands), [Aider](https://github.com/paul-gauthier/aider)) and the foundational papers ([ReAct](https://arxiv.org/abs/2210.03629), [Reflexion](https://arxiv.org/abs/2303.11366), [SWE-agent](https://arxiv.org/abs/2405.15793), [Voyager](https://arxiv.org/abs/2305.16291), [MemGPT](https://arxiv.org/abs/2310.08560)). The pedagogical format is modelled on [nanoGPT](https://github.com/karpathy/nanoGPT) (Karpathy), [minitorch](https://github.com/minitorch/minitorch) (Rush), [LLMs-from-scratch](https://github.com/rasbt/LLMs-from-scratch) (Raschka), and [fastai](https://github.com/fastai/fastai) (Howard).
|
|
398
|
+
|
|
399
|
+
See [`CREDITS.md`](CREDITS.md) for full attributions.
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## License
|
|
404
|
+
|
|
405
|
+
[Apache 2.0](LICENSE). Use commercially, modify, fork — just keep the notice.
|