# AX-SYS-31: Give agents a sandbox that behaves like production

> Recovery and reliability · intermediate · AX-SYS-31

Offer an isolated environment with the same API and working keys, where an agent can rehearse writes, payments and destructive actions with no real effect, and make test and live impossible to confuse.

## Why

Agents learn an API by calling it. If the only environment is production, every experiment is a real charge, a real email or a real deletion, and the safe choice is not to let the agent try at all. A sandbox removes that trade-off. Stripe defines one as an isolated test environment where payments are not processed by card networks or payment providers, and it now provisions them for agents directly: its documentation tells coding agents to run `stripe sandbox create` to get an anonymous sandbox with working API keys, with no account registration (the same idea as [AX-SYS-43](ax-sys-43-design-agent-first-onboarding.mdx)). The sandbox only helps if it behaves like production, with the same endpoints, errors and webhooks, so that what the agent learns there carries over. It also has to be unmistakable: Stripe's test keys start with `sk_test_` and live keys with `sk_live_`, so neither the agent nor a log reader can mistake one for the other, and API objects carry a `livemode` field. Mathias Biilmann lists "Do you offer sandboxes and environments?" among the Orchestration questions he asks of products built for agents.

## Do

Provide a sandbox with production's API, distinct test credentials and a `livemode`-style flag on every response.

## Don't

Make agents test against production, or let a sandbox drift so far from live behavior that it teaches the wrong thing.

## Artifact

```bash
# Provision an anonymous sandbox with working keys, no signup
stripe sandbox create --help
```

```json
{ "id": "pi_3Mtw...", "object": "payment_intent", "amount": 2000, "livemode": false }
```

Test keys start with `sk_test_`, live keys with `sk_live_`.

## Citations

1. [Stripe Docs: Sandboxes](https://docs.stripe.com/sandboxes): A sandbox is an isolated test environment: payments created there aren't processed by card networks or payment providers. Coding agents should install the Stripe CLI and run stripe sandbox create --help to provision an anonymous Stripe sandbox with working API keys. No account registration required
2. [Stripe Docs: API keys](https://docs.stripe.com/keys): Sandbox keys start with pk_test_, rk_test_ and sk_test_; live mode keys start with pk_live_, rk_live_ and sk_live_
3. [Stripe API Reference: The Event object](https://docs.stripe.com/api/events/object): livemode (boolean): if the object exists in live mode, the value is true; if the object exists in test mode, the value is false
4. [Mathias Biilmann: One Year of AX](https://biilmann.blog/articles/one-year-of-ax/): Among the questions of the Orchestration pillar: Can you trigger agent runs from your product? Can you pass the right context along? Do you offer sandboxes and environments?

---
Source: Agent Experience Principles (axprinciples.com)