Example

storage.py
from phi.storage.agent.dynamodb import DynamoDbAgentStorage

# Create a storage backend using the DynamoDB database
storage = DynamoDbAgentStorage(
    # store sessions in the ai.sessions table
    table_name="agent_sessions",
    # region_name: AWS region name
    region_name="us-east-1",
)

# Add storage to the Agent
agent = Agent(storage=storage)

Params

ParameterTypeDefaultDescription
table_namestr-Name of the table to be used.
region_nameOptional[str]NoneRegion name of the DynamoDB table.
aws_access_key_idOptional[str]NoneAWS access key id, if provided.
aws_secret_access_keyOptional[str]NoneAWS secret access key, if provided.
endpoint_urlOptional[str]NoneEndpoint URL, if provided.
create_table_if_not_existsboolTrueIf true, creates the table if it does not exist.