createSimpleContext

View as MarkdownOpen in Claude

Helper function that creates a standalone Context object without requiring a ContextBuilder. Useful for quick prototyping or when you need a single context outside of the builder pattern.

This is a module-level function, not a method on ContextBuilder. Import it directly: import { createSimpleContext } from '@signalwire/sdk';.

Parameters

name
stringDefaults to default

Context name. Defaults to "default", which is the required name for single-context agents.

Returns

Context — A new Context object ready for adding steps.

Example

1import { createSimpleContext } from '@signalwire/sdk';
2
3const ctx = createSimpleContext();
4ctx.addStep('greet').setText('Welcome the caller and ask how you can help.');
5ctx.addStep('farewell').setText('Thank the caller and end the conversation.');