Deterministic task lifecycle enforcement for multi-agent systems
Project description
Execution Kernel
Deterministic task lifecycle enforcement for multi-agent systems.
Overview
The execution kernel is a lightweight Python library and CLI tool that enforces strict task lifecycle semantics across agent operations. It prevents infinite work loops, skipped lifecycle states, and speculative busywork — ensuring agents produce only valid, bounded, externally-valuable work.
Components
| Module | Responsibility |
|---|---|
lifecycle.py |
State machine for task transitions (todo → in_progress → done, etc.) |
loop_detector.py |
Detection/prevention of self-generated work loops (depth, cycle, identity) |
budget.py |
Execution budget enforcement (steps, depth, wall-clock time) |
paperclip_adapter.py |
API adapter translating kernel actions to Paperclip API calls |
config.py |
YAML configuration loading with deep-merge defaults |
cli.py |
CLI entry point for shell/agent environments |
Installation
pip install exec-kernel
Or from source:
git clone <repo-url>
cd autonomous-ventures
pip install -e .
CLI Usage
Validate a state transition:
exec-kernel validate todo in_progress
# VALID: Work started
Check for loops:
exec-kernel check-loop child-1 agent-1 feature --parent-task-id parent-1
# ALLOWED: depth=1
Check budget:
exec-kernel check-budget task-1 --steps 5 --max-steps 10
# OK: 5 steps, 0s elapsed (max 10 steps, 1800s)
Enter idle sleep (no task generation allowed):
exec-kernel sleep --timeout 30 --agent-id agent-1
# SLEEP:idle agent=agent-1 reason=no_tasks timeout=30s
Python API
from kernel.lifecycle import TaskLifecycle, TaskState
from kernel.loop_detector import LoopDetector, WorkNode
from kernel.budget import BudgetTracker
# State machine
task = TaskLifecycle(task_id="my-task")
task.transition(TaskState.IN_PROGRESS)
task.transition(TaskState.DONE)
# Loop detection
detector = LoopDetector(max_depth=10)
detector.check_new_task("new-task", "agent-1", "feature", parent_task_id="parent-1")
# Budget tracking
tracker = BudgetTracker()
state = tracker.start_task("task-1", {"max_steps": 50})
Configuration
Create .exec-kernel.yml in your project root:
lifecycle:
max_depth: 10
max_heap_size: 1000
budget:
max_steps: 50
max_depth: 10
max_duration_seconds: 1800
Architecture
┌─────────────────────────────────────────────┐
│ exec-kernel CLI / Python API │
│ ┌──────────┐ ┌──────────────┐ ┌─────────┐ │
│ │Lifecycle │ │Loop Detector │ │ Budget │ │
│ │State │ │ │ │Enforce- │ │
│ │Machine │ │ │ │ment │ │
│ └──────────┘ └──────────────┘ └─────────┘ │
│ ┌────────────────────────────────────────┐ │
│ │ Paperclip API Adapter │ │
│ └────────────────────────────────────────┘ │
└─────────────────────────────────────────────┘
Development
pip install -e ".[dev]"
pytest tests/
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file exec_kernel-0.1.0.tar.gz.
File metadata
- Download URL: exec_kernel-0.1.0.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c8dc3df399a4315a90898c44208a1080a796a72d5dbafd282eec9a0307c93c6
|
|
| MD5 |
248ba0c35028b68a67bf7e6310b03610
|
|
| BLAKE2b-256 |
059c9f7543170ece34ed752bdd8caff177b8320e5c991560ab1edfe01bcdbd74
|
File details
Details for the file exec_kernel-0.1.0-py3-none-any.whl.
File metadata
- Download URL: exec_kernel-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a33bf4366c40cb95423495fc65487faa762045c4e723e17f8995c4e7d7f6c71
|
|
| MD5 |
17b6df1dd8a662e558e4d03bc407937e
|
|
| BLAKE2b-256 |
bbe28dace40b380b62b0d54b8e9b4e467950493776637b557ebbaab8a531e047
|