Awesome Testing

API lesson 05 · Place conversation state

Where should each piece of conversational state live?

Shared system · deterministic provider fixtures

Harbor Support Drafting API. One bounded request moves through typed items, tools, state, budgets, and evidence without live provider calls.

01 · Smallest useful mechanism

Separate provider continuation, replayable history, and canonical product data.

APIs support manually replayed items, response chaining, or durable conversation objects. Each choice changes retention, portability, observability, token cost, and recovery.

A model conversation is not the system of record.

02 · Experiment

Test the prediction

Deterministic protocol fixture

This workbench uses inspectable provider-event fixtures and injected failures. It does not make live calls or execute external effects.

Protocol workbench · harbor-state-v2

Choose the resume strategy after policy and authorization changed.

Injected failure

The saved conversation says “approved” but current policy denies the operation.

Choose the implementation

The trace has not run.

Commit to an implementation, then inject the failure and inspect the actual state transitions.

03 · Implementation brief

Build it, break it, prove the outcome.

Implement
Create a context manifest naming owner, lifetime, sensitivity, freshness, and replay rule for each state class.
Break it on purpose
Resume with deleted preferences, stale policy, missing tool results, and a cross-tenant handle.
Completion evidence
The context is rebuilt safely, volatile facts refresh, deletion holds, and invalid handles fail closed.

Your learning artifact

Write the argument you would defend

Stored only in this browser. No account required; course reset does not delete it.

04 · Check your understanding

Which data should remain canonical outside the model conversation?

Primary sources · verified 2026-08-02

What the fixture does not prove

Hidden or stale conversation state can leak data, preserve revoked preferences, lose tool evidence, or make incidents impossible to reproduce.

Common mistake: Passing a previous-response ID means earlier tokens are free and current. Continuation can simplify state handling, but prior context may still be processed or billed and external facts still require freshness checks.

Transfer exercise: Resume a case after the policy version and user authorization have changed; decide which information must be refreshed rather than replayed.

Optional referenceDeep dive / reference chapterOpen the complete essay, diagrams, mathematics, exercises, glossary, and sources when you want more depth.

Next: State placement makes recovery possible; reliability engineering decides when to retry, shed load, cache, or stop.