DynamoDB for Agent

Kern supports using DynamoDB as a storage backend for Agents using the DynamoDb class.

Usage

You need to provide aws_access_key_id and aws_secret_access_key parameters to the DynamoDb class.

1from kern.db.dynamo import DynamoDb
2
3# AWS Credentials
4AWS_ACCESS_KEY_ID = getenv("AWS_ACCESS_KEY_ID")
5AWS_SECRET_ACCESS_KEY = getenv("AWS_SECRET_ACCESS_KEY")
6
7db = DynamoDb(
8 region_name="us-east-1",
9 # aws_access_key_id: AWS access key id
10 aws_access_key_id=AWS_ACCESS_KEY_ID,
11 # aws_secret_access_key: AWS secret access key
12 aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
13)
14
15# Add storage to the Agent
16agent = Agent(db=db)

Params

ParameterTypeDefaultDescription
idOptional[str]-The ID of the database instance. UUID by default.
db_clientNone-The DynamoDB client to use.
region_nameoptional[str]-AWS region name.
aws_access_key_idoptional[str]-AWS access key ID.
aws_secret_access_keyoptional[str]-AWS secret access key.
session_tableoptional[str]-The name of the session table.
memory_tableoptional[str]-The name of the memory table.
metrics_tableoptional[str]-The name of the metrics table.
eval_tableoptional[str]-The name of the eval table.
knowledge_tableoptional[str]-The name of the knowledge table.
traces_tableoptional[str]-The name of the traces table.
spans_tableoptional[str]-The name of the spans table.