What CI runs when agent integrations change in git
Validate the policy file on every commit, and dry-run each method the diff added. Keep a live provider call out of the pipeline until after the merge.
Key takeaways
- -An agent integration change is usually tooling.json, the policy file, or a prompt, and ordinary unit tests never touch any of them.
- -swy policy validate checks the policy schema and runs the tests written in the file. A dry run never sends the call.
- -Keep live provider requests out of the pipeline entirely. Mode is stored in tooling.json at swy init, not passed in from a workflow variable.
- -A write with no policy test in the same pull request is an incomplete change, not a small one.
A platform engineer merges a pull request that adds one method to the agent allowlist. The diff is twelve lines. Production starts sending refunds that afternoon, because the new method was a write, the policy tests never ran, and nobody dry-ran the call first. The unit tests were green the whole time. They don’t know the catalog exists.
This post is the check set that belongs on every commit when the integration surface is an allowlist and a policy file, not application code you wrote by hand.
What actually changes in git
An agent integration change is usually one of three files. tooling.json says which methods may run. .swytchcode/integrations/policies.json says what happens to a call before it leaves the machine. The manifest swy get downloaded describes the provider. A prompt edit in the agent repo is a fourth kind of change, and it can shift which of those methods the model actually picks. CI that only compiles the service will miss all four of these.
Treat the allowlist like a public API. Adding a method is a release. Removing one is a rollback. A policy test that fails is a broken build, the same as any other. Policy as code is the review habit; the job below is how you stop that review from depending on someone remembering to run it by hand.
Name the method and the argument that must fail. If a write is on the list, the test should block the specific argument you won’t accept, an amount over the cap you chose, say. The policy overview tells you to write those tests and run swy policy validate in CI. A green unit-test suite doesn’t run that command on its own. The pipeline has to.
The two commands that belong on the pull request
Install the CLI in the job, then run the checks. Any of these installs works.
npm install -g swytchcodeirm https://cli.swytchcode.com/install.ps1 | iexcurl -fsSL https://cli.swytchcode.com/install.sh | shConfirm the binary, then validate the policy file. swy policy validate checks the schema and runs the tests written into the file. The policies.json reference is the schema those tests sit on.
swy --version
swy policy validateA failing test means the pull request doesn’t merge. Don’t treat a warning as a pass if the test expected a block and the file now allows the call through anyway.
Dry-run the methods the diff enabled. A dry run validates the call without sending it, so it never counts as a live command. The ID has to come from swy list methods after swy get, never invented in the workflow file itself.
swy get <name from swy search>
swy list methods
swy exec <canonical_id from swy list methods> --dry-runIf swy get can’t download the bundle in CI because the registry name is wrong, fail the job outright. A green build sitting on top of a missing bundle is exactly how a method ends up working only on one laptop.
What you keep out of the job
Don’t call the provider from CI at all. A live command is a request that actually went out, and refunds, emails and ticket updates will all run for real if the job is allowed to send them. Dry runs and swy policy validate are the commit checks. The first real send happens after merge, in an environment whose mode was already set at swy init and stored in tooling.json. Check the call log once that send has actually happened.
Mode is chosen once, at swy init, and written into tooling.json. Don’t pass it in from a workflow variable instead. A pull request that changes the mode is a production change, and it deserves the same scrutiny as a brand-new method.
There’s no .env file in this project. Swytchcode keeps credentials in its own local store and reads them when a call runs, and a CI runner should never receive a copy of ~/.swytchcode/credentials.db. If the dry run only needs the shape of a call and not a real secret, keep it that way. Provider login stays on a machine a person actually controls.
Approval isn’t a CI feature either. Holding a call for Slack or Telegram starts on Business and Enterprise, and if nobody answers within 48 hours, the call simply doesn’t run. That wait is meant for production writes, and it will stall a pull request for two days if you point the job at a live approval rule. Validate the rule instead of waiting on a human inside the runner.
A job you can paste
The shape is a normal workflow. Pin the CLI version if repeatability matters to you. The angle brackets below are the command shape, not a real method ID.
name: agent-integrations
on: [pull_request]
jobs:
policy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm install -g swytchcode
- run: swy policy validate
# Download the bundle first. Angle brackets are the command shape, not a real ID.
- run: swy get <name from swy search>
- run: swy exec <canonical_id from swy list methods> --dry-runReview the diff of tooling.json the same way you’d review a new route. If the added ID is a write, the policy tests in the same pull request should show a block, a modify, or an approval. A write with no test next to it is an incomplete change, not a small one.
Run swy policy validate on the pull request, dry-run only the methods the diff added, and merge once both pass. Send the first live call after the merge, somewhere a person can actually read the result.
Related reading
- API governance tools for AI agents. The allowlist is the surface this job guards.
- Human approval for a tool call. Where a held write belongs once it’s past the merge.
- API compliance for agent integrations. What a reviewer expects to find in that same pull request.
- API observability for AI agents. What to watch once the merged method starts actually sending.
FAQ
Should the pipeline send a real provider request to prove the method works?
No. A real send can refund money, email a customer, or create a record that’s awkward to undo. swy policy validate and swy exec --dry-run prove the file and the call shape are both correct. The first live call is a separate step, after merge.
Where do policy tests live?
In .swytchcode/integrations/policies.json. swy policy validate checks the schema and runs those tests. A test that expected a block and now gets an allow instead should fail the build, not just print a warning.
Can the runner use the same credentials as a developer laptop?
Don’t copy the credential store into CI. There’s no .env file in this project; Swytchcode keeps credentials in its own local store and reads them when a call runs. Dry runs shouldn’t need that store at all.
What if the pull request only changes the prompt?
Run the policy check anyway. A prompt change can make the model pick a method that was already on the allowlist, and if that method is a write, the tests you already have are what stop a bad argument from going through. If you don’t have a test for that method yet, that’s the moment to add one, in the same pull request as the prompt change.
Use Swytchcode so this doesn't happen to you
Use Swytchcode and a risky allowlist or policy change won't slip through code review unnoticed. Policy validation and a dry run run on every pull request, so a green build actually means the new method is safe to merge.
Swytchcode is an execution kernel that sits between your AI agents and the APIs they call. It resolves the right method, injects auth, checks policy, retries safely with idempotency, and logs every call locally.
Start with the MCP quickstart, or browse the docs for the full reference. Free is 100 live commands a month forever; see pricing for Pro and Business.
More content
How to Stop an AI Agent From Booking the Same Meeting Twice
A scheduling agent that checks availability and then books the slot has a gap between those two steps — and a retry can fall straight into it. Here's how Swytchcode closes that gap.
How to Stop an AI Agent From Creating Duplicate Records
A retried "create" call doesn't update an existing contact, ticket, or row — it makes a second one. Here's why that happens across CRMs, databases, and ticketing tools, and how Swytchcode prevents it.
How to Stop an AI Agent From Sending the Same Email Twice
Most email APIs have no idempotency key to catch a repeat send, which makes a duplicate email a harder problem than a duplicate charge. Here's how Swytchcode handles the gap.
