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

# AI Components

> Reference guide for AI-powered components that add intelligence to your automations

# AI Components

AI components bring large language model (LLM) capabilities into your automations. Use them to generate content, analyze data, make decisions, and perform complex reasoning tasks.

## Overview

Agent Studio provides three types of AI components:

| Component                         | Purpose                         | Best For                           |
| --------------------------------- | ------------------------------- | ---------------------------------- |
| **LLM V2**                        | Direct text generation          | Simple prompts, content generation |
| **LLM with Structured Output V2** | Generate structured JSON        | Data extraction, form filling      |
| **Agent V2**                      | Autonomous reasoning with tools | Complex multi-step tasks           |

***

## LLM V2

A straightforward component for generating text using a large language model.

### Configuration

| Field             | Description                                        |
| ----------------- | -------------------------------------------------- |
| **System Prompt** | Instructions that define the LLM's behavior        |
| **User Prompt**   | The specific request (supports @ notation)         |
| **Temperature**   | Creativity level (0 = deterministic, 1 = creative) |

### Example: Generate Email Content

**System Prompt:**

```
You are a customer success manager writing professional, friendly emails.
Keep emails concise and action-oriented.
```

**User Prompt:**

```
Write a brief email to @contact_name at @account_data.name.
Context: Their health score dropped from @previous_score to @current_score.
Goal: Schedule a check-in call to understand their challenges.
```

### Output

```json theme={null}
{
  "text": "Subject: Quick Check-in - How Can We Help?\n\nHi Sarah,\n\nI noticed some recent changes in your team's usage patterns and wanted to reach out personally. I'd love to schedule a brief call this week to hear how things are going and see if there's anything we can do to better support your team.\n\nWould you have 15 minutes available Thursday or Friday?\n\nBest,\n[Your name]"
}
```

### Use Cases

* Drafting personalized emails
* Generating meeting summaries
* Creating task descriptions
* Writing notification messages

***

## LLM with Structured Output V2

Generates responses that conform to a specific JSON schema, ensuring consistent, parseable output.

### Configuration

| Field             | Description                                        |
| ----------------- | -------------------------------------------------- |
| **System Prompt** | Instructions for the LLM                           |
| **User Prompt**   | The request with context                           |
| **Output Schema** | JSON schema defining the expected output structure |
| **Temperature**   | Creativity level                                   |

### Example: Extract Action Items

**System Prompt:**

```
You are an assistant that extracts action items from meeting notes.
```

**User Prompt:**

```
Extract action items from these meeting notes:
@meeting_notes
```

**Output Schema:**

```json theme={null}
{
  "type": "object",
  "properties": {
    "action_items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "task": { "type": "string" },
          "owner": { "type": "string" },
          "due_date": { "type": "string" },
          "priority": { "enum": ["high", "medium", "low"] }
        }
      }
    },
    "summary": { "type": "string" }
  }
}
```

### Output

```json theme={null}
{
  "action_items": [
    {
      "task": "Send updated proposal",
      "owner": "Jane",
      "due_date": "2024-02-25",
      "priority": "high"
    },
    {
      "task": "Schedule technical review",
      "owner": "John",
      "due_date": "2024-02-28",
      "priority": "medium"
    }
  ],
  "summary": "Discussed proposal revisions and agreed on next steps for technical evaluation."
}
```

### Use Cases

* Extracting structured data from unstructured text
* Classifying content into categories
* Parsing meeting transcripts
* Generating form-ready data

***

## Agent V2

The most powerful AI component—an autonomous agent that can reason, use tools, and perform multi-step tasks.

### How Agents Work

Unlike simple LLM calls, agents can:

1. **Reason** about what steps to take
2. **Use tools** to fetch information or take actions
3. **Iterate** through multiple steps to complete a task
4. **Adapt** based on intermediate results

```
Agent receives task
    ↓
Agent plans approach
    ↓
Agent calls tools as needed
    ↓
Agent synthesizes results
    ↓
Agent returns final answer
```

### Configuration

| Field              | Description                          |
| ------------------ | ------------------------------------ |
| **System Prompt**  | Define the agent's role and behavior |
| **User Prompt**    | The task to accomplish               |
| **Tools**          | Select which tools the agent can use |
| **Max Iterations** | Limit on reasoning steps             |

### Available Tools

Agents can be configured with various tools:

| Tool Category     | Examples                                      |
| ----------------- | --------------------------------------------- |
| **Data Access**   | Query accounts, fetch tasks, get activities   |
| **Communication** | Send emails, post to Slack                    |
| **CRM**           | Create Salesforce cases, update opportunities |
| **Analysis**      | Calculate metrics, generate insights          |

### Example: Research and Summarize Account

**System Prompt:**

```
You are a customer success analyst. Research accounts thoroughly
and provide actionable summaries. Use available tools to gather
information before making recommendations.
```

**User Prompt:**

```
Research @account_data.name and prepare a summary for the upcoming QBR.
Include:
- Recent activity trends
- Health indicators
- Key risks and opportunities
- Recommended talking points
```

**Tools Enabled:**

* Get account activities
* Get account health history
* Get open tasks
* Get contact details

### Output

The agent will:

1. Fetch recent activities for the account
2. Analyze health score trends
3. Review open tasks and their status
4. Identify key contacts
5. Synthesize into a structured QBR summary

### Use Cases

* Complex research tasks
* Multi-step workflows
* Decision-making with multiple data sources
* Autonomous customer analysis

***

## Choosing the Right AI Component

<Columns cols={3}>
  <Card title="Use LLM V2 when...">
    * You need simple text generation
    * The task is straightforward
    * You want fast, single-step output
    * Format flexibility is acceptable
  </Card>

  <Card title="Use Structured Output when...">
    * You need specific data formats
    * Output will be used by other nodes
    * You need reliable parsing
    * Consistency is important
  </Card>

  <Card title="Use Agent V2 when...">
    * Task requires multiple steps
    * You need to fetch/combine data
    * Complex reasoning is required
    * Task may need iteration
  </Card>
</Columns>

***

## Best Practices

### Prompt Engineering

<Accordion title="Be specific and clear">
  Good prompt:

  ```
  Analyze the health score trend for this account over the past 90 days.
  If the score dropped more than 10 points, identify potential causes
  based on recent activities. Format as bullet points.
  ```

  Poor prompt:

  ```
  Tell me about this account's health.
  ```
</Accordion>

<Accordion title="Provide context">
  Always include relevant context in prompts:

  * Account information
  * Recent activities
  * Historical data
  * Your specific goals
</Accordion>

<Accordion title="Use examples">
  For complex outputs, provide examples:

  ```
  Generate a risk assessment in this format:
  Risk Level: [High/Medium/Low]
  Key Factors:
  - Factor 1
  - Factor 2
  Recommended Actions:
  - Action 1
  - Action 2
  ```
</Accordion>

### Temperature Settings

| Temperature | Behavior               | Use For                           |
| ----------- | ---------------------- | --------------------------------- |
| 0.0 - 0.3   | Deterministic, focused | Data extraction, analysis         |
| 0.4 - 0.6   | Balanced               | General tasks                     |
| 0.7 - 1.0   | Creative, varied       | Content generation, brainstorming |

### Error Handling

<Accordion title="Validate AI outputs">
  Add condition nodes after AI components to validate:

  * Output is not empty
  * Required fields are present
  * Values are within expected ranges
</Accordion>

<Accordion title="Have fallback paths">
  Create alternative flows for when AI doesn't produce usable output:

  ```
  AI Component → Condition (valid output?) → True: Continue
                                           → False: Use default/alert
  ```
</Accordion>

***

## Troubleshooting

<Accordion title="Output is too generic">
  * Add more specific context to your prompt
  * Include examples of desired output
  * Lower the temperature
  * Provide relevant data via @ notation
</Accordion>

<Accordion title="Output format is wrong">
  * Use Structured Output component instead of plain LLM
  * Add explicit format instructions to the prompt
  * Include an example in the prompt
</Accordion>

<Accordion title="Agent takes too long">
  * Reduce the number of enabled tools
  * Lower max iterations
  * Simplify the task into smaller steps
  * Add more guidance to narrow the search space
</Accordion>

<Accordion title="Agent doesn't use tools">
  * Verify tools are enabled in configuration
  * Add explicit instructions to use specific tools
  * Check that the task actually requires tools
</Accordion>

## Next Steps

<CardGroup cols={2}>
  <Card title="Agents Overview" icon="robot" href="/agent-studio/agents/overview">
    Build standalone AI agents
  </Card>

  <Card title="Testing Automations" icon="vial" href="/agent-studio/automations/testing">
    Test your AI components
  </Card>
</CardGroup>
