Testing code that uses AI agents GitHub issue

Placeholder. We haven't designed a mock-agent system; we expect one to emerge as we build AI-using features and run into the testability question in practice. This doc captures what's been noticed so far so the thinking accumulates as we go.

vibecode
{"vibecode": {
    "doc": "idea_ai_testing",
    "role": "placeholder for emerging thoughts on how to test Caspian code that interacts with AI agents — primarily the mock-agent mechanism that any test framework will eventually need",
    "status": "no_design_yet_will_emerge_through_use",
    "applies_to": ["$agent.yield code paths", "puckai worldlet handling", "skill consumption", "any code that talks to LLMs"]
}}

The question GitHub issue

Code that contains $agent.yield (or other AI-talking surfaces) is hard to test deterministically — the agent's responses vary run to run by design. A test that asserts "given input X, the routine produces output Y" can't hold if X flows through an AI yield.

The basic shape is already clear: agents are objects (resolved here), so tests can swap a real agent for a stub. The stub returns fixed values for fixed inputs; the test becomes deterministic.

What's NOT yet clear: the conventions around stub agents. Specifically:

Why we're not designing this upfront GitHub issue

Mock-system design tends to be fragile when done speculatively — the right shape is shaped by the friction of actually writing tests, and those frictions appear once we have a few real test suites to look at. We expect the mock-agent mechanism to emerge as a side effect of writing tests for the first AI-using features, then get formalized once a pattern proves itself.

In the meantime: developers writing tests against $agent.yield code can construct stub objects with .send and .yield methods directly. No framework support; works because agents are just objects.

Open thinking GitHub issue

Things to chew on as the design emerges (none committed):


© 2026 Puck.uno