# Using Agents in Chat

Agents are selected and managed directly from the chat interface. Switching agents mid-conversation is supported — giving you flexibility to shift roles without starting a new chat.

***

#### Selecting an Agent

1. Open the **Agent Selector** in the chat input area
2. Choose your desired agent — pre-built or custom

All prompts sent after selection will follow that agent's system instructions and draw from its attached knowledge context. The agent name is displayed in the interface so you always know which one is active.

***

#### Switching Agents

You can switch to a different agent at any point in the conversation:

1. Open the **Agent Selector**
2. Select a different agent

The new agent's instructions apply to all subsequent prompts. Earlier messages in the thread remain as-is.

{% hint style="info" %}
Switching agents mid-chat changes behavior going forward — it does not retroactively reprocess earlier responses. For a completely fresh agent context, start a new chat.
{% endhint %}

***

#### Best Practices

* **Use pre-built agents for quick role-based tasks** — No setup needed; select and start prompting immediately
* **Use custom agents for recurring workflows** — Build once, reuse across any number of chats
* **Attach knowledge bases to agents handling domain-specific tasks** — The agent will reference your documents automatically without per-session uploads
* **Keep system instructions specific** — Structured, detailed instructions produce consistent, high-quality outputs
* **Start a new chat when switching to a very different task** — Carrying over context from a previous role can influence outputs in unintended ways


---

# 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.qolaba.ai/chatbot/agents/using-agents-in-chat.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.
