{"slug": "show-hn-a-tiny-shell-agent-in-rust", "title": "Show HN: A tiny shell agent in Rust", "summary": "A developer has released nano-agent, a lightweight shell agent written in Rust that interfaces with any OpenAI-compatible API to execute commands with user approval. The tool, available via Cargo install, offers both one-shot prompting and an interactive REPL mode, with features including MCP tool support, planning mode, and optional sandboxing via bwrap. The agent requires explicit user approval before running any command, positioning it as a security-conscious alternative for developers seeking AI-assisted terminal operations.", "body_md": "A tiny shell agent in Rust. Talks to any OpenAI-compatible API, runs commands with your approval, and stays out of the way.\n\n```\ncargo install --path .\nexport OPENAI_API_KEY=sk-...\n\nnano-agent \"what's in this repo?\"\n```\n\nThat's it. Run `nano-agent`\n\nwith no arguments for an interactive REPL.\n\n```\nnano-agent \"fix the failing test\"   # one-shot prompt\nnano-agent                          # REPL\nnano-agent -c                       # continue last session here\nnano-agent -s                       # pick a recent session\n```\n\nEvery command the agent wants to run is shown first:\n\n``` bash\n$ cargo test\nApprove? [y] Approve  [a] Approve All  [n] Deny:\n```\n\nIn the REPL: `:q`\n\nquits, `:reset`\n\nstarts over, end a line with `\\`\n\nfor multiline.\n\nPoint it anywhere with an OpenAI-compatible API:\n\n```\nexport OPENAI_BASE_URL=http://localhost:11434/v1   # e.g. Ollama\nexport OPENAI_MODEL=gemma4\n```\n\nOr keep providers in `~/.config/nano/config.json`\n\n(or `./nano_config.json`\n\n):\n\n```\n{\n  \"provider\": \"local\",\n  \"custom_providers\": {\n    \"local\": {\n      \"provider_type\": \"openai\",\n      \"base_url\": \"http://localhost:11434/v1\",\n      \"api_key\": \"\",\n      \"model\": \"gemma4\"\n    }\n  }\n}\n```\n\nSee [example_config.json](/skorotkiewicz/nano-agent/blob/main/example_config.json) for the full format.\n\n**MCP tools**— add servers under`mcp_servers`\n\nin the config; their tools are exposed to the model automatically.**Planning mode**— prefix a message with`/mito`\n\nto talk to a separate local planning agent that prepares a detailed handoff before the main model acts (enable`mito-mode`\n\nin the config).**ACP**— build with`--features acp`\n\nto run nano as an ACP stdio agent (`nano-agent --acp`\n\n) or to delegate subtasks to child agents configured under`acp_agents`\n\n. A child's`working_directory`\n\nis its sandbox boundary; without one, its tools are disabled.\n\nUseful environment variables: `OPENAI_API_KEY`\n\n, `OPENAI_BASE_URL`\n\n, `OPENAI_MODEL`\n\n, `NANO_MAX_STEPS`\n\n, `NANO_SANDBOX=0`\n\n(disable bwrap sandboxing).\n\n```\ncargo test\ncargo test --features acp\n```\n\n", "url": "https://wpnews.pro/news/show-hn-a-tiny-shell-agent-in-rust", "canonical_source": "https://github.com/skorotkiewicz/nano-agent", "published_at": "2026-06-11 21:28:11+00:00", "updated_at": "2026-06-11 21:50:08.545340+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "large-language-models", "artificial-intelligence", "ai-products"], "entities": ["nano-agent", "OpenAI", "Ollama", "Rust", "MCP"], "alternates": {"html": "https://wpnews.pro/news/show-hn-a-tiny-shell-agent-in-rust", "markdown": "https://wpnews.pro/news/show-hn-a-tiny-shell-agent-in-rust.md", "text": "https://wpnews.pro/news/show-hn-a-tiny-shell-agent-in-rust.txt", "jsonld": "https://wpnews.pro/news/show-hn-a-tiny-shell-agent-in-rust.jsonld"}}