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

# ResponseCX Quickstart

> Deploy your first ResponseCX agent and send a response in minutes.

# ResponseCX Quickstart

Get from zero to a working ResponseCX agent using the SDK.

## Prerequisites

* StateSet account with ResponseCX enabled
* API key from your dashboard
* Node.js 16+

Set your key in the environment:

```bash theme={null}
export STATESET_API_KEY=sk_test_your_actual_key_here
```

## 1. Install the SDK

```bash theme={null}
npm install stateset-node dotenv winston
```

## 2. Initialize a client

```javascript theme={null}
import { StateSetClient } from 'stateset-node';
import dotenv from 'dotenv';
import winston from 'winston';

dotenv.config();

const logger = winston.createLogger({
  level: process.env.LOG_LEVEL || 'info',
  transports: [new winston.transports.Console()]
});

const client = new StateSetClient({
  apiKey: process.env.STATESET_API_KEY
});
```

## 3. Create an agent

```javascript theme={null}
async function createAgent() {
  try {
    const agent = await client.agents.create({
      name: 'My Agent',
      description: 'My first ResponseCX agent'
    });

    logger.info('Agent created', { agentId: agent.id });
    return agent;
  } catch (error) {
    logger.error('Agent creation failed', {
      message: error.message,
      requestId: error.request_id
    });
    throw error;
  }
}
```

## 4. Add a rule (optional)

```javascript theme={null}
async function createRule(agentId) {
  try {
    const rule = await client.rules.create({
      name: 'Always Respond Politely',
      description: 'Be friendly and concise',
      agent_id: agentId
    });

    logger.info('Rule created', { ruleId: rule.id });
    return rule;
  } catch (error) {
    logger.error('Rule creation failed', { message: error.message });
    throw error;
  }
}
```

## 5. Add an attribute (optional)

```javascript theme={null}
async function createAttribute(agentId) {
  return client.attributes.create({
    name: 'Confident',
    description: 'Authoritative but approachable',
    value: 15,
    agent_id: agentId
  });
}
```

## 6. Create your first response

```javascript theme={null}
async function createResponse() {
  const response = await client.response.create({
    ticket_url: 'https://yourapp.com/tickets/123',
    channel: 'Email',
    customer_message: 'Explain the importance of fast language models',
    agent_response: 'Fast models reduce latency, enable real-time UX, and lower costs.'
  });

  logger.info('Response created', { responseId: response.id });
  return response;
}
```

## Next steps

* Manage agents: [Agents Quickstart](/guides/agents-quickstart)
* Add rules: [Rules Quickstart](/guides/rules-quickstart)
* Add attributes and examples: [Attributes Quickstart](/guides/attributes-quickstart), [Examples Quickstart](/guides/examples-quickstart)
