Self-Evolving Domain Agent Framework — AI agents that get better every time they run.
Project description
Nil — Self-Evolving Domain Agent Framework
AI agents that get better every time they run.
Nil is a Python SDK that gives AI agents persistent memory and self-improvement. Unlike frameworks where agents start from zero every session, Nil agents remember what worked, extract reusable skills, detect when strategies stop working, and optimize their own performance — all autonomously.
Quick Start
pip install nil-sdk
import nil
@nil.tool
def search_logs(query: str) -> str:
"""Search application logs."""
return search_my_logs(query)
@nil.tool
def apply_fix(action: str) -> str:
"""Apply a remediation action."""
return execute_fix(action)
domain = nil.Domain(
name="incident-response",
tools=[search_logs, apply_fix],
objectives=["resolve production incidents autonomously"],
success_signal=lambda run: run.success
)
agent = nil.Agent(
domain=domain,
base_model="claude-sonnet-4-20250514",
memory=nil.PersistentMemory("./agent_store"),
evolution=nil.EvolutionConfig(strategy="continuous"),
)
# Every run makes the agent smarter
result = agent.run("API latency spike on /v2/users")
Why Nil?
Every AI agent framework today produces goldfish agents — they start from zero every time, repeat the same mistakes, and can't learn from experience.
Nil solves this with three systems:
-
Agent Kernel — Executes tasks while recording structured experience traces (not just logs — machine-readable execution data).
-
Evolution Engine — Analyzes traces to extract reusable skills, detect performance drift, and autonomously improve strategies.
-
Optimization Layer — Routes subtasks to cheaper models when safe, compresses redundant chains, and manages cost budgets.
Key Features
- Persistent learning — agents remember across sessions via SQLite
- Skill extraction — successful patterns become reusable skills
- Drift detection — alerts when strategies stop working
- Model agnostic — works with Claude, GPT, Llama, or any LLM
- Zero infrastructure — runs on any laptop, stores everything locally
- Cost tracking — per-run token and cost accounting
Project Structure
nil/
├── __init__.py # Public API
├── agent.py # Main Agent class
├── domain.py # Domain definitions
├── config.py # Configuration objects
├── kernel/ # Phase 1: Execution engine
│ ├── runner.py # Agent loop (LLM + tools)
│ ├── tracer.py # Structured experience capture
│ ├── tool_manager.py # Tool registration & dispatch
│ └── outcome.py # Run results
├── memory/ # Phase 1: Persistent storage
│ ├── store.py # SQLite-backed memory
│ ├── experience.py # Trace query interface
│ ├── skill_registry.py # Skill data model
│ └── strategy_version.py # Strategy versioning
├── evolution/ # Phase 2-3: Self-improvement
│ ├── analyzer.py # Pattern detection
│ ├── skill_extractor.py # Skill extraction
│ ├── strategy_mutator.py # Strategy mutation
│ ├── evaluator.py # Strategy evaluation
│ └── drift_detector.py # Drift detection
├── optimization/ # Phase 4: Cost optimization
│ ├── model_router.py # Smart model routing
│ ├── chain_compressor.py # Chain compression
│ ├── cache_manager.py # Response caching
│ └── budget_controller.py # Cost limits
├── providers/ # LLM adapters
│ ├── anthropic.py # Claude
│ ├── openai.py # GPT / compatible
│ └── stub.py # Testing (no API key)
└── tools/ # Tool system
├── base.py # Tool class + @tool decorator
└── registry.py # Global tool registry
Running Tests
pip install -e ".[dev]"
pytest -v
Roadmap
| Phase | What | When |
|---|---|---|
| 1 | Agent Kernel + Memory (this release) | Now |
| 2 | Skill Extraction | Month 3-4 |
| 3 | Evolution Engine (core IP) | Month 5-6 |
| 4 | Cost Optimization | Month 7+ |
Built by
Nelo Robotics Pvt Ltd — Building the intelligence layer for autonomous systems.
License
Apache 2.0
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 nil_sdk-0.1.0.tar.gz.
File metadata
- Download URL: nil_sdk-0.1.0.tar.gz
- Upload date:
- Size: 103.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
275687683f366f804dccee4df137dc139a4e4f41fe303ba10568af71ec3a76dc
|
|
| MD5 |
6ee11029e64b6558833ad806ba331003
|
|
| BLAKE2b-256 |
255bc2608730ee4447046dda68c204a9fcf4885ebd6445930a8ab31c235d3473
|
File details
Details for the file nil_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nil_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 88.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bff11bef1e66f54d33a144ac713f5a9a4b70f79bac73e0f422f7e1ce2bd915e
|
|
| MD5 |
4490f7f8d58e770d09b96f892f1cbfc4
|
|
| BLAKE2b-256 |
42e00c4c28b4295deb3eacb3cbbde87f849f2ff228132603a2184785fd60762f
|