Hacker News

liyuanhao
Show HN: Yoagent – Build a coding agent CLI in 260 lines of Rust github.com

liyuanhaoop10 hours ago

Hi HN, I'm Yuanhao.

I pointed this agent at its own source code and told it to add a new command. It read itself, edited itself, recompiled, and the command worked. The agent is 260 lines of Rust.

The core idea is that an agent is just a loop:

  Prompt → LLM → Tool calls → Execute → Repeat
yoagent is that loop as a Rust library. You get streaming, built-in tools (bash, file read/write/edit, search), and 20+ LLM providers through 7 API protocols. The CLI example is ~260 lines and I can use it for real work.

The thing I'm most proud of: swap --model and the same 260 lines talk to Claude, GPT, Gemini, Llama via Groq, DeepSeek, or Mistral. One trait (StreamProvider), one implementation for all OpenAI-compatible providers with per-provider quirk flags. Adding a new provider is one file.

No framework to learn. No planning layers, no RAG, no reflection loops. Two traits define everything: StreamProvider (how to talk to an LLM) and AgentTool (how to execute a tool). Read agent_loop.rs and you understand the whole system.

Honest limitations: no permission management, no git integration, tokio is a hard dependency. This is a library, not a product.

MIT licensed. No telemetry. `cargo add yoagent`.

Happy to answer anything about the architecture.

hn-front (c) 2024 voximity
source