strands.types.json_dict
JSON serializable dictionary utilities.
JSONSerializableDict
Section titled “JSONSerializableDict”class JSONSerializableDict()Defined in: src/strands/types/json_dict.py:8
A key-value store with JSON serialization validation.
Provides a dict-like interface with automatic validation that all values are JSON serializable on assignment.
__init__
Section titled “__init__”def __init__(initial_state: dict[str, Any] | None = None)Defined in: src/strands/types/json_dict.py:15
Initialize JSONSerializableDict.
def set(key: str, value: Any) -> NoneDefined in: src/strands/types/json_dict.py:25
Set a value in the store.
Arguments:
key- The key to store the value undervalue- The value to store (must be JSON serializable)
Raises:
ValueError- If key is invalid, or if value is not JSON serializable
def get(key: str | None = None) -> AnyDefined in: src/strands/types/json_dict.py:40
Get a value or entire data.
Arguments:
key- The key to retrieve (if None, returns entire data dict)
Returns:
The stored value, entire data dict, or None if not found
delete
Section titled “delete”def delete(key: str) -> NoneDefined in: src/strands/types/json_dict.py:54
Delete a specific key from the store.
Arguments:
key- The key to delete