getContexts

View as MarkdownOpen in Claude

Return the agent’s contexts as a serialized SWML dictionary, or null when no contexts have been defined via defineContexts().

Parameters

None.

Returns

Record<string, unknown> | null — The serialized contexts dictionary, or null when no contexts are defined.

Example

1import { AgentBase } from '@signalwire/sdk';
2
3const agent = new AgentBase({ name: 'intake', route: '/intake' });
4agent.defineContexts().addContext('default').addStep('greeting').setText('Hi.');
5
6const contexts = agent.getContexts();
7console.log(contexts);