Skip to main content
This recipe turns one request into a draft that meets a rubric. A webhook brings the goal and the rubric, the Writer Agent drafts, a Model block scores the draft from 1 to 10, and a score under 8 sends the draft and the reviewer’s reason back to the Writer. After 3 drafts the run ends as not passed.
The Checkfu CLI and TypeScript SDK are private-alpha artifacts with no self-service public installation channel. Part of this flow is behind a rollout fence; a deployment that has not enabled it refuses the request rather than running it. Confirm capability status before making availability part of your application’s contract.

Before you start

You need:
  • An API key with the admin or root role in CHECKFU_API_KEY.
  • A service account for the Automation to run as (RUNS_AS, a prin_…), and the person who authors it (AUTHOR, a prin_…). An API key is not a person, so a create through an API key names the author.
  • The Writer Agent (WRITER_AGENT).
  • The Environment the Agent runs in (ENVIRONMENT). When the Workspace has exactly one, delete the environment_id line and leave out ENVIRONMENT.
  • A model routing profile with the key fast-judge, or change route.profile to one you have.
The CLI examples use CLI access and the TypeScript examples use the TypeScript SDK.
1

Create the draft

Save the recipe as outcomes.yaml. It is the published outcomes.yaml with created_by_principal_id added:
outcomes.yaml
The draft is saved paused and unpublished.
Keep the auto_… id it returns:
2

Grant what it needs

The service account needs act_as on the Writer and use_model on the route. List what the draft needs and what is missing:
Each entry has a status of granted or missing, the blocks that need it and a plain message. Grant a missing one with a PermissionAssignment:
A grant that already exists answers 409.
3

Test the draft

A test is a real run of the draft with a sample request. It starts real Sessions and lists them as its effects, but registers no trigger.
4

Publish

Publishing makes the draft the live version and returns the webhook URL and its signing secret. The secret is shown once; store it where your sender can sign with it.
The summary says what publishing did, for example “Listens for signed webhooks at POST /v1/ingest/automations/auto_…”. Rotate the secret with POST /v1/automations/{id}/webhook-secret.
5

Run it and read the result

A signed webhook starts a run. You can also run the live version now with the same request:
List the runs and their status:
A run that passed ends completed. A run whose third draft still failed ends as not passed, and the automation_run.completed webhook event carries result: "not_passed".

Pause and resume

Pause stops webhooks from starting runs; a manual run still works. Resume turns triggers back on.

Change it

Edit the document and replace the draft with PATCH /v1/automations/{id} and its expected_draft_revision, then test and publish again. Each run records the version it used, and checkfu automations versions $AUTOMATION lists them. See Automations for every block and field.