cowboy test runs the project’s pytest suites, whose tests call the actor’s handlers in memory, through SimulatedChain. cowboy run runs one handler of the built actor and keeps the actor’s state between runs.
This page builds a small help desk actor that asks a model a question, then tests it both ways.
First, install the CLI.
1. Create the project
Output
2. Write the actor
Replaceactors/helpdesk/main.py with:
ask sends the question to a model as a runner job and continues when the answer comes back. Only the owner can start the daily reset, and only the schedule can run reset_count. Build your first actor explains these pieces.
3. Write the tests
Replacetests/test_helpdesk.py with:
4. Run them
Output
cowboy test also checks each actor against the rules cowboy check applies, so a test can’t pass on code a deploy would refuse.
5. Run handlers with cowboy run
Output of the ask run
--stub-llm answers the next runner.llm call, so ask finishes in one run with no model. Each run saves the state, so answer sees what ask saved.
You can try the failure path the same way, by making the job fail:
Output
Next
- Testing toolkit lists everything
SimulatedChainandmock_hostcan do. - Deploy and operate
- Call models, the web and tools