Watch agent API calls change when the prompt changes
Set a call baseline for each method, then compare it the morning after a prompt edit. A flat total can hide a shift from a read method to a write method.
Key takeaways
- -A flat total call count can hide a shift from a read method to a write. Baseline each method separately, on a quiet week.
- -swy audit stats is the local summary and needs no sign-in. The hosted log is off until you enable it, and retention then follows the plan.
- -Dry runs don't belong in the baseline. swy exec --dry-run never sends a request, so it never counts as a live command.
- -Tie each baseline to a prompt revision. When the git sha changes, that's the event that invalidates the old numbers.
Tuesday’s agent reads tickets and drafts notes. Wednesday’s prompt edit tells it to resolve the ticket when the customer sounds done. The dashboard still says “api calls, about the same.” Then support notices a pile of closed tickets that were never actually resolved. The total count hid a shift from a read method to a write method, because the prompt was the release and nothing in the chart was watching per operation.
This post is the monitoring pass for that exact shift. Our guide on API observability for AI agents covers what to record and where the gaps usually are. Here, you set a baseline per method and treat every prompt change as the event that invalidates it.
Set the baseline on each method
Start with the methods listed in tooling.json. For each one, write down three numbers from a quiet week: how many calls, what share failed or got blocked, and which arguments showed up. A blocked call exits 6 and never leaves the machine; an approval wait exits 7. Keep those separate from a genuine provider 400, since lumping them into one “error” bucket is exactly what hides the signal you need.
swy audit stats
swy list methodsswy audit stats is the local summary, and it needs no sign-in. It isn’t the hosted log, which stays off until you turn it on. Once it’s on, retention is 7 days on Free, 30 on Pro, and 90 on Business, so don’t try to draw a 90-day baseline on a Free workspace. You don’t have the days.
Our audit and telemetry docs walk through what the local commands show. If a method is missing from the stats entirely, it simply didn’t run, and that zero is part of the baseline too. A prompt that starts calling it for the first time is exactly the kind of change you want to catch.
What a prompt edit does to the mix
The model picks the method, and the wording is what it’s picking from. Ship a prompt that mentions “resolve,” and you can watch the write method climb from zero calls a day to most of the traffic while the read method quietly drops off. The sum of the two can stay perfectly flat the whole time, and a chart of total calls will tell you that’s normal.
Tie the baseline to the prompt revision the same way you’d tie a dashboard to a deploy. When the prompt file changes, note the git sha next to that week’s numbers. The next day’s job is a comparison, method by method, looking for:
- A method that sat near zero and is now busy
- A write whose argument keys weren’t in last week’s sample
- A block rate that fell because someone edited the policy in the same pull request
The third one is the easiest to miss, because a prompt and a policy often land in the same pull request. If you’re only watching provider errors, a policy that stopped blocking just looks like healthy traffic. Logging every API call is how you separate blocked, held, and sent instead of collapsing all three into one number.
Alerts that match this failure
Alert on the method, never on the workspace total. A practical starting set:
- Write methods: alert when the daily count is more than double the baseline, or when it leaves zero
- Argument keys: alert when a new key appears on a write
- Block rate: alert when it drops to zero on a method that used to block
Skip an alert on “total calls plus or minus 10 percent.” That’s the Wednesday chart that stayed green while tickets closed themselves.
Dry runs have no place in the baseline either. swy exec --dry-run never sends anything and never counts as a live command. A CI job that dry-runs on every pull request would drown your real numbers if you mixed it in. Count live commands only: requests that actually went to the provider, including the ones a scheduled job fires with an API key.
What you do when the mix moves
If a write spiked and the prompt sha changed on the same day, roll the prompt back or pull the method out of tooling.json. Removing the method stops the call even if the prompt keeps asking for it, which makes it the faster rollback whenever you don’t yet trust the new wording.
If the mix moved and the prompt didn’t change at all, look at the policy file and at the provider instead. A schema change on their side shows up as failures, not as a brand-new method appearing. A policy edit shows up as a different block rate. Those are two different pages in the log, and it’s worth checking both before you touch the prompt.
Only re-baseline once you’ve actually accepted the new mix. Otherwise Thursday’s spike quietly becomes Friday’s normal, and you lose the only signal you had.
Write the three numbers per method before the next prompt edit ships. Compare them the morning after. Roll back the prompt or the method the moment a write leaves zero without anyone having reviewed it.
Related reading
- Best API observability tools for agent traffic. For when you need a tool past the local audit summary.
- Policy as code for agent calls. The file that can change block rate without any prompt edit.
- Human approval for a tool call. What exit code 7 means when it shows up in your baseline.
- API governance tools for AI agents. Why the allowlist is the list you baseline, not the vendor catalog.
FAQ
Is swy audit stats the same as the hosted log?
No. swy audit stats is local and works without a sign-in. The hosted log stays off until you enable storage, and retention then follows the plan: 7 days on Free, 30 on Pro, 90 on Business.
Should the baseline include dry runs from CI?
No. A dry run never sends anything and never counts as a live command. Baseline only the calls that actually reached a provider, or the pull request job ends up setting your “normal” for you.
What if I only have a total count from the provider?
You’ll miss a shift from read to write whenever the total holds still, which is exactly the failure this post describes. Ask for the method ID in the log before you trust the chart. A provider total is a useful backup signal, but it’s not a baseline on its own.
How long should the quiet week be?
As long as your retention allows. A Free workspace with storage on can only see 7 days back, so don’t try to average a month you can’t actually query. If storage is still off, use the local audit on the machine that ran the agent, and say so next to the numbers so nobody mistakes it for more than it is.
Use Swytchcode so this doesn't happen to you
Use Swytchcode so a prompt edit that quietly shifts your agent from reads to writes gets caught by the allowlist and the audit log, not by an angry customer.
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.
