---
title: "Building and Testing Agents"
icon: "robot"
---

## **Agents**

Agents allow you to build the backend of your generative AI application. You can pick from a library of agents or create your own with your own models and data sets. The playground allows you to test the output of your agent against different prompts. The battleground allows you to test agents against each other to decide which one works best for your use case.

Before creating a agent, ensure that you have added at least one model and data source to your project. For more information, visit our section called “Model Lifecycle Management”.

### **Creating a New Agent**

To create a new Agent:

 1. Select the Project you want to create your Agent in.
 2. Select the **Agents** tab.
 3. Validate that you have added at least one Model and one Data Source to your Model Library and Data Sources.
 4. Select **“New Agent”**.
 5. Give the Agent a name in the top left.
 6. Drag and drop nodes from the left side onto the canvas that you would like to use in your Agent.
7. Use the line drawer to connect the objects together.
8. Click **“Save changes”** or **“Publish”** to save your agent.

### **Test your agent in Agent Studio**

You can now test your agent directly inside **Agent Studio**.  
No more switching back and forth to a separate Playground while you’re iterating on your flow.


### **What you can do**

- **Inline Test mode** – Chat with your agent without leaving Agent Studio.
- **Playground Compare mode** – Open the latest **Draft** and **Published** versions side by side to compare their behavior.

Both options live in the **center-left controls** on the Agent Studio canvas.

---

### **Inline Test mode (inside Agent Studio)**

Inline Test mode lets you build, test, and refine in one place.

### **How it works**

1. Open your agent in **Agent Studio**.
2. In the **center-left** canvas controls, click **Playground**.
3. A Playground panel opens on the left with a chat interface.
4. Type a message (for example, a realistic user input) and send it.
5. Watch how your agent runs through the steps on the canvas and returns a response.

The inline Playground uses the **current configuration of your agent on the canvas**, so every change you make is immediately testable.

### **When to use it**

Use Inline Test mode when you want to:

- Quickly validate a single flow or prompt change.
- Tweak steps, retry, and iterate in a tight loop.
- Stay in a focused build environment without switching screens.

---

### **Playground Compare mode (Draft vs Published)**

The original Playground Compare mode is still available when you need a more formal comparison.

### **What it does**

Playground Compare mode:

- Opens your **latest Draft** and **Published** versions **side by side**.
- Lets you send the same input to both versions.
- Makes it easy to see how changes to prompts, tools, or flows impact responses.

### How to open Compare mode

1. Open your agent in **Agent Studio**.
2. In the **center-left** canvas controls, click **Compare in Playground**.
3. The Playground opens with two panes:
   - **Left:** Latest **Draft** version  
   - **Right:** **Published** version
4. Enter a message and compare how each version responds.


### **Editing a Agent**

To edit a Agent:

1. Open the agent.
2. Make changes on the canvas.
3. Click **“Save changes”** or **“Publish”** to save your agent.

### **Debugging a Agent**

To debug a Agent:

1. Test the Agent on the playground
2. Click the View Logs next to the output while testing, or navgiate to the Agent Executions feed on the left-side navigation and click on the Agent execution you are debugging.
3. Review the Logs for errors.

### **Using Your Agent**

To use your agent in your application:

1. From the top navigation in Agent canvas, click the Settings icon.
2. Select **"Interfaces"**.
3. Click **"View API Info"** next to the API interface.
4. The API endpoint for the agent will appear.
5. The headers of your API call should be:

- **Content-Type: application/json**
- **X-API-Key: YOUR_API_KEY**

6. View the API Documentation for the body of the request.

<Note>
Need other ways to use your agent? See [Managing Agent Interfaces](/building-and-deploying-agents/interface-options/managing-interfaces) for Airia Catalog, Chat Widget, and other interface options.
</Note>

### **To Generate Your API Key**

You can generate API keys directly from the API interface or from Settings:

**From API Interface:**
1. In the interfaces panel, click **"View API Keys"** next to the API interface.
2. Click **"New API Key"**.
3. Enter the API Key Name and define the project scope.
4. Click **"Create"** to generate your API key.

**From Settings:**
1. Navigate to **Settings** and then **API Keys**.
2. Click **"Generate Key"**.
3. Name your key and set the appropriate scope.
4. Copy the key and use it in your API client.
5. Click **Create**.

For complete interface setup guidance, see [Managing Agent Interfaces](/building-and-deploying-agents/interface-options/managing-interfaces).
