Agent Forces

How to test AI agent handoffs

Test whether a change broke your workflow even when the final answer still looks fine. Start with one realistic scenario where the next actor matters.

Write a rule with an observable result

In the support example, a supervisor must approve a draft before the delivery tool sends it. Record approval and delivery as separate events. The same visible reply can hide a sequence where approval arrived too late.

Use a required-event check for a step that must exist, such as a receipt. Set a count limit for expensive or risky repeats. A maximum of zero prohibits the selected event.

Compare runs with the same starting conditions

Keep the scenario, sample data, expected tools, and release checks fixed. Load the baseline and the candidate. Open the event attached to a failure and decide whether the check caught a product regression or whether your instrumentation missed something.

Capture order breaks ties when timestamps are identical. A prerequisite must appear at a lower event number. The order check stays unconfirmed if the checked event never happens. A partial trace can prove a breaking occurrence and still leave later behavior unknown.

Prepare a trace

Export your instrumentation as a small JSON object. Give each event its elapsed milliseconds, actor, type, and event name. Event types are handoff, tool, approval, output, and guardrail. Agent Forces matches these fields exactly. Include one trace per scenario and mark it complete only if capture continued through the end.

{
  "schema": "agentforces-trace/v1",
  "label": "Support reply · baseline",
  "complete": true,
  "events": [
    {
      "atMs": 120,
      "actor": "writer",
      "type": "handoff",
      "name": "review_reply"
    },
    {
      "atMs": 210,
      "actor": "supervisor",
      "type": "approval",
      "name": "approve_reply"
    },
    {
      "atMs": 290,
      "actor": "delivery",
      "type": "tool",
      "name": "send_reply"
    }
  ]
}

Import an OpenAI Agents SDK export

Export the objects from Trace.export() and Span.export() for one trace. Load a JSON array or an object with a data array. Agent Forces uses handoff destinations, function names, and guardrail names as events. For functions and guardrails, the closest parent agent supplies the actor.

Events follow span start time, with file order used when start times match exactly. A tool span shows invocation, while a handoff span records its selected destination. The importer discards payloads and marks checks for approvals or outputs as unconfirmed. Check “This SDK export covers the full run” only when you exported the entire trace. Missing span timing or actor attribution keeps the capture partial.

See the SDK’s tracing workflow and the span export format.

Use redacted metadata. Leave prompts, response text, payloads, tokens, and customer identifiers out of the file. Download the rule set to run the same checks again with a new baseline and candidate.

Open the release rehearsal