Recorder

Anthropic API

Wrap each messages.create call. Cache reads and writes are counted correctly.

  1. Copy harness_recorder.py into your project.
  2. Wrap the shared function that calls the model, as below.

Wrap a call

from harness_recorder import Recorder, usage_from
run = Recorder("support-triage", "2.1.0").start_run(ticket_id)
with run.agent("draft_reply", prompt_ref="prompts/drafter@6", model="anthropic/claude-sonnet-5") as step:
    resp = client.messages.create(model="claude-sonnet-5", max_tokens=1200, messages=messages)
    step.model_call(**usage_from(resp))
run.finish("completed")

Where the log lands

Wherever your service logs go, or a folder.

How it reaches the harness

You download the logs with your own access.

Read the full guide on GitHub

Add the recorder

20 platform guides in total.