@threadplane/chatFunctionv0.3.4

mockAgent

Build an in-memory Agent for tests and stories — no transport, no network. Every field is a writable signal so a test can drive UI states (loading, error, interrupts, tool calls, subagents) deterministically.

import { mockAgent } from '@threadplane/chat';

Declaration · overload 1

export declare function mockAgent(opts?: MockAgentOptions): MockAgent;

Parameters

opts · optional
MockAgentOptions

Initial values for the mock's signals; all optional.

Returns

MockAgent

A MockAgent satisfying the full Agent contract.

Examples

import { staticDelivery } from '@threadplane/chat';

const agent = mockAgent({
  messages: [{ id: '1', role: 'assistant', content: 'Hi', delivery: staticDelivery('1') }],
  isLoading: true,
});