MockWorld Tests
A testing framework for AI agents. Assert on outcomes, not reasoning paths. Mokra implements the MockWorld Test paradigm introduced by Peter Nsaka.The problem
AI agents are different from traditional code:- They reason and improvise
- Same input leads to different execution paths
- You can’t predict exactly what steps they’ll take
- Traditional unit tests don’t work
The solution
MockWorld Tests let you test outcomes, not paths.How it works
Three primitives
1. Run
Wrap your agent execution inworld.run():
2. Observe
See what the agent did in plain English:3. Assert
Verify outcomes using natural language:Who uses MockWorld Tests
- AI agent builders (LangChain, CrewAI, custom agents)
- Teams deploying autonomous AI to production
- Anyone building AI that calls real APIs
Key differences from traditional testing
| Traditional Testing | MockWorld Tests |
|---|---|
| Assert on specific steps | Assert on outcomes |
| Breaks when agent takes different path | Works regardless of path |
| Tests implementation | Tests behavior |
| Predictable code only | Works with non-deterministic AI |
Next steps
Quickstart
Test your first AI agent in 5 minutes