# Components

**Components** are reusable values that you define once and can reference across different parts of the platform — including Agent prompts, Tasks, MCPs, and Tools.

Instead of repeating the same information in multiple places, you create a Component and insert it wherever needed. When the value changes, you update it in one place and it reflects everywhere automatically.

***

#### 🧩 What is a Component

A Component is a named variable with a fixed value.

It has three properties:

* **Name** — how you reference it (e.g. `especialidade`)
* **Type** — the kind of value it holds (String, Number, or Boolean)
* **Value** — the actual content that will be injected when the Component is used

> Components are **global** — once created, they are available to all Agents in your workspace.

***

#### 💡 When to Use Components

Components are useful whenever you have information that:

* Repeats across multiple Agents or configurations
* Might change over time and needs to stay consistent
* Should be managed centrally rather than edited in every prompt

Common examples:

* Clinic name, specialty, or doctor's name used across Agent prompts
* A numeric threshold (e.g. max retries, score limit) shared across Tools
* A feature flag (Boolean) that controls behavior in multiple Agents

***

#### ➕ How to Create a Component

1. Inside your Agent, go to **Components** in the left menu
2. Click **New Component**
3. Fill in the **Name**, **Type**, and **Value**
4. Click **Add Component**

The Component is immediately available across your workspace.

***

#### 🔢 Component Types

| Type    | Value field                 | Use when                                  |
| ------- | --------------------------- | ----------------------------------------- |
| String  | Free text (up to 250 chars) | Names, descriptions, instructions, labels |
| Number  | Numeric spinner             | Counts, limits, IDs, scores               |
| Boolean | Toggle (on/off)             | Feature flags, conditions, enable/disable |

#### 💬 How to Use a Component

Wherever the platform accepts variables (prompts, Tasks, MCPs, Tools, etc.), you can insert a Component in two ways:

* Type `@` in the text field and select the Component from the list
* Click inside the field and pick the Component from the panel that appears

The Component will appear as a **tag** in the editor (e.g. `[[especialidade]]`) and will be replaced by its value at runtime.

**Example:**

> Prompt: *"You are an AI Agent for the clinic of Dr. `[[especialidade]]`"*
>
> At runtime: *"You are an AI Agent for the clinic of Dr. Estética Dental"*

***

#### 🔄 Updating a Component

To change the value of a Component:

1. Go to **Components** in the left menu
2. Find the Component and click the **⋯** menu
3. Edit the value and save

The updated value will be applied everywhere the Component is used — no need to touch individual prompts or configurations.

***

#### 📌 Best Practices

* Use **clear, descriptive names** — the name is how you and your team will find and reference the Component
* Prefer Components over hardcoding values directly in prompts when the same information appears in more than one place
* Use **Boolean** Components as feature flags to toggle behaviors without editing prompts
* Use **Number** Components for thresholds or limits you might need to adjust over time

***

#### ✅ Key Takeaway

Components let you:

* Define values once and reuse them across Agents, prompts, Tasks, MCPs, and Tools
* Keep your workspace consistent and easy to maintain
* Update information globally without editing each Agent individually

It's a small change that makes a big difference when managing multiple Agents at scale.

<br>


---

# Agent Instructions: 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:

```
GET https://docs.zaia.app/components-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
