updateGlobalData

View as MarkdownOpen in Claude

Merge additional entries into the existing global data object. Unlike setGlobalData() which replaces, this method merges so that multiple callers (skills, dynamic config callbacks, etc.) can each contribute keys without overwriting each other.

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();