Advanced guide / Chapter 6 of 7
Testing and CI with test keys.
Running agent tests against real models is slow and flaky, and you pay for every run. A test key goes through every ACPpotamia check for real, then answers with a mock in the provider's exact format, streamed or not. As far as your code can tell it talked to OpenAI or Anthropic. The bill stays at $0.
Set up
- Console → API keys → Create key → tick Test key. It starts with
acp_test_. - Use it exactly like a real key. No provider key is needed.
- Steer the mock per call with headers:
| Header | Effect |
|---|---|
X-ControlPlane-Mock-Content: Order 42 is shipped. | The reply text. |
X-ControlPlane-Mock-Status: 429 | A provider-format rate-limit error, with Retry-After. |
X-ControlPlane-Mock-Status: 500 or 529 | A provider-format server or overloaded error. |
In a CI pipeline
GitHub Actions
# .github/workflows/agents.yml
name: agent tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
env:
OPENAI_BASE_URL: https://acp.examopotamia.com/v1
ACP_KEY: ${{ secrets.ACP_TEST_KEY }} # an acp_test_ key
steps:
- uses: actions/checkout@v4
- run: npm ci && npm test
What to test with it
| Behaviour | How |
|---|---|
| Your retry logic | Send X-ControlPlane-Mock-Status: 429 and check your code waits and retries. |
| Budget handling | Set the test key's budget to $0 on the API keys page; your code should handle the 402. |
| Loop handling | Repeat the same call in one session; the 5th gets 429 loop_detected. |
| Model policy | Call a model outside the policy; expect 403 model_not_allowed. |
| Streaming parsers | Request stream: true; the mock streams in the provider's real event format. |
Tip. Test calls show up in Activity with a Test label. They cost $0 and don't touch your team's budget or token count.