AgentsAgentBase

update_global_data

View as MarkdownOpen in Claude

Update the global data with new values. Functionally identical to set_global_data() — both merge the provided dictionary into the existing global data.

Parameters

data
dict[str, Any]Required

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

Returns

AgentBase — Returns self for method chaining.

Example

from signalwire import AgentBase
from signalwire.core.function_result import FunctionResult
agent = AgentBase(name="support", route="/support")
agent.set_prompt_text("You are a helpful assistant.")
@agent.tool(description="Authenticate the caller")
def authenticate(args, raw_data=None):
user = {"name": "Alice", "tier": "gold"} # Replace with your user lookup
agent.update_global_data({
"authenticated": True,
"user_name": user["name"],
"user_tier": user["tier"]
})
return FunctionResult(f"Welcome back, {user['name']}.")
agent.serve()