Agents overview

An agent is a configured reasoner that works on the Ontology. It reads objects through tools, calls functions, and when it decides something should change, it proposes an action for a person to approve. It always acts on behalf of a named person and can never see or do more than that person can. Every step it takes is recorded in a reasoning trace, and, on request, no version is released without passing its evaluation suite

16 stepsDefault step limit per run, raisable to 64
On behalf ofRuns with one person's access, never more
ProposalsChanges are staged for approval by default
TracedEvery step, tool call and citation is recorded

In the platform today

Built
  • Agents run in the platform service, defined in ontology.yaml under agents
  • An agent has instructions, a tier and effort, the functions and actions it may use, and a step limit, 16 by default and 64 at most
  • Each step asks the model gateway for the next move, and tool calls run as the person the agent acts for
  • Agents read objects, follow links, aggregate, call their functions and propose their actions; a person approves every proposal
  • Every run is in ops.agent_runs and every model and tool call in ops.agent_steps
  • Without a model, or past a budget, the agent runs its playbook, a fixed sequence of function calls and proposals, and the run says so
  • Agent teams, and a predict_<model> tool for each trained model an agent or team member lists in models: [...], as described on tools and guardrails
  • POST /api/v2/agents/{id}/runs starts a run in the background and answers at once, or with the finished run when ?wait= up to 60 seconds is long enough
  • GET /api/v2/agents/{id}/runs/{run}/trace returns its steps, written as the run goes; ?after= returns only the new ones. POST /api/v2/agents/{id}/runs/{run}:cancel stops a run before its next step
  • Every state a run can be in is under ending a run
  • Proposals expire: an agent can give one its own expiresAt, else the action type's proposalExpiry or the ontology's proposals.expireAfter applies, and an expired proposal cannot be approved
On request
  • Autonomy levels and auto-apply, the run token, parallel tool calls, time and cost limits on a single agent and release gates on this page
Requirements
  • Editor role on the ontology to define or change an agent, and Owner to release a version; Viewer is enough to start a run where the agent is shared with you
  • The access labels on any data the agent's tools read, held by the person the run acts for
  • At least one model route in the model gateway for each task class the agent uses, set up by an Administrator
  • A released evaluation suite before any version can be released, and the action types it proposes allowing agents

What an agent is

An agent is a versioned definition in the Ontology registry, run by the agent runtime. The definition is small and declarative. It says what the agent is for, which tools it may use, which model route it uses for each kind of step, how much it may do on its own, and which evaluation suite must pass before a version is released. The intelligence is in the model; the safety is in everything around it, and that part is not the model's to change

PartWhat it holdsExample for the weekend readiness planner
InstructionsPurpose, the decisions it supports, house rules"Find shops at risk of running short before Sunday close and propose transfers or extra runs"
ToolsObject queries, functions, action proposals, notificationsweekend_cover, room_left, propose reallocate-tubs
Model routesGateway task classes for planning, tool selection and summariesplan to a large model, summarize to a small one
Autonomy levelSuggest, stage or auto-apply within limitsStage
LimitsSteps, wall-clock time, tokens, cost, proposals per run16 steps, 5 minutes, $0.60 CAD, 10 proposals
Evaluation suiteCases and graders that gate each releaseweekend-planner, with a threshold of 1.0
OwnerThe person or group responsible for its behaviourShop managers

Agents are not chat bots bolted onto a database. A run has a defined input, typically an object or an object set, a defined output of an answer with citations plus zero or more proposals, and a hard upper bound on what it can consume. That makes runs testable and comparable across versions, which is the property everything else on this page depends on

The step loop

A run is a loop of steps. In each step the runtime assembles the context, asks the model what to do next, checks the request against the agent's guardrails, executes the tool, and adds the result to the context. The loop ends when the model returns a final answer, when a limit is reached, or when a guardrail stops it. The model never calls a tool directly. It asks, and the runtime decides

Run startsinput object or set One step, repeated up to the step limit Assemble contextinstructions, history, results Model stepvia model gateway Guardrail checkallowed, in limits, valid Execute toolwith the person's access Observe: result and cited object versions added to the context tool request final answer Run outputanswer, citations,proposals blocked Approval inbox Stops early on: step limit · time limit · token or cost budget · guardrail block · person cancels
The runtime, not the model, executes tools. A blocked request is returned to the model as an observation it can respond to, and repeated blocks end the run

Context assembly is where most of the engineering lives. The runtime keeps the instructions and the run input fixed at the top of the context, appends each step's tool request and a compact rendering of its result, and summarizes older results as the context fills. Object results are rendered as typed records, the same way AI functions render retrieval, so the final answer can cite them. Large results are truncated to a declared maximum per tool, with a note telling the model how to page for more

Each step is one model call and at most one tool call by default. Agents can be allowed parallel tool calls, up to four per step, for read-only tools. Parallel calls run concurrently and count as one step, which matters for agents that check twenty shops one tool call at a time. Write tools, meaning proposals and notifications, are never parallel

Ending a run

A run is in one of these states. The first three are on its way, and the rest are where it ends. A run that ends on a limit keeps its trace and what it found so far, and any proposals it already staged stay in the inbox. Limits are not an error; they are a signal that the task was bigger than the agent was sized for

StatusMeans
queuedAccepted and waiting for a worker
runningWorking through its steps
waitingAsked the person a question and waits for the answer, with its worker freed
completedEnded with a final answer
limit_reachedStopped at its step limit, or a team at the team's step limit
cost_limit_reachedA team stopped at its cost limit
blockedA check with level: block fell short, as described on tools and guardrails
refusedThe model declined the request
failedEnded on an error it could not recover from
cancelledStopped by the person it acts for or an administrator
expiredIts question went unanswered past askTimeoutHours, 24 by default
interruptedIts copy of the service stopped while it ran, with no heartbeat for 2 minutes. It is never run again on its own, so nothing it proposed is proposed twice

Defining an agent

Agents are defined under agents in ontology.yaml, and changed through a model change set like any other definition. This is the creamery's weekend readiness planner, shortened. In the sample workspace it runs without models, ask and checks; their lines show where they go

agents:
  - id: agt-weekend
    name: Weekend readiness planner
    tier: smart
    effort: medium
    stepLimit: 16                          # 64 at most
    instructions: |
      You plan the creamery's weekend for the scoop shops. Use shop_stock_balance first to see
      which open shops run short of which flavours Friday to Sunday, then reefer_issue
      for any run a bridge restriction holds. Prefer moving tubs between shops in the
      same region a day ahead, then a top-up on a run that lands in time. Propose the
      moves with a one-line reason each, and say what you could not cover.
    functions: [shop_stock_balance, weekend_cover, reefer_issue, reopening_readiness]
    actions: [reallocate-tubs, transfer-tubs, order-tubs, top-up-delivery, reroute-delivery]
    models: [shop-sales]                   # a predict_shop-sales tool
    ask: true                              # an ask_person tool: the run can stop and ask
    askTimeoutHours: 24                    # unanswered this long, the run ends expired
    checks:
      - { id: shops-found, name: Shops found, after: search_objects,
          count: count.matching, min: 1, level: warn }
    playbook:                              # runs without a model, or past a budget
      - { call: shop_stock_balance, args: {} }
      - { proposeAll: "{{steps.0}}", rationale: "Short this weekend" }
      - { say: "{{steps.0.headline}}. The proposals are waiting for your approval" }

The full set of tools, and the checks on their results, are in tools and guardrails

Agent teams

Some tasks need several kinds of work at once. When an aircraft is on the ground, someone has to find the part, someone has to protect the flights and find a technician, and someone has to draft the deferral note. An agent team is a lead with members for that. The lead runs on the frontier tier, plans, hands each member a task with a delegate tool, reads what they report and answers. Members have their own instructions, tools, tier and step limit, run under the same person and cannot hand work on. This is built, and Markham Aviation's aog-recovery team is the example

agents:
  - id: aog-recovery
    name: AOG recovery team
    functions: [aog_options]               # the lead's own tools
    stepLimit: 12
    team:
      stepLimit: 40                         # model steps across the whole team
      costLimitCad: 3
      order: [parts, crew, records]         # playbook order without a model
      members:
        - id: parts
          tier: fast
          stepLimit: 8
          functions: [aog_options, find_part]
          actions: [transfer-part, reserve-part, expedite-repair-order]
        - id: crew
          tier: smart
          functions: [aog_options, technicians_available]
          actions: [swap-aircraft, assign-technician]
        - id: records
          tier: fast
          functions: [aog_options, remaining_life]
          actions: [defer-defect]
  • Approvals. A member's proposals go through the same approvals as a single agent's, proposed by agent:aog-recovery/parts and so on
  • Limits. The team's step limit counts model calls across the lead and every member, and its optional cost limit in Canadian dollars is read from the run's usage. Either one stops the run with what members reported so far
  • Trace. Every step in the trace names the member who took it, and the Agents screen shows a team run's steps by member
  • Without a model. Each member's playbook runs in order, then the lead's, which can quote what members found. A member whose own call has no route falls back to its playbook

GET /api/v2/agents/{id} returns the team's shape

Acting on behalf of a person

Every run has two identities: the agent, and the person it acts for. The runtime exchanges the person's token for a run token that carries both, scoped to the run and expiring when it ends. Every read, function call and proposal the agent makes is authorized against the intersection of what the person can do and what the agent's tool list allows. An agent with a tool to read Production batch cannot read a batch labelled QUALITY for a person who does not hold that access label, and a person who can edit deliveries cannot make an agent edit them if the agent has no tool for it

How the run startsOn behalf ofNotes
A person asks in the Assistant or an appThat personMost common. Proposals go to that person's inbox
An automation firesThe automation's ownerThe owner must hold a role that can run the agent. When the owner is deactivated, the automation runs as the service owner named at deactivation or in directory.serviceOwner, and stops when none is named
A scheduleThe schedule's ownerSame rules as automations
The REST API with a user tokenThe token's userAuthorization code with PKCE
The REST API with client credentialsThe service account named in the requestRequires the service account to be allowed to delegate to the agent

The person's identity appears on every trace span and every proposal, and every applied action logs the agent, the agent version, the run and the approver separately. Questions like "which of last month's reroutes did the planner propose and who approved them" are one query on the action log

Proposals, not writes

By default an agent cannot change the Ontology. Its write tools create proposals: a pending application of an action type with the parameters the agent chose, the edits that action would make right now, the reasoning that led to it and the objects it cites. Proposals land in the approval inbox of the person the agent acted for, or of a group named on the action type

  1. Propose. The agent calls a propose tool. The runtime validates the parameters and runs the action as a test run, so a proposal that would fail its action conditions is rejected at once and the agent is told why
  2. Review. The approver sees the proposed edits as before and after values, the agent's rationale with citations, and any warnings, such as an object that changed after the agent read it
  3. Decide. Approve as is, edit the parameters and approve, or reject with a reason. Rejection reasons are stored and feed the agent's evaluation data
  4. Apply. Approval applies the action as the approver, with fresh validation and fresh edits computed against current data. The action log records the agent run and the approver

Proposals expire, because the facts they rest on go stale. A planner approving Thursday's transfer proposals on Saturday morning would be approving against Thursday's stock. Expiry is set per action type with proposalExpiry, from 15 minutes for time-critical actions such as rerouting a truck to 7 days for planning actions, with a default for the ontology under proposals.expireAfter (24 hours in the sample airline). An agent can give a proposal its own expiresAt, such as the end of the day it is for. An expired proposal leaves the decision rail, can no longer be approved, and is recorded in the audit log

Approval always recomputes

The edits shown in a proposal are a preview. When it is approved, the action runs again against the current state. If the result differs from the preview, for example because a delivery's status changed, the approver sees the difference and confirms again before anything commits

Autonomy levels

An agent answers and proposes, and a person approves every proposal. On request, an agent can apply low-risk actions within a policy; everything else waits for approval

Running an agent

Runs are started from the Assistant, from an app, from an automation or from the API. In the platform service, input is the request in words and context carries keys and facts the agent needs. The call answers at once with the run, 202 with status queued, and a worker runs it in the background. With ?wait=, up to 60 seconds, it answers 200 with the finished run when the run ends in that time

POST /api/v2/agents/agt-weekend/runs
{
  "input": "Which Nova Scotia shops run short of any flavour before Sunday close?",
  "context": { "province": "NS" }
}
// 202 Accepted
{
  "run_id": "run_01JA2F6Q…", "agent": "agt-weekend", "user_id": "shops.nguyen",
  "status": "queued", "source": "api", "steps": 0, "tool_calls": 0,
  "answer": "", "proposals": [], "trace": []
}

Follow a run with GET /api/v2/agents/{id}/runs/{run}/trace?after=<step>, which returns only the steps after that number, or with the runs:<run id> stream topic, which sends a short event for each change and each step to the person the run acts for and administrators. GET /api/v2/agents/{id}/runs/{run} returns the run without its trace: its status, answer, proposals, tokens and cost. POST /api/v2/agents/{id}/runs/{run}:cancel stops it before its next step. On request, a run can use a named version with lower limits

A run can stop to ask the person a question and go on from their answer, one agent can run over many objects as a batch, and each copy of the service limits how many runs work and wait at once. Running agents covers questions, batches and limits

Limitations

  • An agent can never see or do more than the person it acts for, and the tool list narrows that further; there is no way to give an agent its own broader access
  • Agents propose and never write directly; a person approves every proposal
  • A run that reaches its step, time, token or cost limit stops and returns partial results with its trace; it does not resume from where it stopped
  • Write tools, meaning proposals and notifications, never run in parallel, and parallel read calls are capped at four per step
  • A proposal is a preview against the data as it was; approval recomputes the edits, and a proposal that is not approved before it expires cannot be applied
  • When the owner of an automation or schedule that runs an agent is deactivated, it passes to the service owner named at deactivation or in directory.serviceOwner, and stops until someone takes it over when none is named
  • Model output is not deterministic, so two runs on the same input can reach different answers; evaluation suites measure this, they do not remove it
  • Team members cannot delegate, and a team has one level: a lead and its members. When the lead hands out several tasks in one turn, members work at the same time, up to the team's parallel setting, 4 by default and 8 at most

Related