get_context

View as MarkdownOpen in Claude

Retrieve an existing context by name for inspection or modification.

Parameters

name
strRequired

Name of the context to retrieve.

Returns

Context if found, None otherwise.

Example

1from signalwire import AgentBase
2
3agent = AgentBase(name="my-agent", route="/agent")
4
5contexts = agent.define_contexts()
6default = contexts.add_context("default")
7default.add_step("greet").set_text("Greet the caller.")
8
9ctx = contexts.get_context("default")
10if ctx is not None:
11 ctx.add_step("followup").set_text("Ask if there is anything else.")
12
13agent.serve()