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 DynamoDb23# AWS Credentials4AWS_ACCESS_KEY_ID = getenv("AWS_ACCESS_KEY_ID")5AWS_SECRET_ACCESS_KEY = getenv("AWS_SECRET_ACCESS_KEY")67db = DynamoDb(8 region_name="us-east-1",9 # aws_access_key_id: AWS access key id10 aws_access_key_id=AWS_ACCESS_KEY_ID,11 # aws_secret_access_key: AWS secret access key12 aws_secret_access_key=AWS_SECRET_ACCESS_KEY,13)1415# Add storage to the Agent16agent = Agent(db=db)Params
| Parameter | Type | Default | Description |
|---|---|---|---|
id | Optional[str] | - | The ID of the database instance. UUID by default. |
db_client | None | - | The DynamoDB client to use. |
region_name | optional[str] | - | AWS region name. |
aws_access_key_id | optional[str] | - | AWS access key ID. |
aws_secret_access_key | optional[str] | - | AWS secret access key. |
session_table | optional[str] | - | The name of the session table. |
memory_table | optional[str] | - | The name of the memory table. |
metrics_table | optional[str] | - | The name of the metrics table. |
eval_table | optional[str] | - | The name of the eval table. |
knowledge_table | optional[str] | - | The name of the knowledge table. |
traces_table | optional[str] | - | The name of the traces table. |
spans_table | optional[str] | - | The name of the spans table. |