Skip to navigation

Reuse what you learn with simulation context

View as Markdown

Running simulations locally is available on all Postman plans. Deploying a simulation to the Postman Cloud is available on Solo, Team, and Enterprise plans only. For more information, see the pricing page.

A simulation’s context is a record of what your code assumes about the services its mocks stand in for, along with the evidence for or against each assumption. It gives a coding agent more than an environment to run against. The agent inherits what earlier sessions established about each dependency, and reasons from that verified evidence instead of re-deriving it. Without the context, what a session learns about its dependencies ends with the session.

The context file is available for simulations in Local View, where it’s stored in your local Git repository.

What the context records

Each simulation has a <simulation-name>.context.yaml file beside its .sim.yaml file. The .sim.yaml file says what the simulation is. The context file says what your code relies on about the real services, such as who the caller is taken to be, the order calls go in, what gets retried, and the shape of the data.

A mock answers a request even if no one checked that the real service behaves the same way. The answer is a belief your code carries. The context file keeps that belief next to the simulation, with the evidence that supports it or contradicts it.

Each assumption in the file has a status:

  • supported — Evidence supports the claim, within a stated scope. The claim names what the evidence covers, such as the operation, the conditions, and the time window.
  • contradicted — Evidence provides a counterexample.
  • unknown — The available evidence can’t establish or reject the claim.
  • conflicting — Sources that apply to the claim disagree, such as a contract that promises one thing while the running service does another.

A status describes the evidence for that claim and nothing wider. A claim about how your own code builds a request can be supported by reading the code and running it against the simulation. A claim about how the real service behaves stays unknown if only a mock backs it, even when your tests pass, because the mock shows what the stand-in does and not what the service does. A supported entry also records what its verification doesn’t cover, so the next session knows what still needs checking against the real service.

For the file’s full schema and a filled-in example, see the postman simulation create command.

Why the next session is faster

A session that reads the context before investigating can skip anything already established. It can also see which claims are contradicted, so it doesn’t build on an assumption a past session proved false. Each claim points to a source, so the next session can check the claim again instead of taking it on trust.

For example, a checkout service retries a payment after a timeout. A past session found that a charge was committed on a request the client timed out on, and recorded the claim “a timeout means no charge” as contradicted. The next session sees that finding first and designs the retry around it.

How agents use the context

At the start of a task, a coding agent reads the claims that apply to the dependencies it’s about to touch. It skips a supported claim only when the claim’s evidence still applies to the current code, configuration, and provider conditions. It treats a contradicted claim as a finding to design around, and spends its effort on what’s unknown or conflicting. Before it finishes, the agent records what it established, so the next agent or session doesn’t start from zero.

This also changes what a pull request shows. A reviewer can read what the agent verified, how it verified it, and what still rests on assumption, instead of trusting a passing run.

If you use the Postman plugin, its simulation skill follows this loop for the agent. Without the plugin, the agent can follow the same loop because the context is a plain YAML file in your repository. Point your agent at the file, and ask it to read the claims before investigating and to write its findings back before it finishes.

Read, verify, and write back

Postman creates the context file with the simulation, but it starts as a template with no findings recorded. No Postman CLI command writes entries for you. You or your agent keep it current by editing the file directly:

  1. Read the claims that apply to your task before you investigate the dependencies. Check whether each claim’s evidence still applies.
  2. Verify the claims you rely on. Use the simulation’s logs to confirm which calls your code made, and check a provider’s contract or the real service when a claim is about the provider.
  3. Write what you established back to the file before you finish. Set each claim’s status, reason, verification, and source, and update its updated_at date.

When you update the file, keep the existing claims and their evidence, including unresolved assumptions and past findings. Replacing the file with a fresh template loses them.

Share the context with your team

Commit the context file with the .sim.yaml file and the mocks your team owns, so the next session or a CI run starts with the same record. A person reviewing your pull request can then read what you verified and what still rests on an assumption.

If the simulation uses mocks from other teams’ workspaces as dependencies, don’t commit their downloaded files. Commit the .postman/resources.yaml file instead, and install the dependencies after you pull.

Keep credentials out of the file, because you commit it to your repository.

To learn how Postman creates the file, see Create and run a simulation. To see which calls your code made, see View simulation logs and history.