NabilAziz99/agent-runtime
123 stars · Last commit 2026-05-25
Python port of Claude Code's agent-runtime architecture, on LangChain
README preview
# agent_runtime — Python port of Claude Code's agent spawning architecture A clean, minimal Python implementation of the agent spawning patterns we reverse-engineered from Claude Code. Focuses on the *architecture*, not feature completeness: - Async-generator-based agent loop (recursion = subagents) - `AbortController` with hierarchical, GC-safe cancellation - Module-level agent registry with push/drain mailbox - Bounded concurrency via `asyncio.Semaphore` (coming in Step 2) - Extension points wired in from day 1 (compaction, hooks, etc.) **Built on LangChain.** Message types (HumanMessage, AIMessage, ToolMessage, SystemMessage), the chat model (BaseChatModel), and tools (BaseTool) all come from `langchain_core`. The provider seam is `langchain_anthropic.ChatAnthropic` by default; swap in `ChatOpenAI`, `ChatGoogleGenerativeAI`, etc. without touching agent code. ## Status: Step 1 — foundation only