A powerful coding agent with a clean API and beautiful Rich terminal output.
- Simple API - Just
Agent().run("task")and you're done - Streaming Support - See tool calls and progress in real-time
- Permission System - Control what the agent can do (allow/ask/deny)
- Agent Types - Build (full access) and Plan (read-only) agents
- 15 Built-in Tools - File operations, shell commands, web search, and more
- MCP Support - Extend with external tool servers
- Subagent Spawning - Delegate subtasks to child agents
- Rich Output - Beautiful terminal UI with panels, tables, and colors
- Session Management - Forking, compaction, and persistence
curl -fsSL https://raw.githubusercontent.com/freddiev4/rune/main/scripts/install.sh | bashThe installer will:
- Install
uvand Python 3.10 if needed - Clone the repo to
~/.rune/rune/ - Create a virtual environment and install dependencies
- Symlink the
runecommand to~/.local/bin/ - Prompt for your OpenAI / Anthropic API key(s)
Options:
# Skip the API key prompt
curl -fsSL ... | bash -s -- --skip-setup
# Install a specific branch
curl -fsSL ... | bash -s -- --branch my-branch
# Custom install directory
curl -fsSL ... | bash -s -- --dir ~/code/runeManual install:
git clone https://github.com/freddiev4/rune.git ~/.rune/rune
cd ~/.rune/rune
uv venv .venv --python 3.10
uv pip install -e .# Interactive mode
rune
# Single prompt
rune -p "create a hello.py file"
# Read-only agent
rune --agent plan
# Use different model
rune --model openai/gpt-5.2-2025-12-11
# With MCP servers
rune --mcp-config mcp.jsonfrom rune import Agent, AgentConfig
# Simplest usage
agent = Agent()
result = agent.run("List all Python files")
print(result)
# With configuration
agent = Agent(config=AgentConfig(
model="openai/gpt-5.2-2025-12-11",
agent_name="build",
auto_approve_tools=True
))
# Simple run - get final result
result = agent.run("Create a test.py file")
# Streaming - see progress
for turn in agent.stream("Analyze the codebase"):
if turn.tool_calls:
print(f"Using tool: {turn.tool_calls}")
if turn.finished:
print(f"Done: {turn.response}")- build - Full access agent (read, write, execute, spawn subagents)
- plan - Read-only agent (explore, analyze, but cannot modify)
- subagent - Like build but cannot spawn more subagents (prevents recursion)
from rune import Agent, AgentConfig
config = AgentConfig(
model="openai/gpt-4o", # OpenAI model to use
agent_name="build", # Agent type
auto_approve_tools=True, # Auto-approve tool execution
mcp_config_path=None # Path to MCP config JSON
)
agent = Agent(config=config)Rune includes 15 powerful tools:
File Operations:
read_file- Read files with line range supportwrite_file- Create or overwrite filesedit_file- Search and replace in filesmulti_edit- Multiple edits in one callapply_patch- Apply unified diff patcheslist_files- List directory contentsglob- Pattern-based file searchgrep- Regex content search with contexttree- Recursive directory tree
Execution:
shell- Execute shell commands (with approval)
Web:
web_fetch- Fetch URL contentweb_search- Search the web (requires TAVILY_API_KEY)
Organization:
task- Spawn subagent for subtaskstodo- Structured task list managementnotebook_edit- Edit Jupyter notebook cells
Extend Rune with external tool servers using the Model Context Protocol:
{
"servers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/dir"],
"env": {}
}
}
}rune --mcp-config mcp.jsonSee the CLI examples above for usage patterns.
Rune is split into two main layers:
- Agent definitions (
rune/agents.py) � declarative agent types (build/plan/subagent), system prompts, model parameters, and permission sets. - Harness runtime (
rune/harness/) � the orchestration layer that runs the agent loop.
agent.py� core turn-based loop (Agent.stream()), tool routing, subagent spawning, and session compaction.session.py� conversation state, forking (for subagents), compaction, persistence, and token usage tracking.tools.py� built-in tool schemas (TOOL_DEFINITIONS) and theToolExecutorimplementations (filesystem, shell, web_fetch, todo, notebook_edit, etc.).permissions.py� permission model (ALLOW/ASK/DENY) and prebuilt permission sets.mcp_client.py� MCP integration for external tool servers (discover tools, call tools, shutdown).
rune/cli.py� Rich-powered interactive CLI and streaming display of tool calls/results.from rune import Agent, AgentConfig� stable public API re-exported fromrune/__init__.py.
- Turn-based generator loop for streaming results
- Session management with forking and compaction
- Permission-based tool filtering + optional user approval
- Built-in tools + optional MCP-provided external tools
- Subagent spawning for delegated subtasks
# Install for development
uv pip install -e .
# Run tests
pytest
# Format code
ruff check --fix .Agent(
config: AgentConfig | None = None,
approval_callback: Callable | None = None
)Methods:
run(user_input: str) -> str- Run and return final resultstream(user_input: str) -> Generator[TurnResult, None, str]- Stream progressswitch_agent(agent_name: str)- Switch agent typereset()- Reset sessionshutdown()- Clean up resources
AgentConfig(
model: str = "gpt-4o",
agent_name: str = "build",
auto_approve_tools: bool = True,
mcp_config_path: str | None = None
)@dataclass
class TurnResult:
response: str | None
tool_calls: list[dict]
tool_results: list[ToolResult]
finished: bool
agent_name: strMIT
- Built with OpenAI API
- Terminal UI with Rich