> ## Documentation Index
> Fetch the complete documentation index at: https://datagen.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy Your Agent

> Deploy agents, skills, and commands from Claude Code or the web UI

Deploying an agent turns it into a cloud service that runs on webhooks, schedules, or manual triggers. Once deployed, your agent can create PRs, send notifications, and process data automatically.

<Tip>
  **Using Claude Code?** Run `/datagen:deploy-agent` for a guided deployment workflow.
</Tip>

## Push to GitHub

Your agent needs to be in a GitHub repository before deploying.

```bash theme={null}
git add .claude/
git commit -m "Add agent definition"
git push origin main
```

If you don't have a remote yet:

```bash theme={null}
git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/your-username/your-repo.git
git push -u origin main
```

***

## Deploy from Claude Code

Run the deploy command inside Claude Code:

```
/datagen:deploy-agent
```

The plugin will:

1. Scan your agent's dependencies (scripts, tools, secrets)
2. Connect your GitHub repo via the DataGen GitHub App
3. Push required secrets to DataGen
4. Create a webhook endpoint
5. Optionally set up cron schedules

After deployment, you get a webhook URL to trigger your agent externally.

***

## Deploy from the Web UI

<video autoPlay muted loop playsInline src="https://pub-695bd4b06c544fb8ae16ec8549d2a362.r2.dev/blog/clay-tutorial-deploy.mp4" style={{borderRadius: '8px', width: '100%'}} />

### Step 1: Connect Your GitHub Repository

<Steps>
  <Step title="Go to the Agents Page">
    Navigate to the **Agents** page in DataGen.
  </Step>

  <Step title="Click Connect Repository">
    Click **Connect Repository** to start the setup.

    <Frame>
      <img src="https://mintcdn.com/datagen/LWL3BGYwXkq1W4fz/images/agents/connect-repo-button.png?fit=max&auto=format&n=LWL3BGYwXkq1W4fz&q=85&s=ff1be3ef5b4e40c1dc364b21b388ca79" alt="Connect Repository button" width="1501" height="791" data-path="images/agents/connect-repo-button.png" />
    </Frame>
  </Step>

  <Step title="Install GitHub App">
    Click **Install GitHub App** and authorize DataGen to access your repositories.
  </Step>

  <Step title="Select Your Repository">
    Choose the GitHub account/organization and select the repositories you want to connect.
  </Step>
</Steps>

### Step 2: Deploy an Agent

DataGen automatically discovers agents, skills, and commands from your repository's `.claude/` directory.

<Steps>
  <Step title="Select Your Agent">
    Click on the agent you want to deploy from the list.

    <Frame>
      <img src="https://mintcdn.com/datagen/LWL3BGYwXkq1W4fz/images/agents/agent-list.png?fit=max&auto=format&n=LWL3BGYwXkq1W4fz&q=85&s=b8e3659c57294772a7d4d71cac9e6844" alt="Agent list showing discovered agents" width="1501" height="791" data-path="images/agents/agent-list.png" />
    </Frame>
  </Step>

  <Step title="Configure Secrets">
    Select which secrets your agent needs. You need either an Anthropic API key or a Claude Code subscription token.

    **Option A: Anthropic API Key** -- Add `ANTHROPIC_API_KEY` in [DataGen Secrets](https://datagen.dev/account?tab=secrets).

    **Option B: Claude Code Subscription (Recommended)** -- Run `claude setup-token` in your terminal, then add the token as `CLAUDE_CODE_OAUTH_TOKEN` in DataGen Secrets.

    <Frame>
      <img src="https://mintcdn.com/datagen/LWL3BGYwXkq1W4fz/images/agents/select-secrets.png?fit=max&auto=format&n=LWL3BGYwXkq1W4fz&q=85&s=0252ed67248152171f2671f1ff17e1b7" alt="Select secrets for deployment" width="1501" height="791" data-path="images/agents/select-secrets.png" />
    </Frame>
  </Step>

  <Step title="Configure Options">
    * **Create Pull Request** -- Enable if you want the agent to submit changes as PRs
    * **Entry Prompt** -- Set a system-level instruction for every execution
  </Step>

  <Step title="Deploy">
    Click **Deploy Agent** to create your deployment.
  </Step>

  <Step title="Copy Webhook URL">
    After deployment, copy the webhook URL for external integrations.

    <Frame>
      <img src="https://mintcdn.com/datagen/LWL3BGYwXkq1W4fz/images/agents/webhook-url.png?fit=max&auto=format&n=LWL3BGYwXkq1W4fz&q=85&s=fb3b8c9beb9e032079471359be0d977e" alt="Webhook URL" width="1501" height="791" data-path="images/agents/webhook-url.png" />
    </Frame>
  </Step>
</Steps>

***

## After Deployment

Once deployed, your agent:

* Has a unique **webhook URL** for triggering via HTTP POST
* Appears in the **Agents** dashboard with run statistics
* Can be configured with [schedules](/guide/schedules), [channels](/guide/channels-overview), and additional secrets

## Troubleshooting

<AccordionGroup>
  <Accordion title="Agent not appearing after connecting repo">
    Make sure your agent file is at `.claude/agents/your-agent.md` and has been pushed to the main branch.
  </Accordion>

  <Accordion title="Agent fails with API key error">
    Ensure you've configured the required secrets (Anthropic API key or Claude Code OAuth token) and selected them during deployment.
  </Accordion>

  <Accordion title="GitHub App not connecting">
    Verify you have admin access to the repository. Try disconnecting and reconnecting the repo.
  </Accordion>
</AccordionGroup>

## Next Step

<Card title="Monitor Agent Runs" icon="chart-line" href="/guide/monitoring">
  View execution logs, tool calls, and agent output
</Card>
