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

# CLI Command Reference

> Complete reference for the DataGen CLI

## Installation

```bash theme={null}
curl -fsSL https://cli.datagen.dev/install.sh | sh
```

Windows:

```powershell theme={null}
irm https://cli.datagen.dev/install.ps1 | iex
```

Verify: `datagen --help`

***

## `datagen login`

Authenticate with DataGen via browser OAuth or API key.

```bash theme={null}
datagen login
datagen login --api-key "your-key"
```

| Flag        | Short | Type   | Default           | Description                             |
| ----------- | ----- | ------ | ----------------- | --------------------------------------- |
| `--api-key` |       | string |                   | API key (skips browser login)           |
| `--shell`   |       | string |                   | Shell type: bash, zsh, fish, powershell |
| `--profile` |       | string |                   | Shell profile file to update            |
| `--env`     |       | string | `DATAGEN_API_KEY` | Environment variable name               |
| `--yes`     | `-y`  | bool   | false             | Skip confirmation prompts               |
| `--print`   |       | bool   | false             | Print export command only               |

***

## `datagen mcp`

Configure the DataGen MCP server in local tools (Codex, Claude, Gemini).

```bash theme={null}
datagen mcp
datagen mcp --clients claude,codex --dry-run
```

| Flag             | Short | Type   | Default               | Description                                |
| ---------------- | ----- | ------ | --------------------- | ------------------------------------------ |
| `--clients`      |       | string | `codex,claude,gemini` | Comma-separated clients to configure       |
| `--api-key`      |       | string |                       | API key (uses env/profile lookup if empty) |
| `--env`          |       | string | `DATAGEN_API_KEY`     | Environment variable to look up            |
| `--yes`          | `-y`  | bool   | false                 | Skip confirmation prompts                  |
| `--dry-run`      |       | bool   | false                 | Show changes without writing               |
| `--codex-static` |       | bool   | false                 | Use static header in Codex config          |

***

## `datagen github`

Manage GitHub connection and repository access.

### `github connect`

Install the DataGen GitHub App via browser.

```bash theme={null}
datagen github connect
```

| Flag        | Type | Default | Description                      |
| ----------- | ---- | ------- | -------------------------------- |
| `--timeout` | int  | 300     | Seconds to wait for installation |

### `github repos`

List all repositories accessible via your GitHub App.

```bash theme={null}
datagen github repos
```

### `github connected`

List repositories already connected to DataGen.

```bash theme={null}
datagen github connected
```

### `github connect-repo`

Connect a specific repository.

```bash theme={null}
datagen github connect-repo owner/repo
```

**Argument:** `<owner/repo>` (required)

### `github sync`

Re-sync agents from a connected repository.

```bash theme={null}
datagen github sync <repo-id>
```

**Argument:** `<repo-id>` (required)

### `github status`

Check GitHub App installation status.

```bash theme={null}
datagen github status
```

***

## `datagen agents`

Manage agents, skills, and commands discovered from GitHub repositories.

### `agents list`

List all discovered agents.

```bash theme={null}
datagen agents list
datagen agents list --type agent --deployed
```

| Flag         | Type   | Default | Description                            |
| ------------ | ------ | ------- | -------------------------------------- |
| `--repo`     | string |         | Filter by repository (owner/repo)      |
| `--type`     | string |         | Filter: `agent`, `skill`, or `command` |
| `--deployed` | bool   | false   | Show only deployed agents              |

### `agents show`

Show detailed info about an agent.

```bash theme={null}
datagen agents show <agent-id>
```

### `agents deploy`

Deploy an agent to DataGen.

```bash theme={null}
datagen agents deploy <agent-id>
```

### `agents undeploy`

Remove an agent deployment and its webhook.

```bash theme={null}
datagen agents undeploy <agent-id>
```

### `agents run`

Trigger an agent execution.

```bash theme={null}
datagen agents run <agent-id>
datagen agents run <agent-id> --payload '{"task": "review PRs"}'
```

| Flag        | Type   | Default | Description              |
| ----------- | ------ | ------- | ------------------------ |
| `--payload` | string | `"{}"`  | JSON payload for the run |

### `agents logs`

View execution history.

```bash theme={null}
datagen agents logs <agent-id>
datagen agents logs <agent-id> --limit 20
```

| Flag      | Type | Default | Description            |
| --------- | ---- | ------- | ---------------------- |
| `--limit` | int  | 10      | Max executions to show |

### `agents output`

Show execution output.

```bash theme={null}
datagen agents output <agent-id>
datagen agents output <agent-id> --execution <exec-id>
```

| Flag          | Type   | Default | Description               |
| ------------- | ------ | ------- | ------------------------- |
| `--execution` | string |         | Specific execution ID     |
| `--session`   | string |         | SDK session ID to look up |
| `--json`      | bool   | false   | Output raw JSON           |

### `agents config`

View or update agent configuration. With no flags, displays current config.

```bash theme={null}
datagen agents config <agent-id>
datagen agents config <agent-id> --set-prompt "Review all open PRs"
datagen agents config <agent-id> --secrets ANTHROPIC_API_KEY,GITHUB_TOKEN
```

| Flag                 | Type   | Default | Description                          |
| -------------------- | ------ | ------- | ------------------------------------ |
| `--set-prompt`       | string |         | Set entry prompt                     |
| `--clear-prompt`     | bool   | false   | Clear entry prompt                   |
| `--secrets`          | string |         | Comma-separated secret names         |
| `--pr-mode`          | string |         | `create_pr`, `auto_merge`, or `skip` |
| `--add-recipient`    | string |         | Add recipient as `email[:role]`      |
| `--remove-recipient` | string |         | Remove recipient by ID               |
| `--notify-success`   | string |         | `true`, `false`, or `default`        |
| `--notify-failure`   | string |         | `true`, `false`, or `default`        |
| `--notify-reply`     | string |         | `true`, `false`, or `default`        |

### `agents schedule`

Manage cron schedules. With no flags, lists all schedules.

```bash theme={null}
datagen agents schedule <agent-id>
datagen agents schedule <agent-id> --cron "0 9 * * *" --timezone "America/New_York"
datagen agents schedule <agent-id> --pause <schedule-id>
```

| Flag         | Type   | Default | Description                           |
| ------------ | ------ | ------- | ------------------------------------- |
| `--cron`     | string |         | Cron expression (e.g., `"0 9 * * *"`) |
| `--timezone` | string | `UTC`   | Timezone (e.g., `America/New_York`)   |
| `--name`     | string |         | Optional schedule name                |
| `--pause`    | string |         | Pause a schedule by ID                |
| `--resume`   | string |         | Resume a schedule by ID               |
| `--delete`   | string |         | Delete a schedule by ID               |

***

## `datagen skills` / `datagen commands`

Aliases for `datagen agents` with type filtering.

```bash theme={null}
datagen skills list        # Same as: datagen agents list --type skill
datagen commands list      # Same as: datagen agents list --type command
```

All `agents` subcommands are available (show, deploy, undeploy, run, logs, output, config, schedule).

***

## `datagen tools`

Manage custom Python tools deployed as API endpoints.

### `tools list`

List all custom tools.

```bash theme={null}
datagen tools list
```

### `tools show`

Show custom tool details including code and schemas.

```bash theme={null}
datagen tools show <tool-uuid>
```

### `tools deploy`

Deploy a new custom tool.

```bash theme={null}
datagen tools deploy my_tool --file ./tool.py --description "My tool"
datagen tools deploy my_tool --code "result = 'hello'" --outputs result
```

**Argument:** `<name>` (required)

| Flag                | Type   | Description                           |
| ------------------- | ------ | ------------------------------------- |
| `--code`            | string | Inline Python code                    |
| `--file`            | string | Path to Python source file            |
| `--schema`          | string | Inline JSON input schema              |
| `--schema-file`     | string | Path to JSON schema file              |
| `--defaults`        | string | Inline JSON default input values      |
| `--defaults-file`   | string | Path to JSON defaults file            |
| `--description`     | string | Tool description                      |
| `--outputs`         | string | Comma-separated output variable names |
| `--tools`           | string | Comma-separated MCP tool names        |
| `--imports`         | string | Comma-separated Python packages       |
| `--no-auto-imports` | bool   | Disable import inference from source  |
| `--mcp-servers`     | string | Comma-separated MCP server names      |
| `--secrets`         | string | Comma-separated secret names          |
| `--public`          | bool   | Deploy as public tool                 |

### `tools update`

Update an existing custom tool.

```bash theme={null}
datagen tools update <tool-uuid> --file ./updated_tool.py
```

Same flags as `tools deploy` (only provided fields are updated).

### `tools run`

Run a custom tool with input.

```bash theme={null}
datagen tools run <tool-uuid> --input '{"domain": "acme.com"}'
datagen tools run <tool-uuid> --input-file ./input.json
```

| Flag           | Type   | Description                 |
| -------------- | ------ | --------------------------- |
| `--input`      | string | Inline JSON input variables |
| `--input-file` | string | Path to JSON input file     |

***

## `datagen secrets`

Manage API keys and secrets for agents and tools.

### `secrets list`

List all stored secrets (values are masked).

```bash theme={null}
datagen secrets list
```

### `secrets set`

Create or update a secret.

```bash theme={null}
datagen secrets set OPENAI_API_KEY=sk-abc123     # Explicit value
datagen secrets set OPENAI_API_KEY                # Read from environment
```

**Argument:** `<KEY=VALUE>` or `<KEY>` (required)

***

## Environment Variables

| Variable               | Default                   | Description                            |
| ---------------------- | ------------------------- | -------------------------------------- |
| `DATAGEN_API_KEY`      |                           | API authentication key                 |
| `DATAGEN_API_BASE_URL` | `https://api.datagen.dev` | Custom API server                      |
| `DATAGEN_WEB_BASE_URL` | `https://datagen.dev`     | Custom web app URL                     |
| `DATAGEN_VERSION`      |                           | Pin CLI release version during install |
| `DATAGEN_INSTALL_DIR`  |                           | Custom install location                |
