Skip to content

Commit d8c9684

Browse files
Merge pull request #10 from SmythOS/storage-data-isolation-fix
Storage data isolation fix
2 parents 0c52922 + f812fb2 commit d8c9684

File tree

27 files changed

+285
-115
lines changed

27 files changed

+285
-115
lines changed

examples/01-agent-code-skill/01-prompting.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import { Agent } from '@smythos/sdk';
1+
import { Agent, Scope } from '@smythos/sdk';
22

33
async function main() {
44
const agent = new Agent({
5+
id: 'crypto-market-assistant',
6+
teamId: 'the-matrix',
57
name: 'CryptoMarket Assistant',
68
behavior: 'You are a crypto price tracker. You are given a coin id and you need to get the price of the coin in USD',
79
model: 'gpt-4o',
@@ -18,6 +20,9 @@ async function main() {
1820
},
1921
});
2022

23+
const storage = agent.storage.LocalStorage({ scope: Scope.TEAM });
24+
await storage.write('test0001.txt', 'Hello, world!');
25+
2126
//this will prompt the agent and use the agent's LLM to determine which skill to use
2227
const promptResult = await agent.prompt('What are the current prices of Bitcoin and Ethereum ?');
2328
//the response comes back in natural language

examples/02-agent-smyth-file/01-load-prompt-smyth-file.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ async function main() {
2929

3030
console.log(result);
3131

32-
const mcpUrl = await agent.mcp(MCPTransport.SSE, 3399);
33-
34-
console.log(`MCP server started on ${mcpUrl}`);
3532
}
3633

3734
main();
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Storage } from '@smythos/sdk';
2+
3+
async function main() {
4+
const localStorage = Storage.LocalStorage();
5+
6+
await localStorage.write('test.txt', 'Hello, world!');
7+
8+
const data = await localStorage.read('test.txt');
9+
10+
const dataAsString = data.toString();
11+
12+
console.log(dataAsString);
13+
14+
15+
}
16+
17+
main();
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Storage } from '@smythos/sdk';
2+
3+
async function main() {
4+
const localStorage = Storage.S3({
5+
region: process.env.AWS_REGION,
6+
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
7+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
8+
bucket: process.env.AWS_BUCKET_NAME
9+
})
10+
11+
await localStorage.write('test.txt', 'Hello, world!');
12+
13+
const data = await localStorage.read('test.txt');
14+
15+
const dataAsString = data.toString();
16+
17+
console.log(dataAsString);
18+
19+
}
20+
21+
main();

0 commit comments

Comments
 (0)