> For the complete documentation index, see [llms.txt](https://docs.agentalk.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agentalk.io/core-concepts/ai-agents.md).

# AI agents

An Agentalk agent is a voice AI system that can make and receive phone calls. To use it, you need to understand how its components work together during a live conversation. This guide explains the six core components of an agent and how the voice pipeline processes a call.

### The six components of an agent

Every agent is built from the same six components:

<table><thead><tr><th width="177.99993896484375">Component</th><th>What it does</th></tr></thead><tbody><tr><td><strong>Instructions</strong></td><td>Define the agent's goal, personality, and communication style.</td></tr><tr><td><strong>LLM</strong></td><td>Generates responses based on the caller's input and instructions.</td></tr><tr><td><strong>STT</strong></td><td>Converts the caller's speech into text.</td></tr><tr><td><strong>TTS</strong></td><td>Converts the agent's response into spoken audio.</td></tr><tr><td><strong>Functions</strong></td><td>Trigger actions during the call based on conditions.</td></tr><tr><td><strong>Knowledge base</strong></td><td>Provides information the agent can use to answer questions.</td></tr></tbody></table>

Instructions, LLM, STT, and TTS are required for every agent. Functions and a knowledge base are optional and depend on your use case.

{% hint style="info" %} <mark style="color:$info;">**How components work together**</mark>

All six components are active during a call. Audio is converted to text, processed, and converted back to speech in a continuous loop.
{% endhint %}

### How the voice pipeline works

During a call, the agent processes audio and text through a sequence of steps. This process is known as the voice pipeline.

Agentalk supports two pipeline approaches, each with different trade-offs in latency, flexibility, and cost.

#### Chain model

The chain model connects three separate systems in sequence:

1. The STT model listens to the caller and converts speech into text.
2. The LLM reads the transcript, applies the agent's instructions, and generates a response.
3. The TTS model converts that response into audio and plays it back to the caller.

{% hint style="info" %} <mark style="color:$info;">**When to use the chain model**</mark>

Use this model when you need flexibility. You can choose different providers for each stage, optimize costs, or prioritize specific language support.
{% endhint %}

#### Real-time model

The real-time model uses a single system to handle listening, reasoning, and speaking together.

There is no handoff between components, which reduces latency and makes conversations feel more natural. This model typically costs more than the chain model.

{% hint style="warning" %} <mark style="color:$warning;">**Cost vs experience tradeoff**</mark>

Real-time models provide better conversation flow but are more expensive. Choose based on your priorities.
{% endhint %}

### Temperature

Temperature controls how closely the agent follows its instructions versus how much variation it introduces in responses.

* Low temperature: The agent stays consistent and follows instructions closely. Use this for compliance or structured scripts.
* High temperature: The agent responds more flexibly and varies its wording. Use this for more natural conversations.

{% hint style="info" %} <mark style="color:$info;">**Default recommendation**</mark>

Start with a moderate temperature and adjust based on how consistent or flexible you want the agent to be.
{% endhint %}

### Inbound vs. outbound agents

An agent behaves differently depending on whether it is making or receiving a call.

* Outbound agents initiate the call. They should introduce themselves immediately and clearly state the reason for calling.
* Inbound agents receive calls. They should greet the caller and first understand the caller’s intent before guiding the conversation.

{% hint style="warning" %}
**Use different scripts for inbound and outbound calls**

Inbound and outbound calls require different opening messages. Using the same script for both results in a poor caller experience.
{% endhint %}

Create separate agents for inbound and outbound scenarios. You can duplicate an existing agent to speed up setup.

### Functions

Functions are actions the agent can trigger during a call based on what the caller says. You define the trigger condition in plain language, and the agent decides when to activate it.

There are four function types:

<table><thead><tr><th width="188.39996337890625">Function</th><th>What it does</th></tr></thead><tbody><tr><td><strong>End Call</strong></td><td>Ends the call when the caller indicates the conversation is complete.</td></tr><tr><td><strong>Update Contact</strong></td><td>Extracts information from the call and stores it in the contact record.</td></tr><tr><td><strong>Transfer Call</strong></td><td>Forwards the call to another phone number.</td></tr><tr><td><strong>External API</strong></td><td>Sends or retrieves data from an external system during the call.</td></tr></tbody></table>

{% hint style="info" %} <mark style="color:$info;">**How functions are triggered**</mark>

You don't call functions manually. The agent decides when to trigger them based on the conditions you define.
{% endhint %}

See [**Agent functions**](/ai-agents/agent-functions.md) for details on how each type works.

### Knowledge base

A knowledge base lets the agent answer questions using your own content.

During a call, the agent searches the knowledge base for relevant content and uses it to generate a response.

{% hint style="info" %} <mark style="color:$info;">**When to use a knowledge base**</mark>

Use it when your agent needs to answer detailed questions from large or complex content such as documentation, product data, or internal knowledge.
{% endhint %}

{% hint style="warning" %} <mark style="color:$warning;">**When a knowledge base is not needed**</mark>

Simple workflows such as lead qualification or appointment booking usually don't require a knowledge base.
{% endhint %}

See [**Set up a knowledge base**](/knowledge-base/set-up-a-knowledge-base.md) for setup instructions, and [**Connect a knowledge base to an agent**](/knowledge-base/connect-a-knowledge-base-to-an-agent.md) to link one to your agent.

### Next steps

Here are the recommended next steps after completing this guide:

* [**Create an agent**](/ai-agents/create-an-agent.md)**:** Build your working agent and test a call.
* [**Write effective agent instructions**](/ai-agents/write-effective-agent-instructions.md)**:** Define behavior, tone, and conversation flow.
* [**Use built-in functions**](/ai-agents/agent-functions/use-built-in-functions.md)**:** Add actions like call transfer and contact updates.
* [**Set up a knowledge base**](/knowledge-base/set-up-a-knowledge-base.md)**:** Enable your agent to answer questions using your content.
* [**Credits and pricing**](/core-concepts/credits-and-pricing.md)**:** Understand how usage is calculated and configure your plan.
* [**Setup checklist**](/getting-started/setup-checklist.md)**:** See the full recommended configuration sequence.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.agentalk.io/core-concepts/ai-agents.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
