updateGlobalData

View as MarkdownOpen in Claude

Merge additional entries into the existing global_data object. Functionally equivalent to setGlobalData() — both methods call .update() on the internal dict so multiple callers (skills, dynamic config callbacks, etc.) can each contribute keys without overwriting each other. updateGlobalData() is the idiomatically named variant for call sites that want to make the merge semantics explicit.

Parameters

data
Record<string, unknown>Required

Object of key/value pairs to merge into global data.

Returns

AgentBase — Returns this for method chaining.

Example

1import { AgentBase } from '@signalwire/sdk';
2
3const agent = new AgentBase({ name: 'greenhouse', route: '/greenhouse' });
4agent.setPromptText('You are a helpful plant care assistant.');
5
6// Update global data with caller-specific information
7const user = { name: 'Alice', tier: 'gold' };
8agent.updateGlobalData({
9 authenticated: true,
10 user_name: user.name,
11 user_tier: user.tier,
12});
13
14await agent.serve();