reset

View as MarkdownOpen in Claude

Remove all contexts, returning the builder to its initial state. Use this inside a dynamic-config callback when you need to rebuild contexts from scratch for a specific request, rather than mutating the shared builder.

Returns

ContextBuilder — self for method chaining.

Example

agent.setDynamicConfigCallback((queryParams, bodyParams, headers, ephemeralAgent) => {
if (queryParams['tenant'] === 'billing') {
const builder = (ephemeralAgent as any).defineContexts();
builder.reset();
builder.addContext('default')
.addStep('greeting')
.setText('Welcome to billing.');
}
});