Tools and guardrails

An agent can only do what its tools allow. A tool is a typed capability with a name, a description for the model, an input schema and a scope: which object types, properties, functions or actions it reaches. The runtime checks every tool request against that scope, the acting person's permissions and the run's limits before executing it. Guardrails are those checks, plus the rules that keep untrusted text from steering the agent

8 kindsQuery, search, aggregate, function, predict, propose, notify, ask
As the personEvery tool call runs with the access of the person the agent acts for
ApprovalA proposal waits for a person
0Tools an agent can add or change for itself

In the platform today

Built
  • Every agent gets read tools to search objects, read one object, follow a link and aggregate, plus one tool per function it lists, one per trained model it lists under models: and one to propose the actions it lists
  • A search or link returns how many objects matched and how many are shown, then whole objects up to a size limit, and can ask for only some properties
  • The agent is told only about properties the person can see
  • All of them run as the person the agent acts for, and a proposal waits for a person
  • The lead of an agent team also gets a tool to delegate, and a team member can be given only its own functions and actions with readTools: false
  • The Assistant's agent adds a search tool, which runs hybrid keyword and similarity search and returns citations
  • Step limits per agent, per member and per team are enforced
  • An agent given ask: true also gets ask_person, to ask the person, and an agent's checks judge tool results as the run goes, as described under checks on tool results
On request
  • The notify kind, declared scopes and caps per tool, parallel calls, content rules and injection checks below

Tool kinds

Every tool is one of eight kinds. The kind decides what the runtime executes and which checks apply. The model sees each tool as a name, a description and a JSON Schema for its input, generated from the tool's declaration and the Ontology types it touches. It never sees the scope, the limits or the permissions, because none of them are the model's to negotiate

Kind and effectWhat it doesExample
query
Reads
Filters and traverses an object type, returning objects with allowed propertiesShops on the island with a freezer alarm today
search
Reads
Full-text, fuzzy or vector search over an object typeBatches whose hold reason mentions "underfill"
aggregate
Reads
Counts, sums and group-bys over an object setTubs shipped by flavour this week
function
Reads
Calls a query function or AI function at a pinned versionweekend_cover@1.4.2
predict
Reads
Calls a deployed trained model as a typed function, with rows checked against its input columnspredict_shop-sales for the next two weeks
propose
Stages a write
Creates a proposal to apply an action type, after a test runPropose reallocate-tubs of 8 tubs
notify
Stages a message
Drafts a message to a person or group, sent on approval or by policyDraft a note to the city shop manager
ask
Neither
Pauses the run and asks the person a question"Is the 06:30 sailing confirmed?"

There is no generic tool for arbitrary HTTP requests, SQL or code execution. Anything an agent needs beyond the Ontology goes through a function, which has its own egress allowlist, version and tests. This keeps the surface an agent can reach small enough to review on one screen

Asking the person

An agent with ask: true gets an ask_person tool. A playbook does the same with an ask step

  • The agent asks one to five questions in one call, each a choice, several choices, text, a number or a date, with optional options, a default and why it asks
  • The run waits with status waiting
  • The person answers with POST /api/v2/agents/{id}/runs/{run}:answer, and the run goes on from where it stopped with the answers as the tool's result
  • Unanswered past askTimeoutHours, 24 by default, the run ends expired
  • The answer is a step of its own, so the trace shows exactly which facts came from a person

Running agents has the details

Notify

On request, an agent can draft a message for approval. A drafted message is sent only when the approver releases it

Declaring tools

An agent lists the functions, trained models and actions it may use, and gets read tools to search, read one object, follow a link and aggregate. Every call runs as the person the agent acts for, with row access, field access and access labels applied exactly as on a screen, and a proposal waits for a person. On request, tools narrowed to fixed filters and caps, and proposals that must cite objects the agent read

Guardrails and their defaults

Each agent has a step limit, set with stepLimit, and an agent team has one for the lead, each member and the whole team. On request, further limits per tool and per run, such as calls, proposals and cost

Checks on tool results

An agent's checks judge a tool's result as the run goes

  • A check names the tool it follows with after, counts a list in the result or reads a number at count, optionally only the list items matching where, and holds it against min
  • Each check is a step of its own in the trace, with its score, its rationale and its attempts
  • One that falls short marks the step with a warning and the run goes on with level: warn, the default, or stops the run with status blocked with level: block
  • A check can call a second agent first, as a run of its own linked to this one, and keep its answer

Ashgrove's project assessment checks that it found enough lessons from past projects

checks:
  - id: precedent
    name: Enough precedent
    after: find_guidance                 # a function by its name, or a read tool
    count: lessons
    min: 2
    level: warn                          # or block: the run stops
    call:
      agent: precedent-search
      input: "Past projects with a problem like this one: {{input.text}}"

Content rules

On request, output rules check the final answer and every drafted message: a message may only go to recipients who can see every object it cites, and drafted text is checked against blocked terms you configure

Blocked actions

An action type can declare that agents may never propose it. Posting a supplier invoice or setting a price is a common example: the creamery requires a named person in purchasing to apply those by hand, every time. An agent version that lists a propose tool for a blocked action fails validation at publish, so the rule cannot be bypassed by misconfiguration

Untrusted content

Agents read text written by people outside the organization: complaint emails, supplier notes, carrier messages, free-text fields synced from a point of sale. Any of it can contain instructions aimed at the agent, by accident or by design. On request, untrusted text is labelled and kept apart from instructions, reading it can remove write tools for the rest of the run, and injection cases run on every release

Permissions are the real boundary

No prompt defence is complete. Design on the assumption that an agent may be persuaded to request anything its tools allow, and make sure that everything its tools allow is acceptable for the person it acts for. Narrow tools, tight parameter constraints and approval for writes are what keep a persuaded agent harmless

Functions as tools

Any query function or AI function can be a tool. The tool's input schema comes from the function's signature, and its description from the function's description unless you override it in the tool declaration. Write descriptions for the model the way you would for a new colleague: what the function answers, what the inputs mean, what the units are and when not to use it

import { query } from "@marklandstreet/functions";

export const room_left = query({
  description:
    "Pallets of room left on a reefer run, from its trailer capacity and the pallets " +
    "loaded. Use before proposing a top-up. Returns whole pallets; a run with no " +
    "capacity on file counts 10. Does not include top-ups proposed in this conversation",
  inputs: {
    delivery: { type: "object", objectType: "reefer-delivery", required: true },
  },
  output: "integer",
}, async (ctx, { delivery }) => {
  // delivery arrives as the object, read as the caller
});

Function tools return their typed output rendered as JSON, with any object references turned into citation handles. A function that returns a large list should accept a limit argument, or the runtime truncates its rendered output to the per-result token cap and tells the model it did so

Trained models as tools

models: [late-departure] on an agent, or on a team member, gives it a predict_late-departure tool for each listed trained model the person can see and call. The tool is the model's deployed alias as a typed function: its input columns are the tool's schema, rows are checked before the model runs, and every prediction is logged with the agent and the person. A playbook step { predict: late-departure, rows: [...] }, or objects: [...], does the same when no language model is connected

agents:
  - id: departure-desk
    name: Departure desk
    functions: [aog_options]
    models: [late-departure]
    actions: [swap-aircraft]

Testing tools and guardrails

On request, guardrail cases give the agent an input designed to provoke a blocked behaviour, such as an email asking it to transfer all strawberry to one shop, and run with its evaluation suite on every release

Limitations

  • There is no tool for arbitrary HTTP requests, SQL or code execution; anything outside the Ontology has to be wrapped in a function
  • An agent can never exceed the access of the person it acts for, and a proposal always waits for a person
  • An action type blocked for agents cannot be proposed by any agent version, and no per-agent setting overrides that
  • Guardrail changes are agent version changes, so a raised limit takes effect only after the new version passes review and its evaluation suite

Related