# OpenAgent [![CI](https://github.com/muhtalhakhan/open-agent/actions/workflows/ci.yml/badge.svg)](https://github.com/muhtalhakhan/open-agent/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Milestones](https://img.shields.io/badge/roadmap-milestones-blueviolet)](../../milestones) An open-source, self-hosted AI agent that can use your computer, browser, files, tools, and APIs. OpenAgent is a provider-agnostic AI agent platform designed to give users control over their own AI agents. Bring your own API key. Choose your model. Run locally or remotely. ## Why AI shouldn't be locked to one provider. Today, powerful computer-using agents are increasingly available as closed platforms tied to a single vendor's models and infrastructure. OpenAgent aims to provide an open alternative where users control the model, infrastructure, tools, data, and permissions. ## What can it do? | | Capability | Status | | --- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | 🌐 | Browse the web | βœ… Built β€” `tools-browser`, backed by browser-use's MCP server (14 tools: navigate, click, type, scroll, extract content, tabs, ...) | | πŸ–₯️ | Control a computer | βœ… Built β€” `tools-computer`, backed by `@ui-tars/sdk` (screenshot β†’ prediction β†’ mouse/keyboard loop) | | πŸ”§ | Use external tools and MCP servers | βœ… Built β€” generic MCP stdio client in `tools-mcp`, used by both browser and computer tools | | πŸ”Ž | Search the web | βœ… Built β€” `tools-search`'s `web_search`, over Brave or Tavily, standalone (no browser needed) | | πŸ“° | Read a web page without a browser | βœ… Built β€” `tools-http`'s `fetch_url`: a page's readable text, local addresses refused, every redirect vetted | | πŸ”Œ | Call any HTTP API directly | βœ… Built β€” `tools-http`'s `http_request`, with a host allowlist, secret placeholders, and a response-size ceiling | | πŸ“„ | Read and edit files in a workspace | βœ… Built β€” `tools-files`: read, write, edit, list and search, confined to one root, with a policy that keeps secrets (`.env`, keys) unreadable | | 🧠 | Remember information across tasks | βœ… Built β€” `memory` package, pluggable across Supermemory / mem0 / in-memory | | πŸ‘οΈ | Look at images | βœ… Built β€” `tools-vision`'s `view_image`: screenshots, charts and photos read by a vision model on your endpoint | | πŸ“ | Keep a plan for multi-step work | βœ… Built β€” `tools-todo`'s `todo_write`: a checklist the agent updates as it goes, shown live in the CLI and web UI | | πŸ” | Ask for permission before sensitive actions | βœ… Built β€” every tool declares a `safe` / `ask` / `dangerous` permission level, enforced by the agent loop | | 🧠 | Use any model | βœ… Built β€” Anthropic and Gemini adapters, any OpenAI-compatible endpoint (OpenRouter, Ollama, LM Studio, vLLM, ...), and `ProviderFallbackAdapter` for multi-provider failover | | πŸ“‹ | Follow project-specific conventions | βœ… Built β€” an `AGENTS.md` at the repo root is loaded into the system prompt automatically | | 🎭 | Switch between agent profiles | βœ… Built β€” named model + tool sets: `--profile ` in the CLI, or create, edit and pick one in the web UI's Profiles view | | 🌿 | Use git: status, diff, log, commit, branch | βœ… Built β€” `tools-git`: reads are `safe`, commits and branch changes ask first; hooks never run and the file policy keeps secrets out of diffs and history | | πŸͺ | Run your own hooks around tool calls | βœ… Built β€” `~/.openagent/hooks.json`: commands before and after each tool call and at session start/stop; a `pre_tool_call` hook can block a call (never approve one) | | πŸ’» | Run code and terminal commands | βœ… Built β€” `tools-terminal`: `run_command` plus background processes, sandboxed with bubblewrap or Docker (read-only filesystem, no network by default) | | πŸ€– | Run non-interactively in CI | βœ… Built β€” `open-agent -p ""` prints the answer to stdout and exits with a status code | | 🧡 | Work in the background | βœ… Built β€” `:bg ` in the CLI runs a task while you keep working; `:jobs` and `:cancel` manage it | | πŸ•˜ | Look back at past tasks | βœ… Built β€” `open-agent --history` and `:history` list recent tasks across saved sessions | | πŸ”‘ | Keep API keys out of plain files | βœ… Built β€” `SECRET_STORE=keychain` reads credentials from the macOS Keychain or the Linux Secret Service | | ⏰ | Run scheduled tasks | 🟑 Library β€” `@open-agent/automation`: one-time and recurring (cron/interval) tasks, a job queue with retries, and notifications; not yet a CLI command | | πŸ€– | Operate autonomously with configurable limits | 🟑 Partly β€” permission levels, approvals, sandboxing and prompt-injection defenses are in (Milestone 9); remote/cloud agents are Milestone 10 | A CLI is available today (`npm run cli`), and a browser UI (`npm run web`) with chat, task history, approvals, live tool output, memory, settings and agent profile management, and a live browser view. See the [milestones](../../milestones) for the full roadmap and what's currently in progress. ## Provider-agnostic by design OpenAgent is not tied to a single AI provider. Any OpenAI-compatible endpoint works today via `OpenAiCompatibleProvider` β€” that already covers OpenAI, OpenRouter, Ollama, LM Studio, and self-hosted vLLM. Providers whose API shape diverges get a dedicated adapter: - Anthropic β€” βœ… `AnthropicProvider` - Google Gemini β€” βœ… `GeminiProvider` - xAI β€” 🚧 planned - DeepSeek β€” 🚧 planned Configure several at once with `ProviderFallbackAdapter`: it tries adapters in order and falls through to the next on 401/403/429 (account problems) and 408/502/503/504/529 (provider down or overloaded), so a rate-limited, overloaded, or misconfigured provider doesn't take the agent down. See `packages/providers/src/fallback-provider.ts`. The agent runtime doesn't care which model powers it β€” a provider is just a config value. ## Headless / CI mode Run a single task without a terminal, for scripts and CI jobs: ```bash open-agent -p "summarize the failing tests" # task inline echo "summarize the failing tests" | open-agent -p # task on stdin ``` - **stdout is just the answer.** Progress, warnings and errors go to stderr, so `open-agent -p "..." > answer.txt` captures the result and nothing else. - **Exit codes**: `0` completed, `1` failed, `130` cancelled (Ctrl+C) β€” so `&&` chaining and CI gates work as expected. - **Approvals default to deny.** With no human to answer a prompt, an `ask`-level tool call is refused and the reason goes to stderr; pass `--yes` to approve them. `dangerous` tools stay blocked either way, since they require being enabled by name. ## Project conventions (`AGENTS.md`) Drop an `AGENTS.md` at the repo root and the agent reads it at session start, folding it into the system prompt so you don't restate project rules every session: ```markdown # Conventions - Prefer `node:test` over adding a test runner dependency. - Never edit files under `generated/` by hand. ``` - **Where it looks.** The repo root only β€” the directory containing `.git`, found by walking up from the working directory. Conventions govern a repo, so they shouldn't change based on which subdirectory you started the CLI from. Nested `AGENTS.md` files are ignored. - **Which file wins.** `.openagent/instructions.md` takes precedence over `AGENTS.md`, letting you keep OpenAgent-specific instructions separate from an `AGENTS.md` shared with other tools. They are alternatives, not layers β€” the winner is used whole and the other is ignored. - **Authority.** Conventions are framed as losing to a direct instruction from you, so a stale line in a checked-in file can't outrank what you're asking for right now. - **Size.** Capped at 32 KiB. These ride along on every request, so a runaway file would crowd out the task itself; anything longer is truncated with a marker. Loading is reported on startup, since a file that silently steers every turn is worth surfacing. ## Run it yourself OpenAgent is designed for: - Local computers - Docker - Self-hosted servers - VPS environments - Cloud infrastructure Your API keys, files, browser profiles, and agent data can remain under your control. ## Project status OpenAgent has a working agent runtime, tool calling, browser automation, computer control, web search, direct HTTP calls, pluggable memory, sandboxed file and terminal tools, git tools, background jobs, task history, and scheduling as a library. Interactive sessions stream answers as they are generated, and both the CLI and the web UI support agent profiles; the web UI also covers chat, history, approvals and settings. Remote/cloud agents are still ahead. Progress by milestone (issues closed / total), regenerated from the tracker by [`docs-status.yml`](.github/workflows/docs-status.yml) β€” edit the issues, not the table: | Milestone | Done | State | | -------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | | 0 β€” Foundation | 10 / 10 | βœ… Complete | | 1 β€” Agent Runtime | 10 / 10 | βœ… Complete | | 2 β€” Model Providers | 10 / 10 | βœ… Complete | | 3 β€” Browser | 10 / 10 | βœ… Complete | | 4 β€” Computer Use | 10 / 10 | βœ… Complete | | 5 β€” Files + Terminal | 10 / 10 | βœ… Complete | | 6 β€” Memory | 8 / 8 | βœ… Complete | | 7 β€” Tools/MCP | 7 / 7 | βœ… Complete | | 8 β€” Automation | 8 / 8 | βœ… Complete | | 9 β€” Security | 10 / 10 | βœ… Complete | | 10 β€” Cloud | 0 / 8 | 🚧 Not started β€” first up: Remote agent (#93), Persistent VM/container (#94), +6 more | | 11 β€” User Interfaces | 15 / 15 | βœ… Complete | | 12 β€” Backlog | 13 / 35 | 🟑 In progress β€” Parallel sub-agents in git worktrees (#122), Agent Client Protocol (ACP) / editor integr… (#125), +20 more left | Recently landed: git tools (#121) β€” status, diff, log, commit and branch, with hooks and repository-chosen drivers kept from running on the host β€” and all of Milestone 11. In the CLI: a live tool-call view (#104), the `open-agent init` setup wizard (#105) and agent profile selection (#106). In the web UI: chat (#107), task history (#108), approvals (#109), live step streaming (#110), memory management (#111), agent profile management (#112), settings (#113) and a live browser view (#114). Nearest up next: Milestone 10, starting with remote agents (#93) and persistent VMs/containers (#94). Security caveat: permission levels, approvals, audit logs, the shell sandbox (#86), throwaway browser profiles (#87), network restrictions (#89), keychain secrets (#88) and prompt-injection fencing (#91) are in place, but they are defenses, not a guarantee. Setting `SHELL_SANDBOX=none` or approving `ask` calls with `--yes` hands the agent your own privileges, and a model can still be misled by content it reads. Review approvals like you would a colleague's command. See [docs/architecture.md](docs/architecture.md), [docs/agent-design.md](docs/agent-design.md), and [docs/security-model.md](docs/security-model.md) for the design docs, and the [milestones](../../milestones) for the live issue-by-issue view. ## Quickstart The fastest way to actually run OpenAgent rather than just read about it: ```bash git clone https://github.com/muhtalhakhan/open-agent cd open-agent npm install npm run cli -- init # asks for the provider, key and tools, checks the model answers, writes .env npm run cli npm run web # or chat in the browser: builds the page, then prints the address to open ``` `init` keeps keys in the OS keychain when there is one, rather than in a plaintext `.env`. To configure by hand instead, `cp .env.example .env` and fill in `OPENAI_BASE_URL` / `OPENAI_API_KEY` / `OPENAI_MODEL` β€” any OpenAI-compatible endpoint works. That starts an interactive terminal session against the real agent loop, tool registry, and (optionally) browser/memory tools β€” see [apps/cli/README.md](apps/cli/README.md) for what it wires up and how. For a single non-interactive run of the original "search the web, summarize, save a report" demo, see [examples/research-and-report.ts](examples/research-and-report.ts) (`npm run example:research`). ## Repository layout ``` apps/ web/ Web UI: a local chat server and its React client (`open-agent web`) cli/ Command-line interface (Ink-based TUI) packages/ context/ Plugin/service kernel the rest of the runtime is built on agent/ Agent loop, session log, tool registry providers/ LLM provider abstraction (OpenAI-compatible, Anthropic, Gemini, fallback) tools-browser/ Browser tools, via browser-use's MCP server tools-computer/ Computer-use tools, via @ui-tars/sdk tools-files/ Filesystem tools confined to a workspace root (read, write, list, search) tools-http/ Direct HTTP requests to arbitrary APIs (http_request) tools-search/ Web search (web_search), over Brave or Tavily tools-terminal/ Sandboxed shell commands and background processes (run_command, start_process, ...) tools-git/ Git status, diff, log, commit and branch, hardened against repository-chosen programs tools-decision/ Typed judgments (classify, check, rank, score) from a DecisionModel β€” Jev today tools-mcp/ Generic MCP stdio client used by the tool packages above registry/ Static index of known MCP tools tools/ Placeholder (README only) automation/ Scheduler, job queue and notifications for one-time and recurring tasks memory/ Long-term/semantic memory (Supermemory, mem0, in-memory) security/ Secret stores (OS keychain); the permission system lives in agent/ docs/ Architecture and design docs tests/ Cross-package/integration tests examples/ Example agent profiles and scripts docker/ Container definitions ``` ## Contributing OpenAgent is intended to be built in public. You don't need to implement the entire system to contribute. Ideas, documentation, testing, integrations, tools, security research, UI improvements, and bug reports are all welcome. See [CONTRIBUTING.md](CONTRIBUTING.md). ## Security An autonomous agent can potentially access files, execute commands, browse authenticated websites, and interact with external services. Security is a core part of OpenAgent, not an optional feature. Never give an agent more permissions than it needs. See [SECURITY.md](SECURITY.md). ## License OpenAgent is open source under the [MIT License](LICENSE).