Skip to main content
Agent Builder v2 is in open beta. Features and limitations described here are subject to change.
This guide shows you how to deploy your first agent with Agent Builder v2. After completing these steps, you can create an agent in Control Center, optionally sync it with GitHub, connect your coding tool, deploy from your coding tool or the UI, test in a development environment, and promote to production.

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.
  1. Log in to Control Center.
  2. Go to the Agents tab.
  3. Select Build an agent.
  4. 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.
Control Center generates an agent with a unique ID and a development environment.
If you chose Start manually, connect GitHub later from the agent’s GitHub tab.
After the repository is connected, create a branch to sync. Connecting a branch deploys that branch’s current commit. Turn on Auto-pull from remote to pull when new commits appear on the remote branch. Auto-pulled commits are never promoted to production automatically.
GitHub’s authorization screen, including Request for organizations that require third-party access approval, appears only the first time you connect your GitHub account. If you join an organization later that needs that approval, select Disconnect account, then connect again to request access.

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.
  1. In the Select tools step, choose Cursor, Claude Code, or Codex.
  2. Select Next, then complete the Set up MCP step for that tool.
The MCP configuration looks like this:
Adding the server only registers it. Sign in separately when your client prompts you (for example, Cursor Settings > MCP > Authenticate, or Claude Code /mcp > Connect). OAuth tokens refresh automatically after you sign in.

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, no Dockerfile)—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

Create index.js at the app root. Bundle TypeScript or npm packages locally first:
For more information on Worker bindings, such as the platform-provisioned database and object storage, see Use bindings in Agent Builder v2.

Prepare a container

Here is an example Dockerfile 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
  1. Go to your agent’s Deploy tab.
  2. Select the Development environment.
  3. Select Import new snapshot.
  4. Drag and drop your .tar.gz file, or select it to browse.
  5. Select Save.
  6. 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.
Deploy through MCP from your coding tool
  1. Open Cursor, Claude Code, or Codex with the MCP server configured and signed in.
  2. 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.
  3. You can also ask it to list environments, show revision history, or report deployment status.
You should see a successful Development revision and a working preview URL before you promote.

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 on env; on a container they arrive as process environment variables.
  1. In Control Center, select your Development environment.
  2. Go to the Vault tab.
  3. Select Add secret.
  4. Enter the name and value, for example WRITER_API_KEY or DATABASE_URL.
  5. Save your changes.
Confirm a secret is present on env in a Worker without returning its value:
If a new secret doesn’t show up right away, redeploy the environment to pick it up. Containers pick up Vault writes on restart. Development and production environments have separate secrets—set production values in production’s Vault after you promote. Create clients that read secrets from 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.DATABASE or env.STORAGE, open the environment’s Data tab to browse tables and object storage. See Browse database and object storage in the Data tab.
To iterate on your code:
  1. Make changes locally.
  2. 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.
  3. Otherwise rebuild the tarball with the same command as Package the bundle, then upload a new snapshot through the UI or MCP.
  4. Each upload or auto-pulled commit creates a new version in version history.
  5. 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.
  1. Open the Development environment detail panel.
  2. Go to the Access tab.
  3. Select Promote to production.
  4. 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.
  5. Select Promote.
Agent Builder v2 creates a separate production environment with its own URL, Vault secrets, and version history. Making an environment public also requires your organization’s public-sharing policy and public-deployment capability. After you promote, you should see a Production URL in Control Center, and the agent appears in the Agents tab in WRITER App for you and anyone you shared it with.

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. From the Agents tab you can:
  • 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.
  1. Go to the Agents tab in WRITER App.
  2. Hover over the agent you want to tag and select Add tag.
  3. Create a new tag or choose an existing one to apply it.
  4. Select Manage tags in the Tags filter to rename, delete, or recolor tags.
You can apply multiple tags to a single agent if it fits more than one category. Tags only apply to your view of agents.

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.
Use tags to create a personal organizational system that grows with your agent library. Grouping by workflow type, project, or how often you use an agent can help you find the right one faster.

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.
  1. Open the environment detail panel and select Configure deployment.
  2. Adjust the settings as needed:
  1. Select Save. The settings apply to the latest version in that environment.
Development and production each have their own deployment configuration, so you can tune them independently.

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.
  1. Open the Agent Builder v2 agent in Control Center.
  2. Select the environment whose URL you want to change.
  3. Select the deployment URL at the top of the environment detail panel.
  4. Review the confirmation. The current URL stops working, and existing links and integrations break until you update them.
  5. 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.
  6. 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 to allowed_paths of /_api and /api; calls outside those prefixes return 403 unless you widen the key’s allowed paths.
  1. Open your agent in Control Center and select the environment you want to call, such as Development or Production.
  2. Select the three vertical dots in the environment and select Generate API key.
  3. Select Generate key.
  4. 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 the Authorization 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.
The request and response shape is whatever your application defines. Agent Builder v2 doesn’t enforce a specific schema.

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