Skip to content

Commit 05a5ede

Browse files
Merge pull request #92 from restackio/agentBump
Agent chat example: update to restack 101
2 parents 5b48ebd + 7c89411 commit 05a5ede

File tree

13 files changed

+172
-168
lines changed

13 files changed

+172
-168
lines changed

agent_chat/chat_post.png

1.65 KB
Loading

agent_chat/chat_put.png

-10 KB
Loading

agent_chat/chat_run.png

-14.6 KB
Loading
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
import { client } from "./src/client";
22

33
export type EventInput = {
4-
workflowId: string;
4+
agentId: string;
55
runId: string;
66
};
77

8-
async function eventWorkflow(input: EventInput) {
8+
async function eventAgent(input: EventInput) {
99
try {
10-
await client.sendWorkflowEvent({
10+
await client.sendAgentEvent({
1111
event: {
1212
name: "message",
1313
input: { content: "Tell me a joke" },
1414
},
15-
workflow: {
16-
workflowId: input.workflowId,
15+
agent: {
16+
agentId: input.agentId,
1717
runId: input.runId,
1818
},
1919
});
2020

21-
await client.sendWorkflowEvent({
21+
await client.sendAgentEvent({
2222
event: {
2323
name: "end",
2424
},
25-
workflow: {
26-
workflowId: input.workflowId,
25+
agent: {
26+
agentId: input.agentId,
2727
runId: input.runId,
2828
},
2929
});
3030

3131
process.exit(0); // Exit the process successfully
3232
} catch (error) {
33-
console.error("Error sending event to workflow:", error);
33+
console.error("Error sending event to agent:", error);
3434
process.exit(1); // Exit the process with an error code
3535
}
3636
}
3737

38-
eventWorkflow({
39-
workflowId: "your-workflow-id",
38+
eventAgent({
39+
agentId: "your-agent-id",
4040
runId: "your-run-id",
4141
});

agent_chat/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"dev": "open-cli http://localhost:5233 && tsx watch --include src src/services.ts",
77
"build": "tsc --build",
88
"clean": "rm -rf node_modules",
9-
"schedule-workflow": "tsx scheduleWorkflow.ts",
10-
"event-workflow": "tsx eventWorkflow.ts"
9+
"schedule-agent": "tsx scheduleAgent.ts",
10+
"event-agent": "tsx eventAgent.ts"
1111
},
1212
"dependencies": {
13-
"@restackio/ai": "^0.0.99",
13+
"@restackio/ai": "^0.0.102",
1414
"@temporalio/workflow": "1.11.3",
1515
"openai": "^4.80.1"
1616
},

0 commit comments

Comments
 (0)