File tree Expand file tree Collapse file tree 3 files changed +620
-67
lines changed
Expand file tree Collapse file tree 3 files changed +620
-67
lines changed Original file line number Diff line number Diff line change 2727 "@copilotkit/shared" : " 1.8.14-next.4" ,
2828 "@mastra/client-js" : " ^0.10.9" ,
2929 "@mastra/core" : " ^0.10.10" ,
30+ "@mastra/dynamodb" : " ^0.13.0" ,
3031 "@mastra/libsql" : " ^0.11.0" ,
3132 "@mastra/loggers" : " ^0.10.3" ,
3233 "@mastra/memory" : " ^0.11.1" ,
Original file line number Diff line number Diff line change @@ -2,10 +2,24 @@ import { openai } from "@ai-sdk/openai";
22import { Agent } from "@mastra/core/agent" ;
33import { Memory } from "@mastra/memory" ;
44import { LibSQLStore } from "@mastra/libsql" ;
5+ import { DynamoDBStore } from "@mastra/dynamodb" ;
6+
57import { Mastra } from "@mastra/core" ;
68import { z } from "zod" ;
79
8- // import { weatherTool } from "../tools/weather-tool";
10+
11+ let storage : LibSQLStore | DynamoDBStore
12+
13+ if ( process . env . DYNAMODB_TABLE_NAME ) {
14+ storage = new DynamoDBStore ( {
15+ name : "dynamodb" ,
16+ config : {
17+ tableName : process . env . DYNAMODB_TABLE_NAME
18+ } ,
19+ } ) ;
20+ } else {
21+ storage = new LibSQLStore ( { url : "file::memory:" } ) ;
22+ }
923
1024export const mastra = new Mastra ( {
1125 agents : {
@@ -24,9 +38,8 @@ export const mastra = new Mastra({
2438 Use the weatherTool to fetch current weather data.
2539 ` ,
2640 model : openai ( "gpt-4o" ) ,
27- // tools: { weatherTool },
2841 memory : new Memory ( {
29- storage : new LibSQLStore ( { url : "file::memory:" } ) ,
42+ storage : storage ,
3043 options : {
3144 workingMemory : {
3245 enabled : true ,
@@ -53,7 +66,7 @@ export const mastra = new Mastra({
5366 ` ,
5467 model : openai ( "gpt-4o" ) ,
5568 memory : new Memory ( {
56- storage : new LibSQLStore ( { url : "file::memory:" } ) ,
69+ storage : storage ,
5770 options : {
5871 workingMemory : {
5972 enabled : true ,
You can’t perform that action at this time.
0 commit comments