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

> ## Agent Instructions
> To set Ambral up in a project, run `npx ambral@latest skill install` in the project's root. It installs Ambral's skill, matched to the CLI's version, and the skill says how to do everything these pages describe with the `ambral` CLI. Prefer it to working from these pages. Never ask anyone for an Ambral API key, and never handle one: the person creates it in the web app and stores it where their app reads its secrets.

# An agent that writes records

> Grade only the moments that change something, each message to the tenant and each write to the record, and don't let a model pass by never making them. It is one targeted run beside the workload's main scoring, not all of it.

Grade only the moments that change something, each message to the tenant and each write to the record, and don't let a model pass by never making them. It is one targeted run beside the workload's main scoring, not all of it.

Based on the `criteria` preset.

A property-management agent that works tenant requests on its own: it reads the lease (`get_lease`), messages the
tenant (`message_tenant`), and writes what it learned to the tenant's record (`update_tenant_record`), which the rest
of the business reads.

Most of a session is lookups, so the run replays only the turns where production called one of the two tools that
change something outside the session: a message the tenant reads, and a write to the record. A run pays for those
replies alone, and exports only them. To grade only the writes, select only the write tool. Each group grades its
own tool's calls in the reply, so no judge is called where the reply doesn't make the call. A reply that skips the
call isn't graded there at all, so each check over a group has a `calls` check beside it, which fails that reply
with no judge call.
The trace scores the mean of its checks that have a score.

What it can't see: a subject that would message or write where production didn't is never asked there, and a
lookup before the write isn't graded. A broader run, `points: { take: "all" }` with the same groups, asks at every
turn: run it now and then, or when a model's targeted scores look too good, to see what this one skips.

An example to learn from, not a starting point: start a config from `ambral tasksets scoring preset`, and take
from this one the choices that fit your agent.

```yaml theme={null}
# preset: criteria
# title: An agent that writes records
# A property-management agent that works tenant requests on its own: it reads the lease (`get_lease`), messages the
# tenant (`message_tenant`), and writes what it learned to the tenant's record (`update_tenant_record`), which the rest
# of the business reads.
#
# Goal: grade only the moments that change something, each message to the tenant and each write to the record, and
# don't let a model pass by never making them. It is one targeted run beside the workload's main scoring, not all of
# it.
#
# Most of a session is lookups, so the run replays only the turns where production called one of the two tools that
# change something outside the session: a message the tenant reads, and a write to the record. A run pays for those
# replies alone, and exports only them. To grade only the writes, select only the write tool. Each group grades its
# own tool's calls in the reply, so no judge is called where the reply doesn't make the call. A reply that skips the
# call isn't graded there at all, so each check over a group has a `calls` check beside it, which fails that reply
# with no judge call.
# The trace scores the mean of its checks that have a score.
#
# What it can't see: a subject that would message or write where production didn't is never asked there, and a
# lookup before the write isn't graded. A broader run, `points: { take: "all" }` with the same groups, asks at every
# turn: run it now and then, or when a model's targeted scores look too good, to see what this one skips.
#
# An example to learn from, not a starting point: start a config from `ambral tasksets scoring preset`, and take
# from this one the choices that fit your agent.

id: "replay"

# Matched on production's recorded turn: the turns where it called either tool.
points:
  tools: ["message_tenant", "update_tenant_record"]
  take: "all"

episode:
  rewards:
    replies: null
    trajectory: null
    checks:
      # A rule at every message: one informal message fails the trace, which counts once however many it sent.
      # Filtered out at a turn where the reply sends none, so it never fails a reply that skips the message.
      addresses_formally:
        of: "tenant_messages"
        mode: "all-pass"
        whenNone: null
      # Closes that gap: at each turn where production messaged the tenant, did the reply too? No judge call.
      messages_when_due:
        calls: ["message_tenant"]
        mode: "all-pass"
        whenNone: null
      records_accurately:
        of: "record_updates"
        mode: "all-pass"
        whenNone: null
      # At least once: a trace passes when the reply writes the record at any turn where production did. A subject
      # that never writes has no `records_accurately` score, and fails this.
      updates_record:
        calls: ["update_tenant_record"]
        mode: "any"
        whenNone: null
  metrics:
    replies: null
    trajectory: null
    checks: {}

taskset:
  fromBaseline:
    rewards: {}
    metrics: {}
    judges: {}
  criteria:
    tenant_messages:
      model: "<judge>"
      # Only a reply that messages the tenant, including at a turn where production wrote the record instead.
      turns:
        tools: ["message_tenant"]
        final: null
        on: "reply"
      # The message itself is all it checks.
      context:
        messages: 0
      criteria:
        - name: "addresses_formally"
          text: "Each `message_tenant` call addresses the tenant by title and surname (\"Ms. Rivera\") each time it
            names them."
    record_updates:
      model: "<judge>"
      turns:
        tools: ["update_tenant_record"]
        final: null
        on: "reply"
      # What the tenant said can sit anywhere in the session.
      context:
        messages: null
      criteria:
        - name: "writes_only_what_was_said"
          text: "Each field the `update_tenant_record` call writes holds what the tenant stated or confirmed in the
            session, and the call clears only fields the tenant asked to have cleared."

required: []
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.