get_session_attributes

API reference for get_session_attributes

get_session_attributes()

Get the session attributes for the current agent invocation.

Retrieves session attributes that were previously set using set_session_attributes(). Works in both synchronous and asynchronous contexts automatically.

Parameters

Parameter
Type
Required
Default
Description

agent

Agent

None

The Strands Agent instance to retrieve session attributes from

Returns

Dictionary of session attribute key-value pairs, or empty dict if none exist Return type: dict[str, str | int | float | bool]

Last updated

Was this helpful?