Mock()

Deterministic scripted inference, for tests and offline scaffolds. The full loop still runs — tool calls execute, context accumulates — with nothing crossing the network.

export default defineAgent({
    providers: [Mock({ hello: "hi there" })],
})

This is what makes agent tests fast, free, and repeatable.

The script rides on the declaration

Mock is the one provider whose declaration carries behaviour, which is exactly what makes it a test double rather than a source of inference. A map matches on the user's text:

Mock({
    "hello": "hi there",
    "what is 2+2": "4",
})

A function gets the whole request:

Mock(req => `you said: ${extractUserText(req)}`)

Declared with no script, it echoes the prompt back — useful for checking wiring, useless as an assertion.

Options

Mock(script?: MockHandler | MockReply | ProviderOptions)

Because a bare options object and a reply map are both plain objects, an argument is read as options only when every key is one of key, url, or slots. Everything else is a script.

OptionDefaultDescription
slotsunboundedCeiling on concurrent calls
keyNot used
urlNot used

What it satisfies

Every generate role. Its single catalogue entry declares a 1M context window and structured output, so a test declaring a 200k-context role exercises the wiring it is testing rather than the resolver's arithmetic.

It is deliberately not marked local, so a test that also declares a real local provider still prefers the real one.

Model ids

export default defineAgent({ model: "mock" })