Accountant Portal

Finish a bookkeeping agent run

Changed on

Agent key only. Records outcomes and model spend in micro-USD, and for a killed run the stop reason the agent gives (stopReason). A run finished failed on its last allowed attempt, with nothing reserved, also creates one bookkeeping_question task on the company's primary accountant saying the transaction could not be processed automatically (source key txn:<transaction>:unprocessed); a reconciliation gets none, and the response is the same either way. Mounted only when the deployment enables the bookkeeping agent (default off); otherwise 404. The shared cloud-bookkeeping service token gets 404 here.

post/accountant/companies/{customerId}/agent/runs/{runId}/finish

Request

  • Base URL
    https://api.medianfi.com/api/v1
  • Auth
    HTTP bearer

Path parameters

customerId, string uuid required
runId, string uuid required

Request body

BookkeepingAgentRunFinishInput required
status, 'applied' | 'queued' | 'blocked_phi' | 'capped' | 'killed' | 'failed' required
outcomes, object[]
model, string
provider, string
promptTokens, integer
completionTokens, integer
costMicros, integer

Micro-USD.

stopReason, 'window_open' | 'pairs_not_live' | 'categorize_not_live' | 'source_paused'

Why a killed run stopped (422 with any other status). window_open, the row's document match waits for its date window to settle. pairs_not_live, the row is a card payment whose other side is in the books while transfers.pairs is not live for the company. categorize_not_live, the agent judged the row while categorize is not live for the company (F8), so nothing was written or asked. Kept on the run until it is reopened, and given as the run's reasonCode in the agent activity report.

Response

Success envelope

object required

Changes