Tiny autonomous engineering harness for startup tasks. Three layers:
| Layer | Piece | Role |
|---|---|---|
| Model | OpenRouter | One API, any tool-calling model. OpenAI-compatible → ChatOpenAI w/ custom base_url. |
| Orchestration | LangChain DeepAgents | Planning todo tool + role subagents w/ isolated context. |
| Runtime safety | NVIDIA OpenShell | Sandboxed exec, declarative policy, audit, privacy router. |
Workflow is Gstack-inspired: Plan → Build → Review → Test → Ship, each phase a subagent. Sessions persist task memory across runs; human-in-the-loop gates are opt-in.
./run.sh "task"
└─ openshell sandbox (policy.yaml) ──── filesystem / network / process gates + audit
└─ nanoloop CLI (nanoloop/main.py)
└─ DeepAgents orchestrator [OpenRouter: HARNESS_MODEL]
├─ todo planning tool
├─ tools: run_shell / read_file / write_file / human_review /
│ track_task / remember / recall / list_skills / use_skill
└─ subagents (isolated context, HARNESS_SUBAGENT_MODEL)
planner · builder · reviewer · qa · shipper
OpenShell wraps the whole process, so the policy engine gates actions out-of-process — the agent cannot escape its own sandbox by editing tool code.
From PyPI (once published):
pip install nanoloopFrom source (editable dev):
python3.11 -m venv .venv && source .venv/bin/activate # 3.11+ required
pip install -e .
cp .env.example .env # add your OPENROUTER_API_KEY
curl -LsSf https://raw.githubusercontent.com/NVIDIA/OpenShell/main/install.sh | shchmod +x run.sh
./run.sh "Scaffold a FastAPI service with health check and a passing test"Or call the installed CLI directly:
nanoloop "<task>" # new session, gates OFF (autonomous)
nanoloop new "<task>"
nanoloop interactive "<task>" # gates ON: pause for y/n/guidance at key points
nanoloop resume <id> ["follow-up"] # continue a saved session (keeps task memory)
nanoloop list # list saved sessions
nanoloop show <id> # task log + human decisionsWithout OpenShell installed, run.sh falls back to unsandboxed (dev only) and warns.
Each run is a Session persisted to ./.nanoloop/sessions/<id>.json: original goal,
task log (pending → active → done/blocked), human decisions, and a compact transcript.
resume injects that state back so the crew continues where it left off.
Durable facts live as Markdown files in ./Memory/<name>.md with frontmatter
(name, description, metadata.type ∈ user/feedback/project/reference) and a
body that links related notes via [[other-note]]. Those links form a knowledge
graph; Memory/MEMORY.md is an auto-generated index. The crew uses recall
before planning and remember to persist new facts; inspect from the CLI:
nanoloop memory # index
nanoloop memory <name> # one note
nanoloop memory links <name> # inbound + outbound [[links]]Override the location with NANOLOOP_MEMORY_DIR.
Reusable instruction packs in ./Skills, either Skills/<name>.md or
Skills/<name>/SKILL.md (frontmatter name + description, body = steps). The
orchestrator sees every skill's name/description up front and calls
use_skill(<name>) to pull full instructions on demand.
nanoloop skills # list discovered skillsOverride the location with NANOLOOP_SKILLS_DIR. A scaffold-fastapi skill
ships as an example.
Off by default (autonomous). Prefix any run command with interactive to enable
human_review gates at plan-approval, pre-ship, and when blocked. Equivalent
to HARNESS_HITL=1. Enabled gates still auto-approve (logged as auto) when there's no
tty, so non-interactive/sandbox runs never hang.
pip install build
python -m build # → dist/nanoloop-0.1.0-py3-none-any.whl + .tar.gz
python -m twine upload dist/* # publish to PyPInanoloop/model.py— OpenRouterChatOpenAIfactorynanoloop/agents.py—create_deep_agentw/ subagents + optional checkpointernanoloop/roles.py— Gstack role prompts + orchestrator promptnanoloop/tools.py— shell/file/human_review/track_task/memory/skill toolsnanoloop/session.py— durable session + task memorynanoloop/memory.py— Markdown knowledge-graph memory (./Memory)nanoloop/skills.py— skill discovery + loading (./Skills)nanoloop/frontmatter.py— tiny YAML-free frontmatter parserSkills/— reusable instruction packs (example: scaffold-fastapi)nanoloop/main.py— streaming CLI w/ subcommandspolicy.yaml— OpenShell policy (default-deny; allowlist gateway + registries)
- Verify exact API surface against installed versions: DeepAgents
subagents=schema and OpenShellpolicy.yamlkeys evolve. Runopenshell policy validate policy.yaml. - DeepAgents needs Python ≥3.11.