> For the complete documentation index, see [llms.txt](https://docs.agenticflow.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agenticflow.ai/reference/nodes/create_cx_agent.md).

# Create CX Agent

**Action ID:** `create_cx_agent`

## Description

Create a CX agent.

## Input Parameters

| Name          | Type   | Required | Default | Description                                                       |
| ------------- | ------ | :------: | ------- | ----------------------------------------------------------------- |
| access\_token | string |     ✓    | -       | The access token to use to create the agent                       |
| workspace\_id | string |     ✓    | -       | The ID of the workspace to create the agent in                    |
| agent\_name   | string |     ✓    | -       | The name of the agent to create                                   |
| data          | object |     ✓    | -       | The data to create the agent with                                 |
| email         | string |     ✓    | -       | The email address to send notifications when the agent is created |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Create agent node runner input.",
  "properties": {
    "access_token": {
      "description": "The access token to use to create the agent.",
      "title": "Access Token",
      "type": "string"
    },
    "workspace_id": {
      "description": "The ID of the workspace to create the agent in.",
      "title": "Workspace ID",
      "type": "string"
    },
    "agent_name": {
      "description": "The name of the agent to create.",
      "title": "Agent Name",
      "type": "string"
    },
    "data": {
      "additionalProperties": true,
      "description": "The data to create the agent with.",
      "title": "Data",
      "type": "object"
    },
    "email": {
      "description": "The email address to send notifications when the agent is created.",
      "title": "Email",
      "type": "string"
    }
  },
  "required": [
    "access_token",
    "workspace_id",
    "agent_name",
    "data",
    "email"
  ],
  "title": "CreateAgentNodeRunnerInput",
  "type": "object"
}
```

</details>

## Output Parameters

| Name | Type   | Description                   |
| ---- | ------ | ----------------------------- |
| data | object | The data of the agent created |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Create agent node runner output.",
  "properties": {
    "data": {
      "additionalProperties": true,
      "description": "The data of the agent created.",
      "title": "Data",
      "type": "object"
    }
  },
  "required": [
    "data"
  ],
  "title": "CreateAgentNodeRunnerOutput",
  "type": "object"
}
```

</details>

## How It Works

This node creates a new CX (Customer Experience) agent within a specified workspace. It authenticates using the provided access token, then submits a request to create an agent with the specified name and configuration data. Upon successful creation, the system sends a notification email to the provided address and returns the agent's data including its ID, configuration, and status. This allows for programmatic agent provisioning in customer service automation workflows.

## Usage Examples

### Example 1: Basic Customer Service Agent

**Input:**

```
access_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
workspace_id: "ws_12345"
agent_name: "Support Bot Alpha"
data: {
  "description": "Customer support agent for product inquiries",
  "language": "en",
  "timezone": "America/New_York"
}
email: "admin@company.com"
```

**Output:**

```
data: {
  "agent_id": "agent_abc123",
  "name": "Support Bot Alpha",
  "status": "active",
  "created_at": "2024-01-15T10:30:00Z"
}
```

### Example 2: Multilingual Sales Agent

**Input:**

```
access_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
workspace_id: "ws_67890"
agent_name: "Sales Assistant Pro"
data: {
  "description": "Sales agent with multilingual support",
  "languages": ["en", "es", "fr"],
  "capabilities": ["product_info", "pricing", "availability"],
  "working_hours": "9am-5pm EST"
}
email: "sales-team@company.com"
```

**Output:**

```
data: {
  "agent_id": "agent_xyz789",
  "name": "Sales Assistant Pro",
  "status": "active",
  "languages": ["en", "es", "fr"],
  "created_at": "2024-01-15T11:00:00Z"
}
```

### Example 3: Technical Support Agent

**Input:**

```
access_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
workspace_id: "ws_11223"
agent_name: "Tech Support Specialist"
data: {
  "description": "Technical support for enterprise customers",
  "specialization": "software_troubleshooting",
  "escalation_enabled": true,
  "max_concurrent_conversations": 5
}
email: "tech-support@company.com"
```

**Output:**

```
data: {
  "agent_id": "agent_def456",
  "name": "Tech Support Specialist",
  "status": "active",
  "specialization": "software_troubleshooting",
  "created_at": "2024-01-15T11:30:00Z"
}
```

## Common Use Cases

* **Automated Customer Support**: Create specialized agents for handling common customer inquiries and support tickets
* **Sales Automation**: Deploy sales agents that can answer product questions and guide customers through purchasing
* **Multi-Workspace Deployment**: Programmatically create agents across multiple workspaces for different teams or departments
* **Dynamic Agent Provisioning**: Automatically create new agents based on demand or seasonal needs
* **A/B Testing**: Create multiple agent variants to test different configurations and conversation strategies
* **Regional Support**: Deploy region-specific agents with localized settings and language support
* **Workflow Integration**: Integrate agent creation into larger automation workflows for onboarding or scaling operations

## Error Handling

| Error Type            | Cause                                                | Solution                                                                          |
| --------------------- | ---------------------------------------------------- | --------------------------------------------------------------------------------- |
| Authentication Error  | Invalid or expired access token                      | Regenerate the access token and ensure it has proper permissions                  |
| Invalid Workspace     | Workspace ID doesn't exist or is inaccessible        | Verify the workspace ID and check access permissions                              |
| Duplicate Agent Name  | Agent with the same name already exists in workspace | Use a unique agent name or modify the existing agent                              |
| Invalid Data Format   | Data object doesn't match required schema            | Review the data structure requirements and ensure all required fields are present |
| Email Delivery Failed | Email address is invalid or unreachable              | Verify the email address format and ensure it can receive emails                  |
| Quota Exceeded        | Workspace has reached maximum agent limit            | Remove unused agents or upgrade workspace plan                                    |

## Notes

* **Access Token Security**: Store access tokens securely and never expose them in logs or client-side code. Consider using environment variables or secure vaults.
* **Agent Naming**: Use descriptive, unique names for agents to make them easily identifiable in the workspace. Avoid special characters that might cause issues.
* **Data Configuration**: The data object structure depends on your CX platform's requirements. Consult platform documentation for available configuration options.
* **Email Notifications**: The email notification confirms successful agent creation and typically includes the agent ID and access details.
* **Workspace Limits**: Be aware of workspace agent limits. Creating agents programmatically can quickly reach quotas in high-volume scenarios.
* **Testing**: Test agent creation in a development workspace before deploying to production to avoid issues with production configurations.
