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

# Creating an Agent

> Learn how to create and configure AI voice agents

# Creating an Agent

Agents are the core of Truedy - they handle conversations and interact with users. This guide shows you how to create and configure agents.

## Basic Agent Creation

Create a simple agent:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.truedy.ai/api/public/v1/agents \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Customer Support Agent",
      "description": "Handles customer support inquiries",
      "voice_id": "VOICE_UUID",
      "system_prompt": "You are a helpful customer support agent. Be friendly and professional.",
      "model": "ultravox-v0.6"
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.truedy.ai/api/public/v1/agents",
      headers={
          "Authorization": "Bearer YOUR_API_KEY",
          "Content-Type": "application/json"
      },
      json={
          "name": "Customer Support Agent",
          "description": "Handles customer support inquiries",
          "voice_id": "VOICE_UUID",
          "system_prompt": "You are a helpful customer support agent. Be friendly and professional.",
          "model": "ultravox-v0.6"
      }
  )

  agent = response.json()["data"]
  print(f"Created agent: {agent['id']}")
  ```
</CodeGroup>

## Advanced Configuration

### Adding Tools

Connect your agent to external APIs:

```json theme={null}
{
  "name": "Sales Agent",
  "voice_id": "VOICE_UUID",
  "system_prompt": "You are a sales agent...",
  "tools": ["tool-uuid-1", "tool-uuid-2"]
}
```

### Adding Knowledge Bases

Give your agent access to documents:

```json theme={null}
{
  "name": "Support Agent",
  "voice_id": "VOICE_UUID",
  "system_prompt": "You are a support agent...",
  "knowledge_bases": ["kb-uuid-1"]
}
```

### Configuring Call Settings

Customize call behavior:

```json theme={null}
{
  "name": "Sales Agent",
  "voice_id": "VOICE_UUID",
  "system_prompt": "You are a sales agent...",
  "recording_enabled": true,
  "temperature": 0.7,
  "language_hint": "en-US"
}
```

## System Prompts

The system prompt defines your agent's personality and behavior. Tips:

* **Be Specific**: Clearly define the agent's role and responsibilities
* **Set Boundaries**: Specify what the agent should and shouldn't do
* **Include Examples**: Provide example interactions
* **Define Tone**: Specify the communication style

### Example Prompts

**Customer Support**:

```
You are a helpful customer support agent. Your goal is to resolve customer issues quickly and professionally. Always be polite and empathetic. If you cannot resolve an issue, escalate to a human agent.
```

**Sales**:

```
You are a sales agent focused on understanding customer needs and recommending appropriate products. Be consultative, not pushy. Ask questions to understand requirements before making recommendations.
```

**Appointment Booking**:

```
You are an appointment booking assistant. Your goal is to schedule appointments efficiently. Confirm all details (date, time, service type) before finalizing. Be friendly and clear.
```

## Best Practices

<CardGroup cols={2}>
  <Card title="Start Simple" icon="lightbulb">
    Begin with a basic agent, then add complexity as needed
  </Card>

  <Card title="Test Thoroughly" icon="flask">
    Use test calls to verify agent behavior before production
  </Card>

  <Card title="Iterate on Prompts" icon="pen">
    Refine system prompts based on real conversations
  </Card>

  <Card title="Monitor Performance" icon="chart-line">
    Track call outcomes and adjust agent configuration
  </Card>
</CardGroup>

## Next Steps

* Learn about [Making Calls](/guides/making-your-first-call)
* Explore [Tools & Integrations](/api-reference/tools)
* Set up [Knowledge Bases](/api-reference/knowledge-bases)
