mockLangGraphAgent

Creates a mock LangGraphAgent with writable signals for testing. Control state by writing to the returned writable signals directly.

Neutral Agent-contract signals come from mockAgent; LangGraph-specific signals are declared here and layered on top.

import { mockLangGraphAgent } from '@threadplane/langgraph';

Declaration · overload 1

export declare function mockLangGraphAgent(initial?: MockAgentOptions & {
    langGraphMessages?: BaseMessage[];
    hasValue?: boolean;
    isThreadLoading?: boolean;
}): MockLangGraphAgent;

Parameters

initial · optional
MockAgentOptions & { langGraphMessages?: BaseMessage[]; hasValue?: boolean; isThreadLoading?: boolean; }

Returns

MockLangGraphAgent

Examples

const agent = mockLangGraphAgent({ isThreadLoading: true });
agent.messages.set([{ id: '1', role: 'assistant', content: 'Hi' }]);