You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LLM tool framework for AI agents — 31 built-in tools, @tool decorator, persistent REPL, vision, memory. Built for nano-eco.
The Problem
AI agents that can only chat are useless in production. They need to read files, run code, search the web, analyze images, remember context, query databases, and commit to git. Existing frameworks (LangChain, pydantic-ai) ship 100+ dependencies, require complex setup, lock you to one provider, and break on Windows.
nano-tools fixes all of it — one @tool decorator, 31 ready-to-use tools, works with any LLM.
What Makes It Different
Problem with others
nano-tools solution
Complex tool definition — classes, schemas, decorators across 3 files
One @tool decorator — schema auto-generated from type hints + docstring
Framework lock-in — tools only work with LangChain or pydantic-ai
Provider-agnostic — Anthropic + OpenAI format, works with any SDK
No tool-call loop — manage back-and-forth yourself
Stateless code execution — variables lost between calls
Persistent REPL — python_repl keeps state across the entire session
No memory between agent runs
Memory tools — standalone dict or nano-memory backend, semantic search
No vision support
Image analysis — Claude + GPT-4o, auto-routes through nano-proxy
No integration with LLM proxy
nano-proxy integration — 1 env var routes everything
Windows support broken
Windows-first — tested on PowerShell, no POSIX assumptions
Quick Start
# Install
pip install git+https://github.com/ghanibot/nano-tools.git
# With all optional deps
pip install "git+https://github.com/ghanibot/nano-tools.git#egg=nano-tools[all]"# List all 31 built-in tools
nano-tools list
# Run a tool directly
nano-tools run calculator '{"expression": "sqrt(144) * 7"}'
nano-tools run current_datetime '{}'# Ask LLM with tools
nano-tools ask "Read README.md and summarize it" --tools file
nano-tools ask "What is 15% of 3200?" --tools util
nano-tools ask "Show git log for current directory" --tools git
@tool Decorator
Convert any Python function into an LLM-callable tool. Schema auto-generated — no manual JSON.
fromnano_toolsimporttool, ToolKit@tooldefget_stock_price(ticker: str) ->str:
"""Get current stock price for a ticker symbol. ticker: Stock ticker e.g. AAPL, TSLA, MSFT """returnf"{ticker}: $182.50"@tooldefsend_notification(channel: str, message: str) ->str:
"""Send a notification to a Slack channel. channel: Slack channel name e.g. #alerts message: Message text to send """returnf"Sent to {channel}: {message}"kit=ToolKit([get_stock_price, send_notification])
# Run with full tool-call loop — handles multi-step automaticallyresult=kit.run_loop(
"Check AAPL price and send it to #alerts",
model="claude-haiku-4-5-20251001",
)
print(result)
All 31 Built-in Tools
📁 File Tools
fromnano_tools.builtinimportFILE_TOOLS
Tool
What it does
read_file(path)
Read file, truncates at 16k chars
write_file(path, content)
Write file, auto-creates parent dirs
list_files(directory)
List files + sizes in directory
append_file(path, content)
Append to existing file
💻 Code Tools
fromnano_tools.builtinimportCODE_TOOLS
Tool
What it does
run_python(code)
Execute Python in subprocess, isolated, 30s timeout
run_shell(command)
Run shell command, 30s timeout
🔁 REPL Tools — Persistent State
fromnano_tools.builtinimportREPL_TOOLS
Tool
What it does
python_repl(code)
Persistent Python REPL — variables survive between calls
repl_vars()
List all variables in current REPL session
repl_reset()
Clear REPL state, start fresh
# Variables persist across calls within one session:kit.run_loop("Define x=100 and y=[1,2,3] using python_repl")
kit.run_loop("Now print x + sum(y) using python_repl") # → 106
importosfromnano_tools.integrationsimporttoolkit_with_proxyfromnano_tools.builtinimportALL_TOOLSkit=toolkit_with_proxy(ALL_TOOLS)
# LLM calls: nano-cache → nano-proxy → best available provider# Memory: persisted to nano-memory SQLite store# Cost: tracked in nano-proxy cost reportresult=kit.run_loop("Analyze the repo, write a summary, commit it")
Or use run_loop_openai to target Groq, Mistral, Ollama:
result=kit.run_loop_openai(
"Search the web and summarize AI news",
model="llama-3.1-70b-versatile",
base_url="http://localhost:8765/groq/v1",
)
Integration with nano-orchestrator
fromnano_toolsimportToolKitfromnano_tools.builtinimportFILE_TOOLS, WEB_TOOLS, GIT_TOOLSfromnano_tools.integrationsimporttoolkit_to_agent_context, export_tool_schemaskit=ToolKit(FILE_TOOLS+WEB_TOOLS+GIT_TOOLS)
# System prompt for agentsystem=toolkit_to_agent_context(kit)
# Export schemas → load in orchestrator configexport_tool_schemas(kit, "tool_schemas.json")
# nano-orchestrator pipeline.yamlagents:
- id: dev-agenttype: claude-codetask: | Research best practices for the feature, implement it, write tests, and commit the result. Tools available: read_file, write_file, web_search, git_commit
nano-orchestrator — coordinate multi-agent pipelines
│
├── nano-tools ← you are here (31 tools for any agent)
│ ├── memory tools ──────────────────────────────┐
│ └── vision tools ──────────────────────────────┤
│ ▼
├── nano-memory — persistent memory (nano-memory backend)
│
└── all LLM calls
└── nano-cache → nano-proxy → Anthropic/OpenAI/Groq/Gemini/Ollama/Mistral
CLI Reference
nano-tools list # List all 31 tools
nano-tools run <tool>'<json>'# Run tool directly
nano-tools schema <tool> --format openai # Print JSON schema
nano-tools ask "<prompt>" --tools all # all|safe|file|code|repl|web|util|doc|git|vision|memory
nano-tools ask "<prompt>" --proxy http://... # Route through nano-proxy
nano-tools ask "<prompt>" --model gpt-4o-mini # Custom model
Environment Variables
ANTHROPIC_API_KEY=sk-ant-... # for Claude tools
OPENAI_API_KEY=sk-... # for OpenAI vision + run_loop_openai
NANO_PROXY_URL=http://localhost:8765 # route all LLM calls through nano-proxy
NANO_MEMORY_NS=my-agent # persist memory tools to nano-memory