Agent Builder v2 is in open beta. Features and limitations described here are subject to change.
Prepare your environment
Before you begin, make sure you have:- Control Center access with Agent Builder v2 enabled for your organization. Your WRITER contact can confirm this.
- A coding tool: Cursor, Claude Code, or Codex, for MCP-based deploy and environment management.
- Docker installed locally if you build and test container apps.
- Application code as a Worker (
index.js) or a container (Dockerfile). See Prepare your application to decide which. - A GitHub account if you plan to sync a repository when you create the agent or later from the GitHub tab.
Create an agent in Control Center
Start by creating an Agent Builder v2 agent in Control Center. You can sync with GitHub at creation time or start without a repository and connect one later.- Log in to Control Center.
- Go to the Agents tab.
- Select Build an agent.
- Choose how to get started:
- Connect GitHub to import a repository or create a new one. Authenticate if prompted, then select an Owner and a Repo (or Create new repo). Only repositories where you are an admin appear in the list.
- Start manually to create or upload a new application without connecting GitHub yet.

Configure the MCP server in your coding tool
After you create your agent, a Getting started modal guides you through connecting an AI coding tool. Connecting the MCP server gives your tool access to listing environments, deploying code, and managing Vault configuration.- In the Select tools step, choose Cursor, Claude Code, or Codex.
- Select Next, then complete the Set up MCP step for that tool.
Prepare your application
Agent Builder v2 deploys application code as either a JavaScript Worker or a container. Pick one before you prepare your code:- Worker (
index.js, noDockerfile)—the default path for JavaScript or TypeScript apps. Choose this unless you need Python, native dependencies, or a Worker API or compatibility flag the platform doesn’t support. Workers also get platform-provisioned D1 and R2 bindings; see Use bindings in Agent Builder v2. - Container (
Dockerfile)—for Python apps, native dependencies, or anything a Worker’s supported APIs and compatibility flags don’t cover.
Prepare a Worker
Createindex.js at the app root. Bundle TypeScript or npm packages locally first:
Prepare a container
Here is an exampleDockerfile for a Next.js application. Your application must listen on a port other than 8001 (reserved). The default is 8000; if you use a different port, update it in Configure your deployment.
Package the bundle
Package your code as a.tar.gz tarball from the app root so index.js or Dockerfile sits at the top of the archive. On macOS, disable AppleDouble sidecars:
Upload and deploy
You can deploy through GitHub sync, the Control Center UI, or MCP from your coding tool. If a branch is connected with auto-pull enabled, new commits on that branch deploy to the synced environment without a manual upload. Uploads are accepted before the build finishes; the revision moves from queued to building to live (or failed with a reason). Deploy through the Control Center UI- Go to your agent’s Deploy tab.
- Select the Development environment.
- Select Import new snapshot.
- Drag and drop your
.tar.gzfile, or select it to browse. - Select Save.
- Wait for the build to complete. You should see the revision move from queued or building to live, and a development URL appear in the environment panel.
- Open Cursor, Claude Code, or Codex with the MCP server configured and signed in.
- Ask your AI coding agent to deploy the agent to development. Your coding tool packages the tarball and uploads it to the one-time URL the MCP server returns.
- You can also ask it to list environments, show revision history, or report deployment status.
Set Vault secrets
Secrets and configuration live in each environment’s Vault tab. Values are encrypted at rest and injected into the running app. On a Worker they arrive onenv; on a container they arrive as process environment variables.
- In Control Center, select your Development environment.
- Go to the Vault tab.
- Select Add secret.
- Enter the name and value, for example
WRITER_API_KEYorDATABASE_URL. - Save your changes.
env in a Worker without returning its value:
env inside fetch, so a rotated secret is not stuck on a long-lived client.
Test in development
After your build completes, your application is accessible at the development URL shown in the environment detail panel.- The first load can take a few seconds because of cold start (usually longer for containers than for Workers).
- Subsequent requests while the app is warm are fast.
- You can view build logs and deployment status in the version history tab, and server logs in the environment’s Logs tab.
- For Worker apps that use
env.DATABASEorenv.STORAGE, open the environment’s Data tab to browse tables and object storage. See Browse database and object storage in the Data tab.
- Make changes locally.
- If the environment uses GitHub auto-pull, push to the synced branch and wait for the new revision. Do not upload an older local tarball afterward.
- Otherwise rebuild the tarball with the same command as Package the bundle, then upload a new snapshot through the UI or MCP.
- Each upload or auto-pulled commit creates a new version in version history.
- Roll back a non-Production environment to any previous successful version if needed.
Promote to production
When you’re satisfied with your development deployment, promote it to production.- Open the Development environment detail panel.
- Go to the Access tab.
- Select Promote to production.
- Select who can access the production agent:
- Only you for private access.
- Specific teams to select teams from the dropdown.
- All teams to make it available to everyone in your organization.
- Select Promote.
Find your agent in WRITER App
After you promote an agent to production, it appears in the Agents tab in WRITER App. That list includes agents you own and agents that teammates have shared with you.
- Open a production agent to run it.
- See the Version for each agent, which matches the version of that agent’s production environment in Control Center.
- See Views, which shows how many people have viewed the agent in the past 30 days.
- Search and filter by All, Favorites, Tags, or Owned by.
Organize agents with tags
As your library of Agent Builder v2 agents grows, tags help you keep everything organized and find what you need. Tags are personal to you, so you can build a system that matches how you work, whether that’s by use case, project, or any other category that’s useful to you.- Go to the Agents tab in WRITER App.
- Hover over the agent you want to tag and select Add tag.
- Create a new tag or choose an existing one to apply it.
- Select Manage tags in the Tags filter to rename, delete, or recolor tags.

Use bulk actions
You can manage multiple agents at once from the Agents tab. Use the checkboxes next to your agents to open the bulk actions menu, then select Add to favorites or Tag.
Configure your deployment
Each environment has deployment settings that control how a container runs. The defaults work for most container agents; adjust them when you need to tune resources, cold-start behavior, or the port your app listens on. The configuration applies to the environment’s most recent version.- Open the environment detail panel and select Configure deployment.
- Adjust the settings as needed:
- Select Save. The settings apply to the latest version in that environment.

Change the deployment URL
Each environment has a deployment URL you can edit from the environment detail panel. Changing it retires the current URL immediately, so update any bookmarks, API callers, or integrations that still use it.- Open the Agent Builder v2 agent in Control Center.
- Select the environment whose URL you want to change.
- Select the deployment URL at the top of the environment detail panel.
- Review the confirmation. The current URL stops working, and existing links and integrations break until you update them.
- Optionally select Don’t warn me again for this environment if you don’t want this confirmation the next time you edit this environment’s URL.
- Select Yes, edit URL, then enter the new URL and save.

Call your agent via API
In addition to the UI-driven experience in Control Center, Agent Builder v2 supports headless usage. If your application exposes HTTP endpoints, you can call them programmatically from any external service, script, or frontend using an API key. This is useful when you want to:- Embed your agent into another application or product surface.
- Call your agent from a backend service, scheduled job, or CI pipeline.
- Integrate your agent with existing tooling outside Control Center.
Generate an API key
Each environment has its own API keys, so development and production keys are managed separately. An environment API key authenticates machine calls without a user session. New keys default toallowed_paths of /_api and /api; calls outside those prefixes return 403 unless you widen the key’s allowed paths.
- Open your agent in Control Center and select the environment you want to call, such as Development or Production.
- Select the three vertical dots in the environment and select Generate API key.
- Select Generate key.
- Copy the key when it’s displayed. This is the only time the full key is shown, so store it securely in a secrets manager.

Make a request to your agent
Use the environment’s deployment URL as the base URL and pass the API key as a bearer token in theAuthorization header. Call only paths covered by that key’s allowed_paths. Only /api and /_api are valid allowed_paths prefixes—serve your app’s routes under one of those, such as /api/health, so the key can call them.
Manage keys
Each environment has one API key at a time. You can:- Create a key in the Control Center UI when you first need API access for an environment.
- Regenerate a key in the Control Center UI when you need to rotate it. The old key stops working immediately and a new one is issued.
Next steps
- Learn about Agent Builder v2 to understand supported frameworks, environments, and limitations.
- Use bindings in Agent Builder v2 for Worker bindings: D1, R2, queues, and cron triggers.
- Agent Builder v2 observability to review request performance, events, usage, and logs.