The AI assistant chat panel: ask questions about your site's data
Describes AI Agent 0.2.0.
The AI assistant is a chat that lives in the admin header. You ask it about the site’s data, and it looks things up with the same rights your own session has: it sees and does no more than you can.
Where to find it
Once the module is on, a sparkles button appears in the admin header, just before the notifications bell. It is labelled AI assistant.
You see it when:
- the AI Agent module is enabled in Admin > Modules (it is off by default, and it needs the AI module to be enabled first);
- your role holds the AI Agent permission (“Use the AI assistant, with the rights of one’s own session”). Owners hold every permission;
- an administrator has not switched the assistant off for you on AI Agent > Users.
The button is not shown while you are signed in as someone else (a borrowed, impersonated session).
Your chats
Clicking the button opens the list of your chats:
- New chat at the top empties the panel so you can start over. The chat itself is only created when you send its first message or file, and it takes its title from the first 60 characters of that message.
- Below it, your chats, the one with the newest message first, each with how long ago it was last written to (“just now”, “5 minutes ago” and so on). Hover the time to see the exact date and time.
- More at the bottom loads the next chats when you have many.
- The pencil (Rename) lets you type a new title, then Save or Cancel. A title can’t be empty or longer than 200 characters.
- The box icon (Archive) takes the chat off the list. If it was open, the panel closes it.
With no chats yet, the list says No chats yet.
Your chats are private. Only you can open them: there is no admin page that reads other people’s chats.
The chat panel
Choosing a chat opens the panel on the right side of the page. On a wide screen it narrows the page and you can drag its left edge to make it wider. On a phone it takes the whole screen.
The header shows the chat’s title (or AI assistant for a new one), the Personal instructions button and Close.
The feed shows:
- your messages;
- the assistant’s answers, formatted as text with lists and links. Links open in a new tab with their domain written beside them. Pictures from outside addresses are not loaded: you see their description text instead;
- each tool call the assistant made, folded into one line: the tool’s name and the outcome, such as done, a count like “3 found”, Not allowed: the tool was not run. or The tool failed. Opening the line says a little more, for example The result was cut to fit. What the tool returned is never shown;
- notices, in a yellow box, when something stopped the answer (a limit reached, the model failed, the answer took too long);
- cards for changes the assistant proposes. See the guide on confirming the assistant’s changes.
A long chat opens at its end. Earlier messages at the top loads the older ones. An empty chat says Ask about anything you can see in the system.
Sending a message
Type in the box (Write a message…) and press Send, or press Enter. Shift+Enter adds a new line. The paper clip (Attach a file) adds files; see the guide on attachments.
While the assistant works, a line under the feed says what it is doing: Thinking…, Calling a tool… or the name of the tool it is calling. Send is disabled until it has finished.
Stop asks the answer to stop. A step already under way, such as a model call, finishes first, so its cost is still counted. If nothing has come back after a while, the panel says No answer has come. Open the chat again to see where it stands., and you can press Stop again.
Some things the panel refuses, with a red message you can close:
- The assistant is still answering in this chat. Wait for it or press Stop.
- The assistant is answering in another chat. Wait for it to finish. You can run one answer at a time across all your chats.
- The message is too long. Shorten it or send it as a file. A message can be as long as the history the assistant sends to the model (24,000 characters by default, set in Settings > AI Agent).
- No model is chosen for the assistant yet. An administrator has to choose one.
- A limit used up, for example You have used all your assistant turns for today. See the guide on spending and limits.
The panel remembers, in your browser, whether it was open, which chat it showed and how wide it was. They come back after you move to another admin page or reload. What you are typing is not lost when the panel updates.
Personal instructions
The sliders button (Personal instructions) opens a small form: How the assistant should answer you. It follows the site’s own rules first. Write how you want answers (shorter, in a language, as tables) and press Save. The text can be up to 4,000 characters.
The assistant follows these after the site’s own prompt and the prompt an administrator set for you, so they can’t override those.
What the assistant knows
Each answer is built with, in this order: the site-wide prompt from Settings > AI Agent, a fixed rule that changes wait for your confirmation, text the site’s developers may add, the prompt an administrator set for you, your personal instructions, and then your name, the role your session acts as, your language, today’s date and the page the panel is open on.
The assistant can use only the tools your session’s role allows. Settings > AI Agent shows which ones, under What the assistant can use now.
What it doesn’t do
- It never changes anything on its own. A change is a proposal you confirm on a card.
- Archived chats are not listed anywhere in the panel, and there is no button to bring one back or to delete a chat.
- It is not available in a borrowed (impersonated) session.
- Administrators can’t read your chats from the admin.
For developers
The panel needs core’s admin layout with header widgets and the dock column. Its browser scripts are inline: under a Content-Security-Policy the page needs script-src 'unsafe-inline', or the panel shows but does not remember its state, resize, or send on Enter. Optional config adds text to the prompt (config :phoenix_kit_agent, prompt_addendum: {Mod, :fun}) or describes the page the panel is open on (page_context: {Mod, :fun}).