Skip to navigation

Context, simulate, and verify with your coding agent

View as Markdown

A coding agent can change your API code quickly, but it can’t tell on its own how the rest of your system behaves, try a risky change without side effects, or prove that a change works. Postman gives your agent three steps for this: context, simulate, and verify. Your agent runs them with the Postman CLI and the Postman plugin skills, and you review the results.

None of these steps change your workspaces, collections, or code by themselves. Each step stands on its own, so you can use one, two, or all three together on the same change.

Context: Learn what exists and what has happened

Before it writes code, your agent asks Postman what it needs to know instead of guessing.

  • Workspace context. The postman workspace context command lists collections, environments, API specifications, mocks, monitors, flows, and simulations in a workspace, with up to 25 items per section by default, including relationships between monitors and the collections and environments they run. Pass --section activity, or run postman workspace activity, to see who changed what and when, agent changes included, so your agent can pick up where another agent or teammate left off. To learn more, see postman workspace context.
  • Team context. The postman context-graph ask command answers questions such as which services call an endpoint and who owns it. This saves your agent from having to manually trace the dependency across every repo. To learn more, see Postman CLI Context Graph commands.
  • Skills. Skills such as workspaces and api-discovery load so your agent can gather the context it needs to build your API engineering workflow.

Simulate: Try the change without real side effects

Next, your agent runs your real service against stand-ins for the services it calls. A simulation serves several mocks behind one address, and each mock can apply a scenario such as latency, errors, or rate limits.

  • Run a simulation. The postman simulation create command scaffolds a .sim.yaml file in your repository, and postman simulation run serves it locally. To learn more, see Postman CLI simulation commands.
  • Inject failures. Make a dependency time out or return an error, then watch how your code responds. A request can still reach a real service, so use test environments. To learn more, see Proxy mode.
  • Skills. Skills such as api-simulation and api-mocking load so your agent can simulate the dependencies it needs to build your API engineering workflow.

Running a simulation locally is available on all plans. Deploying a simulation to Postman Cloud requires a Solo, Team, or Enterprise plan.

Verify: Check the result and record what it shows

Lastly, your agent runs checks against the change and reports the outcome.

  • Run assertions. The postman collection run command runs a collection’s tests. Add --simulation to run them against a simulation. To learn more, see postman collection run.
  • Keep checking. Monitors and CI runs repeat the same checks after the change merges.
  • Skills. Skills such as api-testing, api-monitoring, performance-testing, and ci-integration load so your agent can verify results and build your API engineering workflow.

A passing run shows that the checks you defined passed under the conditions you tested. It doesn’t show that the code is correct everywhere. Ask your agent to report which conditions it didn’t test.

Example: A payment retry

An order must be charged once, even if checkout has to retry. Here’s how the three steps apply:

  • Context. Your agent runs postman workspace context and locates the payments collection. The collection’s description states the team’s rule that an order is charged once.
  • Simulate. It starts a simulation of the payments service and applies a scenario where the payment succeeds but the response never arrives. Checkout retries and sends the payment again.
  • Verify. It runs the collection against the simulation and asserts that the simulated payments service recorded exactly one charge. The run fails, your agent fixes the retry logic, and the run passes.

Your agent keeps the simulation and the collection in your repository, so the next change can reuse them.

Next steps

Now that you know how the steps fit together, you might also be interested in these pages: