The problem
One good answer does not prove an AI assistant is ready for people to use. We need to test it, check its access, and keep records that help us fix problems.
A project by Muhammad Khan · Building safer AI systems
AgentHub is a project for testing and running AI assistants. It checks new versions, limits what they can do, and helps you find and undo a bad change.
01 / The starting point
An AI agent is software that can answer questions and use tools to do a task. A small change to its settings can make a good answer wrong or slow. Who made the change? Which version handled the request? Can we go back?
One good answer does not prove an AI assistant is ready for people to use. We need to test it, check its access, and keep records that help us fix problems.
AgentHub brings these checks into one place. It uses three store assistants to show the full process, from saving a new version to fixing a failed update.
02 / The demo assistants
Checks store stock without changing it. For example: which Toronto stores may run low on snow shovels?
Looks up store rules and shows where its answer came from. For example: can I return an unopened product after 20 days?
Finds products that match what a shopper needs, using the store catalogue. For example: find a snow shovel under $60.
03 / The failure story
In the repeatable demo, a Knowledge assistant goes from looking up 5 results to 50. The model takes the same time, but retrieval gets much slower. An injected guardrail signal opens an incident while the new version is still at 5% of traffic.
04 / Step by step
Record its settings and who owns it. Keep that record unchanged.
Stop a new version if it fails a required check.
Let code decide which tools the AI is allowed to use.
Compare the new version with the old one. Send it only a small share of requests.
Track response time, errors, and cost.
Read the saved records, switch back to a working version, and check the results.
05 / Engineering choices
Once a version is saved, its settings cannot be replaced under the same version number. Tests and release records still point to the exact version they checked.
See the version test ↗The app runs as one service, with separate code for tests, access rules, releases, and repairs. PostgreSQL transactions save related changes together, so a half-finished update does not become the new state.
See the full lifecycle test ↗The AI can ask to use a tool. Separate code checks whether it is allowed. Changing the AI's instructions does not give it more access.
See the access tests ↗The new version must have enough test results and recent measurements before it gets more requests. Missing data does not count as a pass.
See the canary tests ↗The part that explains a failure points to saved records. It cannot change a running release. Separate code checks whether switching back is allowed and carries out that change.
See the rollback checks ↗Switching back to an older version is called a rollback. That step can finish while the service still has problems. New measurements must show that it is working again.
See the recovery test ↗06 / How it is built
PostgreSQL is the database. It keeps the version history and records of what changed and why.
07 / When things break
The request stops. The system does not assume that a missing check means permission was granted.
During a background comparison, the user still gets the current version's answer. A slow test version is recorded as a failure instead of breaking that answer.
The service reports that it is not ready to handle work. A separate check shows whether the app itself is still running. Database connections have limits.
The system checks what has already happened before changing where requests go. Repeating a rollback request should not create a second, conflicting change.
08 / What is real
The app runs real code for tests, access checks, releases, and rollback. It saves records in PostgreSQL and measures requests handled by the running app.
The store data, sample AI answers, and staged failure are made for this demo. The same inputs give the same results, so you can repeat the test without paying for an AI service.
The repo includes code and setup files for Azure. This page shows the local project, not a live cloud service or proof that it can handle a large number of real users.
09 / Common questions
They let you repeat the same test and see the same failure without paying for an AI service. A real model can give different answers. Its accuracy, speed, and cost would need separate tests.
The goal is to show how the checks work underneath the screens. You can read the code that blocks a release, checks access, and handles a failed update. This project is for learning and testing these ideas; it does not claim to replace a hosted platform.
Keeping every record tied to the right version. A test result is only useful if it describes the version being released. Saved version records cannot be replaced, and related database changes are saved together.
That needs testing. The local demo runs one app process. Before adding more users, I would test real AI services, set database connection limits, connect user accounts, and measure where the system slows down.
The team would need its own access rules, people responsible for running the service, tests based on real tasks, and practice recovering from failures. The current project shows the process on a local machine.
Write its task code and a settings file that lists its model and tools. Add sample questions and rules for passing the tests. Save a version, then run it through the same access checks and release steps.
10 / Explore further
Python · FastAPI · PostgreSQL · SQLAlchemy · Alembic · OPA · OpenTelemetry · Prometheus · Tempo · Grafana · Docker · Helm · Terraform