Fennec-AI/agent-runtime

94 stars · Last commit 2026-06-26

Python port of Claude Code's agent-runtime architecture, on LangChain

README preview

# agent_runtime

A Python port of **Claude Code's agent-spawning architecture**, built on LangChain.

It reproduces the part of Claude Code that's genuinely interesting: how a main
agent spawns subagents, coordinates background work, and cancels a whole tree
cleanly — not the UI, not the product surface. ~5k lines, one shared agent loop,
13 tools, a real test suite.

> **Scope:** this is the *agent runtime* slice — the loop, the spawn hierarchy,
> cancellation, tool dispatch. It is a study/port, not a drop-in replacement for
> the Claude Code CLI.

---

## What it does

- **One agent loop, used at every level.** `query()` runs the main agent *and*
  every subagent. The only thing that differs between levels is the `RunContext`
  passed in. Recursion through the loop *is* the agent tree.

View full repository on GitHub →