CI, Logging and a Human Fallback
Why This Matters
Tests on your laptop protect only you. An automation that books orders runs every day, unattended. It needs three things: tests that run automatically on every change, logs that tell an operator what happened, and a way for humans to take over.
Tests on every change
The project runs its tests on GitHub Actions, in .github/workflows/tests.yml:
on:
pull_request:
push:
branches: [main]
jobs:
pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- run: pip install -r requirements-dev.txt
- run: python -m pytest -v
On every pull request, all tests run on the oldest and newest Python the project supports. A red check means: do not merge.
Logs an operator can use
The pipeline logs one line per decision, with the reason:
INFO order PO-20417 booked as ERP-1001 (total 2848.80)
WARNING order PO-20418 needs review: BAG-30L: price 71.00 differs 10% from catalog 64.50
ERROR extraction failed: Could not read the LLM answer as an order: ...
Good automation logs answer three questions without opening the code: which message, what was decided, and why. Never log secrets such as API keys, and think twice about personal data in emails.
A human fallback
Production needs answers to these questions, written down before go-live:
| Question | For Order Intake Bot |
|---|---|
Where do needs_review orders go? | A queue or mailbox the purchasing team checks daily |
Who is alerted on failed? | The process owner, by e-mail or chat, with the log line |
| What if the bot is down for a day? | The team books by hand, as before; nothing is lost because the emails stay in the inbox |
| Who changes a rule? | The process owner decides; a developer changes validate.py with a test |
| How do we know it still works? | CI on every change, and a weekly check of booked versus reviewed orders |
Where to go next
- Work with AI agents on a codebase: Agentic Engineering with Claude Code teaches you to let an agent change code like this safely, with context, hooks and mutation testing.
- For managers and teams (in Dutch): AI structureel inzetten in je organisatie covers finding these opportunities, choosing tools and the AI Act.
- Have it built: automations like Order Intake Bot, including robots for legacy systems, are implemented and supported via KoppelAI, bsure-digital and Integratio. Get in touch.
Exercise
- Fork the project on GitHub, enable Actions, and open a pull request that breaks the price rule (as in lesson 8, Testing Business Rules: Boundaries and Breaking It on Purpose). Watch CI turn red, read the log, fix it, and watch it turn green.
- Write the fallback table for the automation you mapped in lesson 4, From a Process to Code.
- Decide which three log lines an operator of your automation would need most, and check that your design produces them.
Key Takeaways
- Run the tests on every change, on the Python versions you support.
- Log every decision with its reason, never secrets.
- Agree before go-live where reviews go, who is alerted and what happens when the bot is down.
- Automation is only finished when people can trust it and take over when needed.