Test what happens when state and time move on.

Expiry, lifecycle changes and uncertain outcomes can change the next API response. Use Gostly to model those conditions, compare the application's recovery paths and keep the business rules explicit.

Run the same authenticated request before and after expiry

Northline reportsSession recovery

Episode clock

Token validExpiryToken expired

Same protected request on both sides of expiry.

Weekly report

Engineering · This week

Access granted
200 · Before expiry
Weekly report
Session expired

Reconnect to view this report.

401 · After expiry

When to use it

A response that works now may need different handling later.

Use a prepared baseline when timing, a previous action or an uncertain write affects the next API response. Hold application state and timing steady when the case depends only on a change at the dependency.

What to check

Before expiry
The configured request succeeds with an eligible token.
After API time advances
A separate request sees the configured expiry response.
Application check
The client takes its intended refresh or sign-in path and reports a terminal failure when recovery cannot continue.

How to approach it

Compare behavior on either side of a state transition

4 steps

  • Gostly Episodes
  • Gostly Time Chamber
  • Your application
  1. Define the response on each side of the boundary

    Choose a resource with supported expiry or model the transition explicitly. Record the expected request and response before and after expiry, along with the client behavior you intend to check.

  2. Prepare the baseline and verify the normal path

    Configure the routed service and its fixtures or statechart, then take a compatible snapshot. Start an episode from that baseline and confirm a request before expiry receives the expected response.

  3. Reset, advance API time and send the next request

    Start from the same prepared state, advance the episode clock past expiry, then issue the client request separately. Inspect the API result and assert the application’s recovery using its own clock and test harness.

  4. Compare recovery with an uncertain outcome

    Keep a normal control and prepare any additional fault before taking its baseline. For an interrupted write, inspect a later read before letting the client retry. Retain the request order, API clock changes and application assertion so another run can reproduce the comparison.

What this gets you

Test recovery from a known starting point

A repeatable way to check the client before expiry, after expiry and after an uncertain outcome.

What the check tells you

The episode clock controls eligible modeled API behavior. Browser timers, the application database and background workers need separate controls or resets. A journal records API operations and outcomes, while your harness checks the client.

Where Gostly fits

State and time belong to the modeled API world. Your application clock, database and workers remain separate. Episodes last for the current boot. Resetting a baseline requires compatible configuration.

More worked examples

Compare sample API conditions with the checks your application can run.

Test how your app handles a failing API

Authored worked example · synthetic data

A saved draft when the publishing API returns 503

The synthetic publishing API normally accepts a draft. Configure an error profile for a failure run, then restore the normal response for a recovery run. Check the application on both sides of that change.

Example inputs and caller-owned checks
Your actionAPI conditionYour test checks
Run the normal caseThe mocked dependency accepts the requestConfirm the test reaches the intended publish flow
Enable the error profileThe dependency returns a configured 503Assert that the draft remains and the failure is explained
Inspect retry behaviorThe configured error condition remains activeAssert a bounded retry policy in your client harness
Restore the normal profile and retryThe dependency can accept a later requestAssert recovery without an accidental duplicate publish

Fault profiles are operator-configured. Gostly does not infer the right failure policy for your application or automatically decide whether its recovery is correct.

Fault injection setup
Give agent versions the same API conditions

Authored worked example · synthetic data

Two agent versions handle a delayed order

Both versions receive a synthetic order response showing a delayed shipment. Compare whether they acknowledge the delay, avoid inventing a delivery promise and offer the allowed next step.

Example inputs and caller-owned checks
Your actionAPI conditionYour test checks
Prepare the tool responseThe order API reports a delay with no new delivery estimateConfirm the request resolves from the intended library entry
Run agent version AThe tool receives the reviewed order conditionSave its answer and tool actions in your eval harness
Restore the case and run version BUse the same API input and relevant starting stateApply the same rubric and task configuration
Compare repeated runsAPI inputs stay controlled for covered requestsReport model variability separately from API differences

Controlling API responses does not make a model or agent deterministic. Model sampling, prompts, tool choice and application state can still change the outcome.

Record the tool APIs

Inspect the caller-owned comparison procedure →

Your next change

Make the next state change a case you can examine.

Investigate an uncertain integration