Testing

Studio and Providers

Test Studio HTTP wiring and keep provider integration tests focused.

Studio and provider tests are useful integration checks. Keep them narrow so they diagnose wiring and provider behavior without carrying all product correctness.

Test Studio Without Opening a Port

Studio exposes .fetch(...) for tests and internal tooling:

const studio = new Studio([agent]);

const response = await studio.fetch(
  new Request("http://studio.test/agents/support/runs", {
    method: "POST",
    headers: { "content-type": "application/json" },
    body: JSON.stringify({ message: "Hello" }),
  }),
);

expect(response.status).toBe(200);

Use this to verify agent registration, run request shape, sessions, traces, approval routes, and question routes.

Test Sessions and Traces

When a workflow depends on Studio persistence, check the store-facing behavior:

AreaWhat to check
Sessionscreate, append, list, get, and delete behavior
Tracesrun status, observations, usage, metadata, and session linkage
Approvalspending approval creation and approved or rejected decisions
Questionspending question creation and answered question results

Keep product auth and external notification policy outside Studio tests unless your application wrapper adds those behaviors.

Keep Provider Tests Focused

Provider integration tests should cover the behavior your workflow depends on:

  1. Test one happy path for each provider you support.
  2. Test tools and structured output where provider behavior matters.
  3. Test attachments only for provider models that support them.
  4. Record usage and trace ids so failures are diagnosable.
  5. Keep API keys in your normal secret system.

Avoid Broad Provider Suites

Do not use provider calls to test every branch of tool code, retrieval filtering, or application policy. Those branches should already be covered with direct tool, pipeline, wrapper, and retrieval tests.

Provider tests should answer a smaller question: does this model adapter behave the way this workflow requires?