Source:
examples/agent-fake-modelOverview
This template demonstrates how to usefake() from aixyz/model to build and test an agent with zero API calls and no API key. The fake model’s transform function deterministically maps each user message to a response, making every test fast, repeatable, and CI-safe.
The example agent checks whether the user’s input is a palindrome, or reverses it if not — using both the lastMessage and the full prompt history from the transform signature.
Project Structure
The Fake Model
Importfake from aixyz/model and pass a transform function:
lastMessage— the text content of the last user turnprompt— the full conversation history, useful for tracking turn count or extracting prior context
Test Pattern
Because the fake model is deterministic, every test runs without an API key:Key Features
- No API key —
fake()never makes network requests - Fully deterministic — same input always produces the same output
- CI-safe — all tests run in any environment
- Full prompt context — the transform’s second argument exposes the entire conversation history
Running Tests
Running the Agent
http://localhost:3000:
| Endpoint | Protocol | Description |
|---|---|---|
/.well-known/agent-card.json | A2A | Agent discovery card |
/agent | A2A | JSON-RPC task handler |