DynamoDB Workflow Storage
Kern supports using DynamoDB as a storage backend for Workflows 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.agent import Agent2from kern.db.dynamodb import DynamoDb3from kern.models.openai import OpenAIResponses4from kern.team import Team5from kern.tools.hackernews import HackerNewsTools6from kern.tools.hackernews import HackerNewsTools7from kern.workflow.step import Step8from kern.workflow.workflow import Workflow910db = DynamoDb()1112# Define agents13hackernews_agent = Agent(14 name="Hackernews Agent",15 model=OpenAIResponses(id="gpt-5.2"),16 tools=[HackerNewsTools()],17 role="Extract key insights and content from Hackernews posts",18)19web_agent = Agent(20 name="Web Agent",21 model=OpenAIResponses(id="gpt-5.2"),22 tools=[HackerNewsTools()],23 role="Search the web for the latest news and trends",24)2526# Define research team for complex analysis27research_team = Team(28 name="Research Team",29 members=[hackernews_agent, web_agent],30 instructions="Research tech topics from Hackernews and the web",31)3233content_planner = Agent(34 name="Content Planner",35 model=OpenAIResponses(id="gpt-5.2"),36 instructions=[37 "Plan a content schedule over 4 weeks for the provided topic and research content",38 "Ensure that I have posts for 3 posts per week",39 ],40)4142# Define steps43research_step = Step(44 name="Research Step",45 team=research_team,46)4748content_planning_step = Step(49 name="Content Planning Step",50 agent=content_planner,51)5253# Create and use workflow54if __name__ == "__main__":55 content_creation_workflow = Workflow(56 name="Content Creation Workflow",57 description="Automated content creation from blog posts to social media",58 db=db,59 steps=[research_step, content_planning_step],60 )61 content_creation_workflow.print_response(62 input="AI trends in 2024",63 markdown=True,64 )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. |