{"slug": "show-hn-tinyagents-a-rust-based-recursive-llm-harness", "title": "Show HN: TinyAgents – a Rust based recursive LLM harness", "summary": "TinyAgents, a Rust-based recursive language model harness, was released on Hacker News. It implements the Recursive Language Model (RLM) execution model, enabling agents to call sub-agents, graphs to run subgraphs, and models to author and execute their own workflows. The project aims to mitigate context rot and extend effective context beyond the raw window.", "body_md": "**TinyAgents is a recursive language-model (RLM) harness for Rust.** It is a\ntyped, durable runtime where language models call models, agents call agents,\ngraphs run graphs, and a model can author, compile, and run the very workflow it\nis standing inside — all as inspectable, checkpointed, policy-checked Rust.\n\nMost agent frameworks stuff everything into one ever-growing context window and\nhope the model copes. **Recursive Language Models (RLMs)** take a different\nstance: a long prompt is treated as an external *environment* that the model\nexplores through a REPL — examining it, decomposing it, and **recursively calling\nitself (or sub-models) over snippets** instead of swallowing the whole thing at\nonce. This mitigates \"context rot\" and lets effective context exceed the raw\nwindow.\n\nThe idea comes from recent research:\n\n**Paper:**\"Recursive Language Models,\" Alex L. Zhang, Tim Kraska, Omar Khattab (MIT CSAIL), 2025 —[arXiv:2512.24601](https://arxiv.org/abs/2512.24601)**Blog:** Alex L. Zhang, \"Recursive Language Models\" —[https://alexzhang13.github.io/blog/2025/rlm/](https://alexzhang13.github.io/blog/2025/rlm/)**Reference implementation:**[https://github.com/alexzhang13/rlm](https://github.com/alexzhang13/rlm)\n\nTinyAgents is **inspired by and architected around** the RLM execution model — a\nproduction-shaped Rust harness for building RLM-style systems. It does not claim\nto reproduce the paper's benchmark numbers; instead it brings the *execution\nmodel* to Rust as concrete, implemented surfaces:\n\n**Sub-agents (agents calling agents).** A harness agent is exposed*as a tool*to another agent, so orchestration is literally a model calling a model (`SubAgent`\n\n,`SubAgentSession`\n\n,`SubAgentTool`\n\n).**Recursion policy + depth tracking.** The runtime tracks`root_run_id`\n\n/`parent_run_id`\n\n, enforces a recursion limit, and rolls child runs' events, usage, and cost up to the parent as first-class observable runs.**Graphs that run graphs.** A node can embed another compiled graph, and the`.ragsh`\n\nREPL can drive a graph from inside a graph node (graph → REPL → graph).**The REPL as the RLM core.** In`.ragsh`\n\n, context and prompts are runtime*values*, not just prompt text. The model writes small programs, inspects their output, calls sub-models / sub-agents / sub-graphs as functions, and iterates — the RLM/CodeAct loop.**Self-authoring (the deepest recursion).** A model can emit a`.rag`\n\nblueprint that compiles through the*same*registry-bound compiler path as a human-authored file, then runs on the*same*runtime the model is already executing in. The harness can describe and re-enter itself.\n\nTwo languages, one runtime: `.rag`\n\n(declarative blueprint) and `.ragsh`\n\n(imperative REPL) both lower into the exact same `graph`\n\n+ `harness`\n\ntypes as\nhand-written Rust — a language whose programs *are* the runtime that interprets\nthem.\n\n**Harness**— provider-neutral model calls, typed tools, middleware, structured output, streaming, usage/cost accounting, retries and limits, response caching, memory/embeddings, summarization, steering, and a testkit.**Graph runtime**— LangGraph-style durable, typed state graphs:`START`\n\n/`END`\n\n, nodes, edges, conditional routing, commands,`Send`\n\nfanout, reducers/channels, checkpoints, interrupts, subgraphs, streaming, topology export, and time travel.**Registry**— a named capability catalog (models, tools, agents, graphs, stores, middleware, policy) that`.rag`\n\nand`.ragsh`\n\nbind by name.— a declarative, side-effect-free blueprint format that compiles (lexer → parser → compiler) into the runtime; the safe boundary for agent-authored plans.`.rag`\n\nexpressive language— imperative, capability-bound interactive orchestration; the RLM/CodeAct loop surface.`.ragsh`\n\nREPL language**Recursion & sub-agents**— agents-as-tools, subgraphs, depth tracking, and a recursion policy so deep call trees stay bounded and observable.** Durability & checkpoints**— resume long runs, replay history, and travel back in time across superstep boundaries.** Provider-neutral**— one interface across hosted and local providers; swap models without rewriting workflows.** Observability**— normalized events, usage, and cost that roll up across recursive child runs.** Structured output & streaming**— typed responses and incremental token streams at the harness boundary.\n\n```\n            +-----------------------+      +-----------------------+\n            |   .rag blueprint      |      |   .ragsh REPL         |\n            | declarative workflow  |      | imperative RLM loop   |\n            +-----------+-----------+      +-----------+-----------+\n                        \\                              /\n                         \\   compile / lower (by name) /\n                          v                            v\n+-------------+        +-------------------------------------------+\n| Application |------->| Capability Registry                       |\n| Rust code   |        | models | tools | agents | graphs | policy |\n+------+------+        +---------------------+---------------------+\n       |                                     |\n       |                                     v\n       |              +-------------------------------------------+\n       +------------->| Durable Graph Runtime                     |\n                      | typed state | nodes | edges | checkpoints |\n                      +---------------------+---------------------+\n                                            |\n                                            v\n                      +-------------------------------------------+\n                      | Agent Harness                             |\n                      | prompts | tools | middleware | usage/cost |\n                      +----+--------------------------+-----------+\n                           |                          |\n                           v                          v\n                 +------------------+        +------------------+\n                 | Model Providers  |        | Typed Tools      |\n                 | OpenAI/Anthropic |        | local functions  |\n                 | Ollama/etc.      |        | external systems |\n                 +------------------+        +------------------+\n```\n\nThe recursion loop — agents call agents, and graphs run graphs:\n\n```\n        +-------+\n        | START |\n        +---+---+\n            |\n            v\n      +-------------+        a sub-agent is just a tool,\n      | Agent Node  |        and a tool may itself be a\n      +------+------+        whole compiled graph...\n             |\n      +------+-------------------------+\n      |              |                 |\n needs tool     calls sub-agent    done\n      |              |                 |\n      v              v                 v\n+-----------+  +---------------+    +-----+\n| Tool Node |  | SubAgent /    |    | END |\n+-----+-----+  | Subgraph Node |    +-----+\n      |        +-------+-------+\n      |                |  depth +1, recursion policy,\n      |                |  child run rolls up usage/cost\n      +-- loops back --+--- re-enters the runtime ---+\n          to Agent Node     (graph -> REPL -> graph)\n```\n\nAdd TinyAgents to your project:\n\n```\n[dependencies]\ntinyagents = \"0.1\"\n```\n\nThe default build is offline. To enable hosted providers, turn on the `openai`\n\nfeature:\n\n```\n[dependencies]\ntinyagents = { version = \"0.1\", features = [\"openai\"] }\n```\n\nTo explore locally:\n\n```\ngit clone git@github.com:tinyhumansai/rustagents.git\ncd rustagents\ncargo run --example basic_graph\n```\n\nOpenAI-backed examples need the feature flag and an API key:\n\n```\nexport OPENAI_API_KEY=...\ncargo run --features openai --example openai_chat\n```\n\nAll live in [ examples/](/tinyhumansai/tinyagents/blob/main/examples):\n\n— a minimal typed state graph:`basic_graph`\n\n`START`\n\n, nodes, edges,`END`\n\n.— conditional routing, fanout, and richer topology.`complex_graph`\n\n— checkpoints, resume, and time-travel over supersteps.`durable_graph`\n\n— the agent ↔ tool loop the harness runs.`agent_loop_tools`\n\n—`orchestrator_subagents`\n\n**recursion in action:** an orchestrator agent that calls sub-agents as tools, with depth tracking and rolled-up usage.—`openai_self_blueprint`\n\n**the deepest recursion:** a model authors a`.rag`\n\nblueprint that is compiled and run on the same runtime.— load and run a declarative`rag_blueprint`\n\n`.rag`\n\nworkflow.— a single provider-backed chat turn.`openai_chat`\n\n— tool calling against a hosted model.`openai_tools`\n\n— typed structured output.`openai_structured`\n\n— a provider-backed agent driven inside a graph.`openai_graph_agent`\n\nOpenAI-backed examples require `--features openai`\n\nand `OPENAI_API_KEY`\n\n.\n\nContributors working directly in the repository should also read the checked-in\narchitecture specification under [ docs/spec/README.md](/tinyhumansai/tinyagents/blob/main/docs/spec/README.md).\n\n```\ncargo fmt --check\ncargo clippy --all-targets -- -D warnings\ncargo build --all-targets\ncargo test\n```\n\nTinyAgents welcomes focused contributions that improve the graph runtime,\nharness contracts, the registry, the `.rag`\n\n/ `.ragsh`\n\nlanguages, provider\nadapters, tests, examples, and documentation.\n\nRead [CONTRIBUTING.md](/tinyhumansai/tinyagents/blob/main/CONTRIBUTING.md) before opening a pull request.\n\nTinyAgents is licensed under [GPL-3.0-only](/tinyhumansai/tinyagents/blob/main/LICENSE).\n\nBuilt by TinyHumans for the Rust agent ecosystem.", "url": "https://wpnews.pro/news/show-hn-tinyagents-a-rust-based-recursive-llm-harness", "canonical_source": "https://github.com/tinyhumansai/tinyagents", "published_at": "2026-06-30 01:53:15+00:00", "updated_at": "2026-06-30 02:22:34.836375+00:00", "lang": "en", "topics": ["large-language-models", "ai-agents", "ai-research", "developer-tools"], "entities": ["TinyAgents", "Rust", "MIT CSAIL", "Alex L. Zhang", "Tim Kraska", "Omar Khattab", "arXiv"], "alternates": {"html": "https://wpnews.pro/news/show-hn-tinyagents-a-rust-based-recursive-llm-harness", "markdown": "https://wpnews.pro/news/show-hn-tinyagents-a-rust-based-recursive-llm-harness.md", "text": "https://wpnews.pro/news/show-hn-tinyagents-a-rust-based-recursive-llm-harness.txt", "jsonld": "https://wpnews.pro/news/show-hn-tinyagents-a-rust-based-recursive-llm-harness.jsonld"}}