# How to use slots

**Slots** are a fundamental component of dynamic intents in AIsuru. They let you extract specific information from user requests, making intents more flexible and powerful.

### What is a slot

A slot is a **variable** that can be extracted from the user's message and passed to the intent's webhook. Slots let you create dynamic intents that can handle a variety of user inputs, making interactions more natural and contextual.

### Creating a new slot

To configure a new slot, follow these steps:

1. Go to the "**Functions**" > "**Dynamic intents**" section of your Agent;
2. Select the "**Slots**" tab and click "**New slot**";
3. Fill in the required fields:
   1. **Name**: assign an identifying name to the slot;
   2. **Fixed values**: add the preset values the slot can take; use the "Add value" button to enter multiple options;
   3. **Webhook**: enter the URL of the external service that will handle this slot;
   4. **Validity (minutes)**: define how long the slot's response should be cached; if not specified, the response won't be cached;
4. Use the TEST button to make sure it works correctly.

### Using slots in invocations

**Slots** let you extract specific information from user requests. To use slots in invocations:

1. Define the slots in the intent configuration;
2. Use **curly braces {}** to indicate where to extract the slot value in the invocation phrases, and put the slot name inside the curly braces.

Examples of slots in an invocation:

* "What's the weather in {city}?"
* "Book a flight from {departure\_city} to {arrival\_city} for {date}"

When a user asks something like "What's the weather in London?", AIsuru will recognize the intent and extract "London" as the value of the "city" slot.

### Multiple slots

You can use multiple slots in a single invocation. For example: "Book a table for {number\_of\_people} people on {date} at {time}"

In this case, AIsuru would extract values for three different slots: number\_of\_people, date, and time.

### Handling missing slots

If a required slot is not provided by the user, AIsuru can be configured to explicitly ask for the missing information. For example:

* User: "What's the weather?";
* AIsuru: "Which city would you like the weather for?";
* User: "London";
* AIsuru: \[proceeds with the intent using "London" as the value for the "city" slot].

### Validating slot values

You can implement validation logic in the webhook to make sure slot values are correct and usable. For example:

* Checking that a date is in the correct format and in the future;
* Verifying that a number of people is reasonable for a reservation;
* Validating that a city is present in the weather service's database.

### Best practices for using slots

* Use descriptive, consistent slot names throughout your Agent;
* Make sure invocations cover various ways users might phrase their requests;
* Test invocations with different inputs to ensure slots are extracted correctly;
* Provide clear descriptions for each slot to make maintenance and understanding easier over time;
* Implement fallback logic in your webhook to handle cases where slot values are invalid or missing.

### Advanced slot usage examples

* **Slots with default values**: Configure slots with default values for cases where the user doesn't specify information. For example, a "date" slot might default to today's date;
* **Chained slots**: Create intents that use information from previous slots to contextualize subsequent requests. For example, after asking about the weather for a city, the Agent could remember the city for follow-up questions about the same location.

Using slots effectively can make your dynamic intents more powerful and flexible, letting you create more natural and contextual conversational experiences for your users. Slots allow your Agent to adapt to a wide range of user inputs, improving its ability to understand and respond to requests accurately and relevantly.


---

# 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.aisuru.com/en/advanced-features/integrations/dynamic-intents/how-to-use-slots.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.
