> For the complete documentation index, see [llms.txt](https://help.talkie.se/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.talkie.se/action-blocks/ai-agent.md).

# AI-Agent

Runs your AI agent with prompts and functions to generate a response.

ZyndraAI´s "AI-Agent" action block is its most advanced feature for building smart, conversational AI agents. This guide will show you how to use it to manage complex interactions, pull from a knowledge base, follow custom logic, and run functions—all in one streamlined step.

The Agent step provides a comprehensive solution for creating AI agents that can:

* Intelligently respond to user queries
* Search knowledge base for relevant information
* Follow specific conversation paths based on user intent
* Execute functions to interact with external services

When using an "Agent" step, you need to configure the following:

### Prompt <a href="#prompt" id="prompt"></a>

Effective prompting is key to building a high-performing AI agent. The instructions you give act as the agent’s “brain,” shaping how it engages with users across different situations.

<figure><img src="https://4077461289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeewcbkzHrPPg3QzvoyBM%2Fuploads%2FUEU1saE9PWQUNFVSxL8J%2FSka%CC%88rmavbild%202025-06-24%20kl.%2017.05.31.png?alt=media&amp;token=868f39c6-e1a4-4029-8fed-7e35461192fe" alt=""><figcaption></figcaption></figure>

Here’s what makes a strong prompt:

* Clear Directives: Define exactly what the agent’s role is and how it should behave in various scenarios.
* Personality Design: Set the tone, formality, and communication style your agent should follow.
* Knowledge Scope: Outline what the agent should know and when to refer to external sources.
* Context Handling: Provide guidance for sensitive topics and when to escalate to a human.

You can learn to create a prompt [here](https://help.talkie.se/ai-studio/prompts).

Good prompting helps your agent stay on track—knowing what to prioritize, when to tap into the knowledge base, and how to respond consistently. Investing time in clear, detailed instructions not only boosts performance but also simplifies your flow.

**Example**:

Instead of saying: *“This is a support agent.”*

Try: *“You’re a helpful, friendly e-commerce support agent who assists with order tracking, returns, and account questions. Keep a positive tone, offer suggestions when possible, and be specific in your responses.”*

### Function <a href="#function" id="function"></a>

Functions allow your agent to connect with external services and retrieve or update data.

Choose from available functions in the dropdown menu OR create a new one by navigating to AI Studio > Functions.

<figure><img src="https://4077461289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeewcbkzHrPPg3QzvoyBM%2Fuploads%2FAosbz574A7EdhRLdIDyD%2FSka%CC%88rmavbild%202025-06-24%20kl.%2017.04.58.png?alt=media&amp;token=3e737786-1f50-40b6-8b09-3463381385c8" alt=""><figcaption></figcaption></figure>

### Path <a href="#path" id="path"></a>

Paths help your agent manage targeted conversation flows and respond with the right actions at the right time.

<figure><img src="https://4077461289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeewcbkzHrPPg3QzvoyBM%2Fuploads%2FHF6z3Movkntb3DgCw1Db%2FSka%CC%88rmavbild%202025-06-24%20kl.%2017.06.26.png?alt=media&amp;token=be50554b-d2d5-4bc0-bec3-bec8021de69f" alt=""><figcaption></figcaption></figure>

Here’s what Paths enable:

* Automatic Routing: The agent identifies user intent and directs the conversation to the relevant path.
* Data Gathering: You can specify which variables must be collected before a path is triggered.
* Natural Flow: Paths fit smoothly into conversations without needing exact commands from the user.

**To create a Path:**

1. Open the Agent step editor.
2. Click “Add Path” and give it a clear, descriptive name.
3. Write a brief description outlining when this path should activate.
4. (Optional) Add required variables that need to be collected first.
5. Link the path to the next steps in your chat flow.

**Path Examples:**

**Human Handoff Path**

* Path Name: Transfer to Human Agent
* Description: Trigger this path when the user explicitly requests to speak with a real person. Phrases like “I want to talk to a human,” “Can I speak to an agent?” or “I need help from a real person” should activate this path.
* Required Variable: None
* LLM Description: This path allows the agent to hand over the conversation to a human agent. Ensure the system recognizes phrases requesting a human interaction and promptly transfer the conversation.

**Book Demo Path**

* Path Name: Schedule Product Demo
* Description: Trigger this path when the user expresses interest in booking a product demo or meeting. Look for phrases such as “I want to book a demo,” “Can I schedule a meeting to see the product?” or “How can I try the product?”
* Required Variables:
  * Name
  * Email
* Variable Descriptions:
  * Name: Collect the user’s full name so the meeting can be scheduled properly.
  * Email: Capture the user’s email to send demo details and confirmation. Ensure the email is in a valid format (e.g., contains @ symbol and proper domain).

This path ensures that when a user wants to book a demo, all necessary details like their name and email are captured before proceeding with the demo scheduling.

### LLM settings <a href="#llm-settings" id="llm-settings"></a>

The LLM Settings section allows you to customize how the language model behaves:

* **LLM Model:** Choose which language model (e.g., GPT-3, GPT-4) you want to use for generating responses. Each model has different capabilities, with newer models generally offering more advanced features.
* **Max Tokens:** This setting controls the maximum length of the response. A higher token limit allows the model to generate longer responses, while a lower limit results in shorter replies.
* **Temperature:** This adjusts the randomness of the model’s responses. A higher temperature (e.g., 0.7) makes responses more creative and varied, while a lower temperature (e.g., 0.2) makes them more deterministic and focused.

These settings help fine-tune how the AI interacts with users based on your desired response style and length.

<figure><img src="https://4077461289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeewcbkzHrPPg3QzvoyBM%2Fuploads%2FPvo9DupBlHFkoRiCj17Q%2FSka%CC%88rmavbild%202025-06-24%20kl.%2017.07.14.png?alt=media&amp;token=090ce714-68e5-46c9-863e-79e76f0be208" alt=""><figcaption></figcaption></figure>

## Creating a knowledge base <a href="#creating-a-knowledge-base" id="creating-a-knowledge-base"></a>

To empower your AI agent to only answer questions that you want it to, create a knowledge base.

* Turn on the *Use data from knowledge base*
* Click *Create knowledge base* from the knowledge base dropdown
* Add data sources to the knowledge base

## Chunks

In RAG, long documents are too big to give directly to an AI model. So, the documents are broken down into smaller pieces of text, called chunks.

Each chunk is just a section of the original content (like a paragraph or a few sentences) that can be stored and searched easily.

When a user asks a question, the system finds the most relevant chunks instead of searching through the entire document. These chunks are then passed to the AI model, so it has the right context to generate an accurate answer.

**NOTE:**

* More chunks sent to LLMs, result in better answers.
* Recommended chunk count is 5.

## Other configurations

These are the toggles/settings that customize how the Agent interacts with users.

### Answer source

When the AI generates a response, it often relies on external information—like documents or web pages. To make this process transparent, we show the Answer Source.

The Answer Source is basically a link to the original webpage (or document) that was used to generate the response. This way, users can:

* Verify the accuracy of the information
* Read the full content for more details
* Trust that the answer isn’t coming from a “black box,” but from a clear, traceable source

### Execute only once

By default, the AI Agent block runs in a loop, meaning the flow keeps executing within the same block until an exit path condition is met.

If you’d like the AI Agent to run just once and then automatically continue to the next step in the flow, enable the Execute Only Once setting.

### Collect feedback

Shows 👍 / 👎 on agent answers so users can rate responses; helps admins improve the bot.

Their feedback helps admins improve the bot by identifying where answers fall short, so they can:

* Add more data sources to the knowledge base
* Update or refine existing content

In short, Collect Feedback gives admins a direct way to learn from users and continuously enhance the bot’s performance.

### Show results as

By default, the AI Agent displays its response as plain text in the chat.

If you turn on any of the options—Buttons, Carousel, or File—the response will also include those formats for a richer experience.

Example:

A user asks: *“Show me the available credit card options.”*

* Text (default):

  “Here are the available credit cards: Gold, Platinum, Titanium.”
* Buttons (if enabled):

  Along with the text, users will see buttons like Gold, Platinum, Titanium that they can click.
* Carousel (if enabled):

  Each card is shown as a card-style item with an image, short description, and a “Select” button that users can scroll through.
* File (if enabled):

  The agent attaches a downloadable PDF with full details of all credit cards.

## Best Practices & Tips

* Keep prompts short and action-oriented
* Avoid overlapping path triggers (use clear keywords/intents)
* Test with real queries to validate output
* If using functions, confirm the API is reliable and handles errors gracefully
* Use “Exit paths” to prevent loops

## Common Pitfalls

* Forgetting to capture variables before using them in paths/functions
* Setting temperature too high, causing irrelevant answers
* Not linking fallback paths for when AI cannot find a match

## Checklist before going live

* Prompt is clear and instructive
* Paths are defined and tested
* Functions return correct data
* Human handoff works smoothly
* Edge cases tested with sample queries
