> ## 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_compensation_agent

> Run one turn of a conversation with Qobra's compensation agent. It saves its changes as the compensation's draft and never publishes them.

Hand the design of a compensation to Qobra's **compensation agent**, the agent
the web app calls the Architect. Each call runs one turn of a conversation in
which the agent builds, changes or explains a compensation's calculation:
scopes, fields, formulas, tiers, accelerators and payout.

Use it when the user wants a compensation built or changed from a description
in their own words ("pay 5% of every closed deal"), or wants to understand why
a compensation computes what it does.

## Start and continue a conversation

Start a conversation with an `instruction` and the `compensation_id` to work
on. [`get_plan`](https://docs.qobra.co/mcp_documentation/tools/get_plan) lists a plan's
compensations, and
[`create_compensation`](https://docs.qobra.co/mcp_documentation/tools/create_compensation) opens an
empty one.

Every later call of the same work passes back the `conversation_id` the first
call returned, a retry included. Without it, Qobra starts a new conversation
and the agent loses what was said. Qobra refuses an instruction sent while a
turn is still running in the conversation.

```json theme={null}
{
  "instruction": "Pay 5% of every closed deal, 7% above quota",
  "compensation_id": "665f1c2e8a4b3d0012a7eb01"
}
```

## Read the result

`status` says where the turn stands:

* `answered`: the turn is over. Relay `answer` to the user.
* `awaiting_user`: the agent paused on a question (`pending_question`) or on a
  plan of changes to validate (`pending_plan`). The client shows it to the user
  as it is, waits for their reply, and sends that reply as the next
  `instruction` with the same `conversation_id`. Approving a plan is the user's
  decision, not the model's.
* `running`: the turn is still going. Each call waits up to 45 seconds, and a
  turn can take several minutes. Call
  [`get_compensation_agent_turn`](https://docs.qobra.co/mcp_documentation/tools/get_compensation_agent_turn)
  with the `conversation_id` to keep waiting.

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.

## Draft only, never published

The agent saves what it changes as the compensation's **draft**. Nothing
reaches a statement until the draft is published, with
[`update_compensation`](https://docs.qobra.co/mcp_documentation/tools/update_compensation) (`status:
'live'` or a `go_live_date`) or from the Qobra web app. Each turn starts from
the latest draft, including one edited in the app meanwhile.

The result's `compensation` is the live compensation, in the same shape
[`get_plan`](https://docs.qobra.co/mcp_documentation/tools/get_plan) lists it. Its `id` is the
`compensation_id` to pass to `update_compensation` and to every later call. Its
other fields and its `resource_url`, the link that opens the draft to review,
are read off the draft. `saved` is `true` when the turn's changes were saved as
the draft. It is `false` when nothing was saved, and `save_note` says why.

## Availability

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

* AI is switched on for the company and the Architect is switched on in the AI
  settings.
* The caller's role has write access on plan compensations, 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_compensation_agent` and
[`ask_report_agent`](https://docs.qobra.co/mcp_documentation/tools/ask_report_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, or the user's answer to
> the question or plan it is waiting on.
>
> **compensation\_id** `string`
>
> Id of the compensation to work on, as get\_plan lists it or
> create\_compensation returns it. Needed to start a conversation; when passed
> with a conversation\_id it must be that conversation's compensation.
>
> **conversation\_id** `string`
>
> Id of a conversation of yours to continue, as an earlier
> ask\_compensation\_agent call returned it. Omit it only to start a new
> conversation on compensation\_id.

## Response

> [accordion] Body
>
> **status** `string`
>
> 'answered': the turn is over, its reply is in answer. 'awaiting\_user': it
> paused on a question (pending\_question) or a plan to validate
> (pending\_plan): show it to the user and send their reply with
> ask\_compensation\_agent, in this conversation. 'running': the turn goes on;
> call get\_compensation\_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 call.
>
> **answer** `string`
>
> The agent's reply when status is 'answered', to relay to the user. Null
> otherwise.
>
> **pending\_question** `object`
>
> The question the agent is waiting on, with the options it offers
> (multi\_select: several may be picked; the user may also answer in their own
> words). Set only when status is 'awaiting\_user'.
>
> **object properties**
>
> **question** `string`
>
> **options** `string[]`
>
> **multi\_select** `boolean`
>
> **pending\_plan** `object`
>
> The changes the agent proposes, waiting for the user to approve or amend
> them; it applies nothing before. Set only when status is 'awaiting\_user'.
>
> **object properties**
>
> **summary** `string`
>
> **changes** `object[]`
>
> **object properties**
>
> **step** `integer`
>
> **action** `string`
>
> One of: `create`, `edit`, `delete`.
>
> **name** `string`
>
> **description** `string`
>
> **entity\_type** `string`
>
> **old** `string`
>
> **new** `string`
>
> **details** `string[]`
>
> **compensation** `object`
>
> The compensation the turn worked on, as get\_plan lists it: its id is the
> compensation\_id of every later call, and update\_compensation with that id
> and status 'live' publishes the turn's draft. Its other fields and its
> resource\_url, which opens the draft to review, are read off that draft when
> one is stacked on it.
>
> **object properties**
>
> **id** `string`
>
> **resource\_url** `string`
>
> Deep link to open this compensation's configuration in the Qobra web
> app.
>
> **name** `string`
>
> **recurring** `boolean`
>
> True when the compensation has no window: it is calculated on each
> period of its cadence. False when it is bounded to one, from start\_date
> to end\_date. A compensation bounded to a window is calculated once, over
> the records of the whole window, on the statement closing the period of
> its cadence that holds end\_date (with EACH\_MONTH, the period of end\_date
> itself): the statements of the periods before carry no line for it. A
> cadence that does not calculate on that period never calculates it:
> EACH\_MONTH\_EXCEPT\_END\_OF\_QUARTER with an end\_date in a quarter's last
> month, or Q1-Q4 with an end\_date outside that quarter, on the company's
> fiscal calendar. To pay every period over a limited time, leave the
> compensation recurring on a plan of its own whose members are bounded to
> that time (the start\_period and end\_period of their attribution,
> create\_plan, update\_plan). An attribution is month-granular, and a
> period of the cadence it touches is calculated over all of its records:
> the limit is exact with EACH\_MONTH, or when the attribution covers whole
> periods of the cadence, and a quarterly compensation limited from
> February to April still pays the records of January and of May and June.
> An attribution covers every compensation of its plan, so bounding the
> members of a shared plan ends all of them.
>
> **start\_date** `string`
>
> YYYY-MM-DD; the first day of the compensation's window, null when it is
> recurring.
>
> **end\_date** `string`
>
> YYYY-MM-DD; the last day of the compensation's window, included, null
> when it is recurring.
>
> **period** `string`
>
> How often the compensation is calculated, on the company's fiscal
> calendar. EACH\_MONTH every month; EACH\_MONTH\_EXCEPT\_END\_OF\_QUARTER every
> month but the one each quarter closes on; EACH\_QUARTER, EACH\_SEMESTER
> and EACH\_YEAR at each period's close; Q1-Q4 once a year, at that
> quarter's close only. A compensation bounded to a window is calculated
> at most once: on the statement closing the period of its cadence that
> holds the window's last day, and never when its cadence does not
> calculate on that period.
>
> **status** `string`
>
> "live": published. "draft": not published (never published, or
> unpublished), so no statement carries it.
>
> **description** `string`
>
> The compensation's own free-text note, as written on the plan; null when
> it carries none.
>
> **flagged\_metrics** `object[]`
>
> The reporting metrics this compensation feeds, one per metric. A plan is
> missing from a metric's report only when none of its compensations feeds
> it.
>
> **object properties**
>
> **id** `string`
>
> **name** `string`
>
> **type** `string`
>
> One of: `float`, `amount`, `percentage`, `string`, `picklist`,
> `multipicklist`, `bool`, `date`, `user`, `object`, `group`,
> `record_status`.
>
> **saved** `boolean`
>
> True: the turn's changes were saved as the compensation's draft, which no
> statement reads until it is published. False: nothing was saved, save\_note
> says why. Null while a turn runs, and for a turn asked from the web app,
> which saves from its own page.
>
> **save\_note** `string`
>
> Why nothing was saved, to tell the user. Null when the turn was saved or is
> still running.
