open-agents README

The project's README from github.com/vercel-labs/open-agents. As one markdown file: README.md.

Open Agents

Deploy with Vercel

Open Agents is an open-source reference app for building and running background coding agents on Vercel. It includes the web UI, the agent runtime, sandbox orchestration, and the GitHub integration needed to go from prompt to code changes without keeping your laptop involved.

The repo is meant to be forked and adapted, not treated as a black box.

What it is

Open Agents is a three-layer system:

Web -> Agent workflow -> Sandbox VM

The key architectural decision: the agent is not the sandbox

The agent does not run inside the VM. It runs outside the sandbox and interacts with it through tools like file reads, edits, search, and shell commands.

That separation is the main point of the project:

Current capabilities

Runtime notes

A few details that matter for understanding the current implementation:

Environment variables

See apps/web/.env.example for the full list. Summary:

Minimum runtime

POSTGRES_URL=
BETTER_AUTH_SECRET=

Required for sign-in (Vercel OAuth)

NEXT_PUBLIC_VERCEL_APP_CLIENT_ID=
VERCEL_APP_CLIENT_SECRET=

Required for GitHub repo access, pushes, and PRs

NEXT_PUBLIC_GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_APP_ID=
GITHUB_APP_PRIVATE_KEY=
NEXT_PUBLIC_GITHUB_APP_SLUG=
GITHUB_WEBHOOK_SECRET=

Optional

REDIS_URL=
KV_URL=
OPEN_AGENTS_RESOURCE_PROFILE=
VERCEL_PROJECT_PRODUCTION_URL=
NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL=
VERCEL_SANDBOX_BASE_SNAPSHOT_ID=
ELEVENLABS_API_KEY=

Deploy your own copy on Vercel

  1. Fork this repo.

  2. Import the repo into Vercel. Neon Postgres is auto-provisioned if you use the deploy button above.

  3. Generate a secret for session signing:

    openssl rand -base64 32   # BETTER_AUTH_SECRET
    
  4. Add env vars in Vercel project settings:

    POSTGRES_URL=
    BETTER_AUTH_SECRET=
    
  5. Deploy once to get a stable production URL.

  6. Create a Vercel OAuth app with callback URL:

    https://YOUR_DOMAIN/api/auth/callback/vercel
    
  7. Add these env vars and redeploy:

    NEXT_PUBLIC_VERCEL_APP_CLIENT_ID=
    VERCEL_APP_CLIENT_SECRET=
    
  8. If you want the full GitHub-enabled coding-agent flow, create a GitHub App using:

    • Homepage URL: https://YOUR_DOMAIN
    • Callback URL: https://YOUR_DOMAIN/api/auth/callback/github
    • Setup URL: https://YOUR_DOMAIN/api/github/app/callback

    In the GitHub App settings:

    • use the GitHub App's Client ID and Client Secret for NEXT_PUBLIC_GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET
    • make the app public if you want org installs to work cleanly
  9. Add the GitHub App env vars and redeploy.

  10. Optionally add Redis/KV, OPEN_AGENTS_RESOURCE_PROFILE=hobby for Hobby-compatible resource defaults, the canonical production URL vars, and your own VERCEL_SANDBOX_BASE_SNAPSHOT_ID if you want fresh sandboxes to start from a preconfigured image.

Local setup

  1. Install dependencies:

    corepack enable
    pnpm install
    
  2. Create your local env file:

    cp apps/web/.env.example apps/web/.env
    
  3. Fill in the required values in apps/web/.env.

  4. Start the app:

    pnpm web
    

If you already have a linked Vercel project, you can pull env vars locally with vc env pull.

OAuth and integration setup

Vercel OAuth

Authentication is handled by Better Auth with Vercel and GitHub as social providers. All auth routes are served from the /api/auth/[...all] catchall.

Create a Vercel OAuth app and use this callback:

https://YOUR_DOMAIN/api/auth/callback/vercel

For local development, use:

http://localhost:3000/api/auth/callback/vercel

Then set:

NEXT_PUBLIC_VERCEL_APP_CLIENT_ID=...
VERCEL_APP_CLIENT_SECRET=...

GitHub App

You do not need a separate GitHub OAuth app. Open Agents uses the GitHub App's OAuth credentials as a Better Auth social provider, plus the App's installation tokens for repo access.

Create a GitHub App for installation-based repo access and configure:

For local development, use http://localhost:3000 as the homepage URL, http://localhost:3000/api/auth/callback/github as the callback URL, and http://localhost:3000/api/github/app/callback as the setup URL.

Then set:

NEXT_PUBLIC_GITHUB_CLIENT_ID=...   # GitHub App Client ID
GITHUB_CLIENT_SECRET=...           # GitHub App Client Secret
GITHUB_APP_ID=...
GITHUB_APP_PRIVATE_KEY=...
NEXT_PUBLIC_GITHUB_APP_SLUG=...
GITHUB_WEBHOOK_SECRET=...

GITHUB_APP_PRIVATE_KEY can be stored as the PEM contents with escaped newlines or as a base64-encoded PEM.

Useful commands

pnpm web                    # run dev server
pnpm check                  # lint + format check
pnpm fix                    # lint + format fix
pnpm typecheck              # typecheck all packages
pnpm run ci                 # full CI: check, typecheck, tests, migration check
pnpm sandbox:snapshot-base  # refresh sandbox base snapshot

Repo layout

apps/web         Next.js app, workflows, auth, chat UI
packages/agent   agent implementation, tools, subagents, skills
packages/sandbox sandbox abstraction and Vercel sandbox integration
packages/shared  shared utilities

open-agents (vercel-labs/open-agents)

Searching Database…

这是什么?Open Agents 是一个开源参考应用,用于在 Vercel 上构建和运行后台编程智能体,包括网页界面、智能体运行时、沙箱编排,以及从提示词到代码修改所需的 GitHub 集成。
这是现成的产品,还是需要我自己部署的模板?这是一个模板,设计目的是让你 Fork 后进行修改和适配,而不是当作黑盒直接使用。你需要 Fork 它、把自己的副本部署到 Vercel,并根据需要进行定制。
怎样才能把它运行起来?Fork 仓库并将其导入 Vercel(会自动配置 Neon Postgres),生成会话密钥,添加所需的环境变量,创建 Vercel OAuth 应用,然后部署。如需本地开发,使用 pnpm 安装依赖,复制 env 示例文件并填写各项配置,然后运行 dev 脚本。
使用它需要 Vercel 账号和 GitHub App 吗?需要。OAuth 登录和托管都需要 Vercel 账号;完整的编程智能体流程需要 GitHub App,用于克隆仓库、推送代码和创建 PR;只有想使用语音输入时才需要 ElevenLabs 密钥。
智能体是在沙箱虚拟机里运行的吗?不是。智能体在沙箱外运行,通过文件读取、编辑、搜索和 shell 命令等工具与沙箱交互。这是项目的核心架构决定,目的是让虚拟机只作为纯粹的执行环境。
沙箱空闲时会怎样?沙箱在无活动一段时间后会休眠,并可以从快照恢复,因此在智能体两轮操作之间,执行环境无需一直保持运行。
它支持语音输入吗?支持。可选通过 ElevenLabs 转写功能实现语音输入。
我能和别人分享正在运行的智能体会话吗?可以。会话可以通过只读链接分享,让其他人查看智能体的进度。
Size
10.8 MB
Stars
5.8K
Updated
CommitJun 04
Age
9mo
Commits · 90 Days