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

1agent.setDynamicConfigCallback((queryParams, bodyParams, headers, ephemeralAgent) => {
2 if (queryParams['tenant'] === 'billing') {
3 const builder = (ephemeralAgent as any).defineContexts();
4 builder.reset();
5 builder.addContext('default')
6 .addStep('greeting')
7 .setText('Welcome to billing.');
8 }
9});