> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qobra.co/llms.txt
> Use this file to discover all available pages before exploring further.

# ask_report_agent

> Run one turn of a conversation with Qobra's report agent, which builds, changes or explains a report.

Hand the work on a report to Qobra's **report agent**, the agent the web app
calls the Analyst. Each call sends one instruction and returns the agent's
turn: an `answer`, a `pending_question` for the user, or `running`. The agent
builds, changes or explains a report, and applies its changes as it makes
them, as in the web app.

Use it when the user wants a report built or changed from a description in
their own words ("show the attainment per rep by quarter"), or wants a report
explained. Use it also for what
[`create_report`](https://docs.qobra.co/mcp_documentation/tools/create_report) cannot do, such as
adding metrics, filters, a pivot table or a chart.

## Start and continue a conversation

Start with an `instruction` on a `report_id` from
[`list_reports`](https://docs.qobra.co/mcp_documentation/tools/list_reports) or
`create_report`. Omit `report_id` to have the agent create the report itself.
`sandbox_id` only picks where a report the agent creates lands: a `report_id`
or a `conversation_id` names its own environment.

Every later call of the same work passes back the `conversation_id`, a retry
included. Without it, Qobra starts a new conversation and the agent loses what
was said. One turn runs at a time per conversation: while one is running,
Qobra refuses the call until
[`get_report_agent_turn`](https://docs.qobra.co/mcp_documentation/tools/get_report_agent_turn) has
waited for it.

```json theme={null}
{
  "instruction": "Show the attainment per rep by quarter, as a bar chart",
  "report_id": "665f1c2e8a4b3d0012a7eb02"
}
```

## Read the result

`status` says where the turn stands:

* `answered`: the turn is over. Relay `answer` to the user.
* `awaiting_user`: the agent asks `pending_question`. The client shows it to
  the user, then sends their reply as the next `instruction` with the same
  `conversation_id`.
* `running`: the turn is still going. Each call waits about 45 seconds, and a
  turn can take several minutes. Call `get_report_agent_turn` with the
  `conversation_id` to keep waiting.

`report` is the report the conversation works on, as `list_reports` lists it,
with the link to open it. A turn that ends on an error is raised as a tool
error that names the conversation, so the client can send the instruction
again in it.

## What the agent may do

What the agent may do follows the user's rights on the report, as in the web
app:

* With write access on every report: create a report, and change its metrics,
  columns, filters, pivot table, chart, sharing and dashboards.
* With write access on this report only: its columns, sorts, pivot table and
  chart.
* Otherwise, it only explains the report.

## Availability

The tool is open to every company with the MCP enabled. Qobra hides it at
discovery unless:

* The company has reporting, AI is switched on and the Analyst is switched on
  in the AI settings.
* The caller can read a report, as in the web app.
* The connection was granted the `mcp:write` scope. See
  [Scopes](https://docs.qobra.co/mcp_documentation/connection.md#scopes).

Each user can start at most 10 agent turns per minute, across
`ask_report_agent` and
[`ask_compensation_agent`](https://docs.qobra.co/mcp_documentation/tools/ask_compensation_agent).
Past that, the call starts nothing and says how many seconds to wait before
calling again in the same conversation.

When the company's AI budget is spent, or Qobra's AI agents are at capacity,
the call is refused and starts nothing. The error says which, so the client can
tell the user to wait for Qobra to restore access or to try again shortly.

## Parameters

> [accordion] Body
>
> **instruction** `string` *required*
>
> What to ask or tell the agent, in the user's words ('show the attainment per
> rep by quarter'), or the user's answer to a question it waits on.
>
> **report\_id** `string`
>
> Id of the report to work on, from list\_reports or create\_report. Omit it to
> have the agent create the report itself; with a conversation\_id, omit it or
> pass that conversation's report.
>
> **conversation\_id** `string`
>
> Conversation to continue: the id an earlier ask\_report\_agent returned. Omit
> it only to start a new conversation.
>
> **sandbox\_id** `string`
>
> Id of a sandbox from list\_sandboxes, to create this in instead of the live
> environment. Omit it to create in live, the company's real data. Never a
> name, never the live id.

## Response

> [accordion] Body
>
> **status** `string`
>
> 'answered': the reply is in `answer`. 'awaiting\_user': the agent asks
> `pending_question`; show it to the user, then send their reply as the next
> ask\_report\_agent instruction of this conversation. 'running': the turn is
> still going; call get\_report\_agent\_turn with this conversation\_id. One of:
> `answered`, `awaiting_user`, `running`.
>
> **conversation\_id** `string`
>
> The conversation of this turn. Pass it back on every follow-up.
>
> **answer** `string`
>
> The agent's reply, to relay to the user. Set when status is 'answered'.
>
> **pending\_question** `object`
>
> The question the agent waits on, with its options (multi\_select: several may
> be picked; the user may also answer freely). Set when status is
> 'awaiting\_user'.
>
> **object properties**
>
> **question** `string`
>
> **options** `string[]`
>
> **multi\_select** `boolean`
>
> **report** `object`
>
> The report the conversation works on, as list\_reports lists it: the one you
> named or the one the agent created. Null until it has created one, or once
> it is deleted.
>
> **object properties**
>
> **id** `string`
>
> **resource\_url** `string`
>
> Web app link to this report.
>
> **name** `string`
>
> **report\_type** `string`
>
> `statement`: built on payout statements; `record`: built on the rows of
> tracked\_datatable. One of: `statement`, `record`.
>
> **description** `string`
>
> **tracked\_datatable** `object`
>
> Data table a record report is built on; null for a statement report.
>
> **object properties**
>
> **id** `string`
>
> Data table id. It may be out of your data table access:
> get\_data\_table then reads it as not found; do not retry it.
>
> **name** `string`
>
> **available\_visualizations** `string[]`
>
> Tiles the report can show on a dashboard: `chart` and/or `pivot_table`,
> as configured on it. Empty when neither.
>
> **section** `object`
>
> Section the report is filed under; null when unfiled.
>
> **object properties**
>
> **section\_id** `string`
>
> **section\_name** `string`
>
> **access** `object`
>
> Who can read this report, split into roles and users, each with the
> level they hold — the same roster shape every saved view speaks. Null
> when the roster is not yours to see (no write access on reports) or the
> report was read from a sandbox, sharing being live-only; never an empty
> roster, which a caller who may see it gets as empty `roles` and `users`
> instead.
>
> **object properties**
>
> **roles** `object[]`
>
> **object properties**
>
> **role** `object`
>
> **object properties**
>
> **id** `string`
>
> **name** `string`
>
> **resolved** `boolean`
>
> **default\_access** `string`
>
> The level this role holds on the whole resource category, which
> reaches every view of it without a share — `read` (view it),
> `write` (edit and re-share it) or `delete` (also remove it),
> each level including the ones before it. Null when the role only
> got this view through a share. One of: `read`, `write`,
> `delete`.
>
> **shared\_access** `string`
>
> The level granted to this role on this view specifically —
> `read` (view it), `write` (edit and re-share it) or `delete`
> (also remove it), each level including the ones before it. Null
> when the role reaches the view through its category access
> rather than a share. One of: `read`, `write`, `delete`.
>
> **users** `object[]`
>
> **object properties**
>
> **user** `object`
>
> **object properties**
>
> **id** `string`
>
> **email** `string`
>
> **name** `string`
>
> **shared\_access** `string`
>
> The level this view is shared with the user at, individually, on
> top of whatever their role already grants — `read` (view it),
> `write` (edit and re-share it) or `delete` (also remove it),
> each level including the ones before it. One of: `read`,
> `write`, `delete`.
