***

title: update_global_data
slug: /reference/python/agents/function-result/update-global-data
description: Set or update key-value pairs in the global session data.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[functionresult]: /docs/server-sdks/reference/python/agents/function-result

Set or update key-value pairs in the global session data. Global data persists
for the entire agent session and is accessible in prompt variable expansion
(`${global_data.key}`) and by all SWAIG functions.

## **Parameters**

<ParamField path="data" type="dict[str, Any]" required={true} toc={true}>
  Dictionary of key-value pairs to merge into the global data store. Existing
  keys are overwritten; new keys are added.
</ParamField>

## **Returns**

[`FunctionResult`][functionresult] — self, for chaining.

## **Example**

```python {11}
from signalwire import AgentBase
from signalwire import FunctionResult

agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")

@agent.tool(name="save_customer_info", description="Save customer information")
def save_customer_info(args, raw_data):
    return (
        FunctionResult(f"I've noted your information, {args.get('name')}.")
        .update_global_data({
            "customer_id": args.get("customer_id"),
            "customer_name": args.get("name"),
            "verified": True
        })
    )

agent.serve()
```