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

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