# 9. The AI agent

*Tabellum for mobile, chapter 9. On the web: https://tabellum.dudko.dev/manual/mobile/the-ai-agent*

The agent answers questions about your databases in plain language: it reads the schema, runs read-only queries, explains plans, drafts SQL into the editor, builds dashboards and designs. It uses your own account with OpenAI, Anthropic or Google Gemini, and every write it proposes waits for your approval.

## 9.1 Setting it up

Tap **Agent** at the bottom of the screen, then the settings button.

![Agent settings](https://tabellum.dudko.dev/manual/mobile/img/agent-settings.jpg)

*Agent settings*

Marked on the screenshot: (1) OpenAI, Anthropic or Gemini; (2) How long the model may think.

1. Turn on **Agent enabled**.
2. Choose the **Provider** (1) and a model, and paste your API key. The key is kept in secure storage and sent only to that provider.
3. Optionally change **Reasoning** (2) (how long the model may think), the number of tool rounds per message and the context limit.

## 9.2 Asking

Type a question and tap the send button. The agent reads what it needs and answers with tables and SQL; a longer result opens in a query tab.

![An answer, with the query it ran](https://tabellum.dudko.dev/manual/mobile/img/agent-reply.jpg)

*An answer, with the query it ran*

Marked on the screenshot: (1) Earlier conversations; (2) Provider, model and limits.

- (1) lists your earlier conversations; **New conversation** starts a fresh one.
- (2) opens the settings.
- Once a request has gone out, **What was sent** appears next to them and shows exactly what was sent to the model, request by request.

When a conversation gets long, the agent summarizes the earlier turns so it can keep going; the summary is marked in the conversation.

## 9.3 What the agent can and cannot do

- It reads freely: schemas, row counts, plans, and the results of read-only queries.
- It never runs a write itself. An `UPDATE`, a `DELETE` or a schema change goes to the approval dialog (see [Section 4.6](https://tabellum.dudko.dev/manual/mobile/writing-sql#the-approval-dialog)), exactly as if you had typed it.
- It sees row values only on connections with **Agent may see rows** turned on. On every other connection it gets tables, columns and counts, never data. A **Sensitive** connection gives it the schema only.
- Your files can steer it: an `agent.md` in the workspace adds your own instructions to every conversation.

> **Note:** Requests go straight from your phone to the provider you chose. Tabellum has no server of its own in between.
