diff --git a/agent_chat/chat_post.png b/agent_chat/chat_post.png index 981e234..3703745 100644 Binary files a/agent_chat/chat_post.png and b/agent_chat/chat_post.png differ diff --git a/agent_chat/chat_put.png b/agent_chat/chat_put.png index c0ab3af..3b5c768 100644 Binary files a/agent_chat/chat_put.png and b/agent_chat/chat_put.png differ diff --git a/agent_chat/chat_run.png b/agent_chat/chat_run.png index de3bc9d..cac8842 100644 Binary files a/agent_chat/chat_run.png and b/agent_chat/chat_run.png differ diff --git a/agent_chat/eventWorkflow.ts b/agent_chat/eventAgent.ts similarity index 57% rename from agent_chat/eventWorkflow.ts rename to agent_chat/eventAgent.ts index 0465493..17e78da 100644 --- a/agent_chat/eventWorkflow.ts +++ b/agent_chat/eventAgent.ts @@ -1,41 +1,41 @@ import { client } from "./src/client"; export type EventInput = { - workflowId: string; + agentId: string; runId: string; }; -async function eventWorkflow(input: EventInput) { +async function eventAgent(input: EventInput) { try { - await client.sendWorkflowEvent({ + await client.sendAgentEvent({ event: { name: "message", input: { content: "Tell me a joke" }, }, - workflow: { - workflowId: input.workflowId, + agent: { + agentId: input.agentId, runId: input.runId, }, }); - await client.sendWorkflowEvent({ + await client.sendAgentEvent({ event: { name: "end", }, - workflow: { - workflowId: input.workflowId, + agent: { + agentId: input.agentId, runId: input.runId, }, }); process.exit(0); // Exit the process successfully } catch (error) { - console.error("Error sending event to workflow:", error); + console.error("Error sending event to agent:", error); process.exit(1); // Exit the process with an error code } } -eventWorkflow({ - workflowId: "your-workflow-id", +eventAgent({ + agentId: "your-agent-id", runId: "your-run-id", }); diff --git a/agent_chat/package.json b/agent_chat/package.json index 65cc1c7..142c6ec 100644 --- a/agent_chat/package.json +++ b/agent_chat/package.json @@ -6,11 +6,11 @@ "dev": "open-cli http://localhost:5233 && tsx watch --include src src/services.ts", "build": "tsc --build", "clean": "rm -rf node_modules", - "schedule-workflow": "tsx scheduleWorkflow.ts", - "event-workflow": "tsx eventWorkflow.ts" + "schedule-agent": "tsx scheduleAgent.ts", + "event-agent": "tsx eventAgent.ts" }, "dependencies": { - "@restackio/ai": "^0.0.99", + "@restackio/ai": "^0.0.102", "@temporalio/workflow": "1.11.3", "openai": "^4.80.1" }, diff --git a/agent_chat/pnpm-lock.yaml b/agent_chat/pnpm-lock.yaml index 8dbdeb9..843b059 100644 --- a/agent_chat/pnpm-lock.yaml +++ b/agent_chat/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@restackio/ai': - specifier: ^0.0.99 - version: 0.0.99 + specifier: ^0.0.102 + version: 0.0.102 '@temporalio/workflow': specifier: 1.11.3 version: 1.11.3 @@ -264,72 +264,72 @@ packages: '@protobufjs/utf8@1.1.0': resolution: {integrity: sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==} - '@restackio/ai@0.0.99': - resolution: {integrity: sha512-qxLidh2blqUgBiAeR7DnsFclSIX1I7JPmKzgWRue7RuXTw9AypzOx9QTOogLx7bpOGTlooTAWLpRngvBsiF3dA==} + '@restackio/ai@0.0.102': + resolution: {integrity: sha512-z6UeLuyP5m0YiKWFo/iAmTI1GaxAqA0K3Y09jkx25g+FvDzRE6r4ODwxF5+QrXKm2ovH54ktJUYsoD9PU6+rhg==} engines: {node: '>=20'} - '@swc/core-darwin-arm64@1.10.11': - resolution: {integrity: sha512-ZpgEaNcx2e5D+Pd0yZGVbpSrEDOEubn7r2JXoNBf0O85lPjUm3HDzGRfLlV/MwxRPAkwm93eLP4l7gYnc50l3g==} + '@swc/core-darwin-arm64@1.10.12': + resolution: {integrity: sha512-pOANQegUTAriW7jq3SSMZGM5l89yLVMs48R0F2UG6UZsH04SiViCnDctOGlA/Sa++25C+rL9MGMYM1jDLylBbg==} engines: {node: '>=10'} cpu: [arm64] os: [darwin] - '@swc/core-darwin-x64@1.10.11': - resolution: {integrity: sha512-szObinnq2o7spXMDU5pdunmUeLrfV67Q77rV+DyojAiGJI1RSbEQotLOk+ONOLpoapwGUxOijFG4IuX1xiwQ2g==} + '@swc/core-darwin-x64@1.10.12': + resolution: {integrity: sha512-m4kbpIDDsN1FrwfNQMU+FTrss356xsXvatLbearwR+V0lqOkjLBP0VmRvQfHEg+uy13VPyrT9gj4HLoztlci7w==} engines: {node: '>=10'} cpu: [x64] os: [darwin] - '@swc/core-linux-arm-gnueabihf@1.10.11': - resolution: {integrity: sha512-tVE8aXQwd8JUB9fOGLawFJa76nrpvp3dvErjozMmWSKWqtoeO7HV83aOrVtc8G66cj4Vq7FjTE9pOJeV1FbKRw==} + '@swc/core-linux-arm-gnueabihf@1.10.12': + resolution: {integrity: sha512-OY9LcupgqEu8zVK+rJPes6LDJJwPDmwaShU96beTaxX2K6VrXbpwm5WbPS/8FfQTsmpnuA7dCcMPUKhNgmzTrQ==} engines: {node: '>=10'} cpu: [arm] os: [linux] - '@swc/core-linux-arm64-gnu@1.10.11': - resolution: {integrity: sha512-geFkENU5GMEKO7FqHOaw9HVlpQEW10nICoM6ubFc0hXBv8dwRXU4vQbh9s/isLSFRftw1m4jEEWixAnXSw8bxQ==} + '@swc/core-linux-arm64-gnu@1.10.12': + resolution: {integrity: sha512-nJD587rO0N4y4VZszz3xzVr7JIiCzSMhEMWnPjuh+xmPxDBz0Qccpr8xCr1cSxpl1uY7ERkqAGlKr6CwoV5kVg==} engines: {node: '>=10'} cpu: [arm64] os: [linux] - '@swc/core-linux-arm64-musl@1.10.11': - resolution: {integrity: sha512-2mMscXe/ivq8c4tO3eQSbQDFBvagMJGlalXCspn0DgDImLYTEnt/8KHMUMGVfh0gMJTZ9q4FlGLo7mlnbx99MQ==} + '@swc/core-linux-arm64-musl@1.10.12': + resolution: {integrity: sha512-oqhSmV+XauSf0C//MoQnVErNUB/5OzmSiUzuazyLsD5pwqKNN+leC3JtRQ/QVzaCpr65jv9bKexT9+I2Tt3xDw==} engines: {node: '>=10'} cpu: [arm64] os: [linux] - '@swc/core-linux-x64-gnu@1.10.11': - resolution: {integrity: sha512-eu2apgDbC4xwsigpl6LS+iyw6a3mL6kB4I+6PZMbFF2nIb1Dh7RGnu70Ai6mMn1o80fTmRSKsCT3CKMfVdeNFg==} + '@swc/core-linux-x64-gnu@1.10.12': + resolution: {integrity: sha512-XldSIHyjD7m1Gh+/8rxV3Ok711ENLI420CU2EGEqSe3VSGZ7pHJvJn9ZFbYpWhsLxPqBYMFjp3Qw+J6OXCPXCA==} engines: {node: '>=10'} cpu: [x64] os: [linux] - '@swc/core-linux-x64-musl@1.10.11': - resolution: {integrity: sha512-0n+wPWpDigwqRay4IL2JIvAqSKCXv6nKxPig9M7+epAlEQlqX+8Oq/Ap3yHtuhjNPb7HmnqNJLCXT1Wx+BZo0w==} + '@swc/core-linux-x64-musl@1.10.12': + resolution: {integrity: sha512-wvPXzJxzPgTqhyp1UskOx1hRTtdWxlyFD1cGWOxgLsMik0V9xKRgqKnMPv16Nk7L9xl6quQ6DuUHj9ID7L3oVw==} engines: {node: '>=10'} cpu: [x64] os: [linux] - '@swc/core-win32-arm64-msvc@1.10.11': - resolution: {integrity: sha512-7+bMSIoqcbXKosIVd314YjckDRPneA4OpG1cb3/GrkQTEDXmWT3pFBBlJf82hzJfw7b6lfv6rDVEFBX7/PJoLA==} + '@swc/core-win32-arm64-msvc@1.10.12': + resolution: {integrity: sha512-TUYzWuu1O7uyIcRfxdm6Wh1u+gNnrW5M1DUgDOGZLsyQzgc2Zjwfh2llLhuAIilvCVg5QiGbJlpibRYJ/8QGsg==} engines: {node: '>=10'} cpu: [arm64] os: [win32] - '@swc/core-win32-ia32-msvc@1.10.11': - resolution: {integrity: sha512-6hkLl4+3KjP/OFTryWxpW7YFN+w4R689TSPwiII4fFgsFNupyEmLWWakKfkGgV2JVA59L4Oi02elHy/O1sbgtw==} + '@swc/core-win32-ia32-msvc@1.10.12': + resolution: {integrity: sha512-4Qrw+0Xt+Fe2rz4OJ/dEPMeUf/rtuFWWAj/e0vL7J5laUHirzxawLRE5DCJLQTarOiYR6mWnmadt9o3EKzV6Xg==} engines: {node: '>=10'} cpu: [ia32] os: [win32] - '@swc/core-win32-x64-msvc@1.10.11': - resolution: {integrity: sha512-kKNE2BGu/La2k2WFHovenqZvGQAHRIU+rd2/6a7D6EiQ6EyimtbhUqjCCZ+N1f5fIAnvM+sMdLiQJq4jdd/oOQ==} + '@swc/core-win32-x64-msvc@1.10.12': + resolution: {integrity: sha512-YiloZXLW7rUxJpALwHXaGjVaAEn+ChoblG7/3esque+Y7QCyheoBUJp2DVM1EeVA43jBfZ8tvYF0liWd9Tpz1A==} engines: {node: '>=10'} cpu: [x64] os: [win32] - '@swc/core@1.10.11': - resolution: {integrity: sha512-3zGU5y3S20cAwot9ZcsxVFNsSVaptG+dKdmAxORSE3EX7ixe1Xn5kUwLlgIsM4qrwTUWCJDLNhRS+2HLFivcDg==} + '@swc/core@1.10.12': + resolution: {integrity: sha512-+iUL0PYpPm6N9AdV1wvafakvCqFegQus1aoEDxgFsv3/uNVNIyRaupf/v/Zkp5hbep2EzhtoJR0aiJIzDbXWHg==} engines: {node: '>=10'} peerDependencies: '@swc/helpers': '*' @@ -343,36 +343,36 @@ packages: '@swc/types@0.1.17': resolution: {integrity: sha512-V5gRru+aD8YVyCOMAjMpWR1Ui577DD5KSJsHP8RAxopAH22jFz6GZd/qxqjO6MJHQhcsjvjOFXyDhyLQUnMveQ==} - '@temporalio/activity@1.11.6': - resolution: {integrity: sha512-sEXB8wTmb5Jz02rh0sEIgT7eGhc68ASY0ccmJUCSgETVUzm+KsUszZygCaTImN6Zmpr1yIcoJ9+AQ3MTzUP/hg==} + '@temporalio/activity@1.11.7': + resolution: {integrity: sha512-8WjXmvre0He9RvipP5nPK8dDbC/EoMtllCjcdiyPI69jDiihoTxOLpiYXIXdHn9yGbf34lHa21ZiRVZNhFkeHg==} - '@temporalio/client@1.11.6': - resolution: {integrity: sha512-UxzX700i4AROxS9YIXK074A53wSuujoeIRnRxs7uVOdgzu8pLf30Wk+ZDq+ty6IeHA60qsTcZRs+PlBHqeuMUA==} + '@temporalio/client@1.11.7': + resolution: {integrity: sha512-rStMiKMNPH396TDBIDoavi2B/QQaV6NHHzEzhmyD7MoDJvuApIv1uSKcjYlRdmXiv0lF1FC2ONcquq7lmKSCYg==} '@temporalio/common@1.11.3': resolution: {integrity: sha512-dzCrwiE9ox/Q16AjBsUKr4djg1ovYHNCjH36WZadwsemXINRWa5eW53j0WZOlmFF8/CbcHIhiD5N18rZqjiYkg==} - '@temporalio/common@1.11.6': - resolution: {integrity: sha512-7yjHpJeDbVcqa2rk6spHTVhNob/oCXXrInZPSov9i2Pa0VElquiWpx8d9pJ8sATuxpBpvozNmTEnGWgNEI+G6w==} + '@temporalio/common@1.11.7': + resolution: {integrity: sha512-T3so7KE8nGmesjrbrfjtQLXhw7lJYKW87V/soxNeAxW/i3n3/7km3/dx8F7FBlgbu66Uu8CIWVbxLnVSS+Frbg==} - '@temporalio/core-bridge@1.11.6': - resolution: {integrity: sha512-6C+eOFKzs8SJ1q2t6a1HyIVj3E8YLC3k9u3n6doxrGo+d/QxJhs/3tJgW6cwFEKY1tdCNGR/gVM+BwvffLqykQ==} + '@temporalio/core-bridge@1.11.7': + resolution: {integrity: sha512-QiVqX2b+7GiZ9VlyeUunDILMvgU2UX2PyWXemuoLeM+33X/xbLW/UgwtDS2TKcON69UrUH1OG9yl6DPXpeOrfQ==} '@temporalio/proto@1.11.3': resolution: {integrity: sha512-X+xV75m11BvvS5MljagtYCybRNxpLNJM24eWyfv+uyU4WZSvgQCUh21fY4FOUDJS66DPvO1mefSPu0Nunp1PHg==} - '@temporalio/proto@1.11.6': - resolution: {integrity: sha512-N9qnyNabiY2LySft4fBrMCBNRoxbmADMdpP9+CX8RSVCHVLlf32FzkTUTFwZX1dOU+g2JsYrUzHFEBOPBpD8dQ==} + '@temporalio/proto@1.11.7': + resolution: {integrity: sha512-O34R2wk8PvmYpMHhsL7g2lIdtTA5wkQ5LJ86eHY0cF9zhDs/CoGiysl9qBOg9fy4WXHqzmcUm/V50hGefaM7gw==} - '@temporalio/worker@1.11.6': - resolution: {integrity: sha512-Y8ccZBN0c4KLe06DfWbw1Is11y2ENuN+oQvrl9Tw66OGCRLE1Kk08m59iQrWiehiXYzW1DRQG4IHlMjv0Tl8Rg==} + '@temporalio/worker@1.11.7': + resolution: {integrity: sha512-r8AMBFFQkZghsVnqJ7RcPBBXYhm498oATL7FY9WL1kBf73wQ7cZl82Vug1VT9fHF/SX3Kq8WdNXC3jPhO+jG6g==} engines: {node: '>= 16.0.0'} '@temporalio/workflow@1.11.3': resolution: {integrity: sha512-TT4TqzMveLY9UsWQUSkFyb9Qvoz4VvCcJCPCyKLQyrp5BuAsf7owOByOfs74gz2tgTQiPjk1TtV4YXXEPRb4yA==} - '@temporalio/workflow@1.11.6': - resolution: {integrity: sha512-WxPxjTJccP0tD5FwAQjdXZfqx6s5eYaBGgN9+VkMAEeW1KRfYs6dkaUj4qzzu5sN95zr71Euohk/sJG2jd3efQ==} + '@temporalio/workflow@1.11.7': + resolution: {integrity: sha512-NGNmGCoV3xPvRifjRhCZKbIbPAup92/OC2xuaTb3hzBb13N9Pbm6HVljgQORzKNyO55rXDRpTnAiJ40en57IgA==} '@tokenizer/token@0.3.0': resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==} @@ -577,8 +577,8 @@ packages: resolution: {integrity: sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==} engines: {node: '>=12'} - electron-to-chromium@1.5.88: - resolution: {integrity: sha512-K3C2qf1o+bGzbilTDCTBhTQcMS9KW60yTAaTeeXsfvQuTDDwlokLam/AdqlqcSy9u4UainDgsHV23ksXAOgamw==} + electron-to-chromium@1.5.90: + resolution: {integrity: sha512-C3PN4aydfW91Natdyd449Kw+BzhLmof6tzy5W1pFC5SpQxVXT+oyiyOG9AgYYSN9OdA/ik3YkCrpwqI8ug5Tug==} emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -1251,64 +1251,64 @@ snapshots: '@protobufjs/utf8@1.1.0': {} - '@restackio/ai@0.0.99': + '@restackio/ai@0.0.102': dependencies: - '@temporalio/activity': 1.11.6 - '@temporalio/client': 1.11.6 - '@temporalio/common': 1.11.6 - '@temporalio/worker': 1.11.6 - '@temporalio/workflow': 1.11.3 + '@temporalio/activity': 1.11.7 + '@temporalio/client': 1.11.7 + '@temporalio/common': 1.11.7 + '@temporalio/worker': 1.11.7 + '@temporalio/workflow': 1.11.7 transitivePeerDependencies: - '@swc/helpers' - esbuild - uglify-js - webpack-cli - '@swc/core-darwin-arm64@1.10.11': + '@swc/core-darwin-arm64@1.10.12': optional: true - '@swc/core-darwin-x64@1.10.11': + '@swc/core-darwin-x64@1.10.12': optional: true - '@swc/core-linux-arm-gnueabihf@1.10.11': + '@swc/core-linux-arm-gnueabihf@1.10.12': optional: true - '@swc/core-linux-arm64-gnu@1.10.11': + '@swc/core-linux-arm64-gnu@1.10.12': optional: true - '@swc/core-linux-arm64-musl@1.10.11': + '@swc/core-linux-arm64-musl@1.10.12': optional: true - '@swc/core-linux-x64-gnu@1.10.11': + '@swc/core-linux-x64-gnu@1.10.12': optional: true - '@swc/core-linux-x64-musl@1.10.11': + '@swc/core-linux-x64-musl@1.10.12': optional: true - '@swc/core-win32-arm64-msvc@1.10.11': + '@swc/core-win32-arm64-msvc@1.10.12': optional: true - '@swc/core-win32-ia32-msvc@1.10.11': + '@swc/core-win32-ia32-msvc@1.10.12': optional: true - '@swc/core-win32-x64-msvc@1.10.11': + '@swc/core-win32-x64-msvc@1.10.12': optional: true - '@swc/core@1.10.11': + '@swc/core@1.10.12': dependencies: '@swc/counter': 0.1.3 '@swc/types': 0.1.17 optionalDependencies: - '@swc/core-darwin-arm64': 1.10.11 - '@swc/core-darwin-x64': 1.10.11 - '@swc/core-linux-arm-gnueabihf': 1.10.11 - '@swc/core-linux-arm64-gnu': 1.10.11 - '@swc/core-linux-arm64-musl': 1.10.11 - '@swc/core-linux-x64-gnu': 1.10.11 - '@swc/core-linux-x64-musl': 1.10.11 - '@swc/core-win32-arm64-msvc': 1.10.11 - '@swc/core-win32-ia32-msvc': 1.10.11 - '@swc/core-win32-x64-msvc': 1.10.11 + '@swc/core-darwin-arm64': 1.10.12 + '@swc/core-darwin-x64': 1.10.12 + '@swc/core-linux-arm-gnueabihf': 1.10.12 + '@swc/core-linux-arm64-gnu': 1.10.12 + '@swc/core-linux-arm64-musl': 1.10.12 + '@swc/core-linux-x64-gnu': 1.10.12 + '@swc/core-linux-x64-musl': 1.10.12 + '@swc/core-win32-arm64-msvc': 1.10.12 + '@swc/core-win32-ia32-msvc': 1.10.12 + '@swc/core-win32-x64-msvc': 1.10.12 '@swc/counter@0.1.3': {} @@ -1316,16 +1316,16 @@ snapshots: dependencies: '@swc/counter': 0.1.3 - '@temporalio/activity@1.11.6': + '@temporalio/activity@1.11.7': dependencies: - '@temporalio/common': 1.11.6 + '@temporalio/common': 1.11.7 abort-controller: 3.0.0 - '@temporalio/client@1.11.6': + '@temporalio/client@1.11.7': dependencies: '@grpc/grpc-js': 1.12.5 - '@temporalio/common': 1.11.6 - '@temporalio/proto': 1.11.6 + '@temporalio/common': 1.11.7 + '@temporalio/proto': 1.11.7 abort-controller: 3.0.0 long: 5.2.3 uuid: 9.0.1 @@ -1337,16 +1337,16 @@ snapshots: ms: 3.0.0-canary.1 proto3-json-serializer: 2.0.2 - '@temporalio/common@1.11.6': + '@temporalio/common@1.11.7': dependencies: - '@temporalio/proto': 1.11.6 + '@temporalio/proto': 1.11.7 long: 5.2.3 ms: 3.0.0-canary.1 proto3-json-serializer: 2.0.2 - '@temporalio/core-bridge@1.11.6': + '@temporalio/core-bridge@1.11.7': dependencies: - '@temporalio/common': 1.11.6 + '@temporalio/common': 1.11.7 arg: 5.0.2 cargo-cp-artifact: 0.1.9 which: 4.0.0 @@ -1356,30 +1356,30 @@ snapshots: long: 5.2.3 protobufjs: 7.4.0 - '@temporalio/proto@1.11.6': + '@temporalio/proto@1.11.7': dependencies: long: 5.2.3 protobufjs: 7.4.0 - '@temporalio/worker@1.11.6': + '@temporalio/worker@1.11.7': dependencies: - '@swc/core': 1.10.11 - '@temporalio/activity': 1.11.6 - '@temporalio/client': 1.11.6 - '@temporalio/common': 1.11.6 - '@temporalio/core-bridge': 1.11.6 - '@temporalio/proto': 1.11.6 - '@temporalio/workflow': 1.11.6 + '@swc/core': 1.10.12 + '@temporalio/activity': 1.11.7 + '@temporalio/client': 1.11.7 + '@temporalio/common': 1.11.7 + '@temporalio/core-bridge': 1.11.7 + '@temporalio/proto': 1.11.7 + '@temporalio/workflow': 1.11.7 abort-controller: 3.0.0 heap-js: 2.6.0 memfs: 4.17.0 rxjs: 7.8.1 source-map: 0.7.4 - source-map-loader: 4.0.2(webpack@5.97.1(@swc/core@1.10.11)) + source-map-loader: 4.0.2(webpack@5.97.1(@swc/core@1.10.12)) supports-color: 8.1.1 - swc-loader: 0.2.6(@swc/core@1.10.11)(webpack@5.97.1(@swc/core@1.10.11)) + swc-loader: 0.2.6(@swc/core@1.10.12)(webpack@5.97.1(@swc/core@1.10.12)) unionfs: 4.5.4 - webpack: 5.97.1(@swc/core@1.10.11) + webpack: 5.97.1(@swc/core@1.10.12) transitivePeerDependencies: - '@swc/helpers' - esbuild @@ -1391,10 +1391,10 @@ snapshots: '@temporalio/common': 1.11.3 '@temporalio/proto': 1.11.3 - '@temporalio/workflow@1.11.6': + '@temporalio/workflow@1.11.7': dependencies: - '@temporalio/common': 1.11.6 - '@temporalio/proto': 1.11.6 + '@temporalio/common': 1.11.7 + '@temporalio/proto': 1.11.7 '@tokenizer/token@0.3.0': {} @@ -1555,7 +1555,7 @@ snapshots: browserslist@4.24.4: dependencies: caniuse-lite: 1.0.30001696 - electron-to-chromium: 1.5.88 + electron-to-chromium: 1.5.90 node-releases: 2.0.19 update-browserslist-db: 1.1.2(browserslist@4.24.4) @@ -1621,7 +1621,7 @@ snapshots: dotenv@16.4.7: {} - electron-to-chromium@1.5.88: {} + electron-to-chromium@1.5.90: {} emoji-regex@8.0.0: {} @@ -1918,11 +1918,11 @@ snapshots: source-map-js@1.2.1: {} - source-map-loader@4.0.2(webpack@5.97.1(@swc/core@1.10.11)): + source-map-loader@4.0.2(webpack@5.97.1(@swc/core@1.10.12)): dependencies: iconv-lite: 0.6.3 source-map-js: 1.2.1 - webpack: 5.97.1(@swc/core@1.10.11) + webpack: 5.97.1(@swc/core@1.10.12) source-map-support@0.5.21: dependencies: @@ -1956,11 +1956,11 @@ snapshots: dependencies: has-flag: 4.0.0 - swc-loader@0.2.6(@swc/core@1.10.11)(webpack@5.97.1(@swc/core@1.10.11)): + swc-loader@0.2.6(@swc/core@1.10.12)(webpack@5.97.1(@swc/core@1.10.12)): dependencies: - '@swc/core': 1.10.11 + '@swc/core': 1.10.12 '@swc/counter': 0.1.3 - webpack: 5.97.1(@swc/core@1.10.11) + webpack: 5.97.1(@swc/core@1.10.12) tapable@2.2.1: {} @@ -1973,16 +1973,16 @@ snapshots: type-fest: 2.19.0 unique-string: 3.0.0 - terser-webpack-plugin@5.3.11(@swc/core@1.10.11)(webpack@5.97.1(@swc/core@1.10.11)): + terser-webpack-plugin@5.3.11(@swc/core@1.10.12)(webpack@5.97.1(@swc/core@1.10.12)): dependencies: '@jridgewell/trace-mapping': 0.3.25 jest-worker: 27.5.1 schema-utils: 4.3.0 serialize-javascript: 6.0.2 terser: 5.37.0 - webpack: 5.97.1(@swc/core@1.10.11) + webpack: 5.97.1(@swc/core@1.10.12) optionalDependencies: - '@swc/core': 1.10.11 + '@swc/core': 1.10.12 terser@5.37.0: dependencies: @@ -2058,7 +2058,7 @@ snapshots: webpack-sources@3.2.3: {} - webpack@5.97.1(@swc/core@1.10.11): + webpack@5.97.1(@swc/core@1.10.12): dependencies: '@types/eslint-scope': 3.7.7 '@types/estree': 1.0.6 @@ -2080,7 +2080,7 @@ snapshots: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.11(@swc/core@1.10.11)(webpack@5.97.1(@swc/core@1.10.11)) + terser-webpack-plugin: 5.3.11(@swc/core@1.10.12)(webpack@5.97.1(@swc/core@1.10.12)) watchpack: 2.4.2 webpack-sources: 3.2.3 transitivePeerDependencies: diff --git a/agent_chat/readme.md b/agent_chat/readme.md index df0de69..5f1fda3 100644 --- a/agent_chat/readme.md +++ b/agent_chat/readme.md @@ -1,6 +1,6 @@ # Restack Agent Chat -A sample repository with a an agent chat workflow. +A sample repository with a an agent chat. ## Requirements @@ -22,31 +22,31 @@ npm run dev ``` This will start a Node.js app with Restack Services. -Your code will be running and syncing with Restack to execute workflows or functions. +Your code will be running and syncing with Restack to execute agents. -## Run workflows +## Run agents ### from UI -You can run workflows from the UI by clicking the "Run" button. +You can run agents from the UI by clicking the "Run" button. -![Run workflows from UI](./chat_post.png) +![Run agents from UI](./chat_post.png) ### from API -You can run workflows from the API by using the generated endpoint: +You can run agents from the API by using the generated endpoint: -`POST http://localhost:6233/api/workflows/agentChat` +`POST http://localhost:6233/api/agents/agentChat` ### from any client -You can run workflows with any client connected to Restack, for example: +You can run agents with any client connected to Restack, for example: ```bash -npm schedule-workflow +npm schedule-agent ``` -executes `scheduleWorkflow.ts` which will connect to Restack and execute the `agentChat` workflow. +executes `scheduleAgent.ts` which will connect to Restack and execute the `agentChat` agent. ## Send events to the Agent @@ -64,7 +64,7 @@ And see the events in the run: You can send events to the agent by using the following endpoint: -`PUT http://localhost:6233/api/workflows/AgentWorkflow/:workflowId/:runId` +`PUT http://localhost:6233/api/agents/AgentChat/:agentId/:runId` with the payload: @@ -89,12 +89,12 @@ to end the conversation with the agent. ### from any client -You can send event to the agent workflows with any client connected to Restack, for example: +You can send event to the agent with any client connected to Restack, for example: -Modify workflow_id and run_id in event_workflow.py and then run: +Modify agentId and runId in eventAgent.ts and then run: ```bash -pnpm event-workflow +pnpm event-agent ``` It will connect to Restack and send 2 events to the agent, one to generate another agent and another one to end the conversation. diff --git a/agent_chat/scheduleAgent.ts b/agent_chat/scheduleAgent.ts new file mode 100644 index 0000000..6b2a88a --- /dev/null +++ b/agent_chat/scheduleAgent.ts @@ -0,0 +1,29 @@ +import { client } from "./src/client"; + +export type InputSchedule = { + name: string; +}; + +async function scheduleAgent(input: InputSchedule) { + try { + const agentId = `${Date.now()}-AgentChat`; + const runId = await client.scheduleAgent({ + agentName: "agentChat", + agentId, + input, + }); + + const result = await client.getAgentResult({ agentId, runId }); + + console.log("Agent result:", result); + + process.exit(0); // Exit the process successfully + } catch (error) { + console.error("Error scheduling agent:", error); + process.exit(1); // Exit the process with an error code + } +} + +scheduleAgent({ + name: "test", +}); diff --git a/agent_chat/scheduleWorkflow.ts b/agent_chat/scheduleWorkflow.ts deleted file mode 100644 index 00165f0..0000000 --- a/agent_chat/scheduleWorkflow.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { client } from "./src/client"; - -export type InputSchedule = { - name: string; -}; - -async function scheduleWorkflow(input: InputSchedule) { - try { - const workflowId = `${Date.now()}-AgentChat`; - const runId = await client.scheduleWorkflow({ - workflowName: "agentChat", - workflowId, - input, - }); - - const result = await client.getWorkflowResult({ workflowId, runId }); - - console.log("Workflow result:", result); - - process.exit(0); // Exit the process successfully - } catch (error) { - console.error("Error scheduling workflow:", error); - process.exit(1); // Exit the process with an error code - } -} - -scheduleWorkflow({ - name: "test", -}); diff --git a/agent_chat/src/workflows/workflow.ts b/agent_chat/src/agents/agent.ts similarity index 88% rename from agent_chat/src/workflows/workflow.ts rename to agent_chat/src/agents/agent.ts index 399361a..b3b3e02 100644 --- a/agent_chat/src/workflows/workflow.ts +++ b/agent_chat/src/agents/agent.ts @@ -1,6 +1,11 @@ -import { condition, log, step } from "@restackio/ai/workflow"; +import { + defineEvent, + onEvent, + condition, + log, + step, +} from "@restackio/ai/agent"; import * as functions from "../functions"; -import { defineEvent, onEvent } from "@restackio/ai/event"; export type EndEvent = { end: boolean; diff --git a/agent_chat/src/agents/index.ts b/agent_chat/src/agents/index.ts new file mode 100644 index 0000000..ed4e7c1 --- /dev/null +++ b/agent_chat/src/agents/index.ts @@ -0,0 +1 @@ +export * from "./agent"; diff --git a/agent_chat/src/services.ts b/agent_chat/src/services.ts index 6b0f547..b275be4 100644 --- a/agent_chat/src/services.ts +++ b/agent_chat/src/services.ts @@ -2,12 +2,11 @@ import { llmChat } from "./functions"; import { client } from "./client"; async function services() { - const workflowsPath = require.resolve("./workflows"); + const agentsPath = require.resolve("./agents"); try { await Promise.all([ - // Start service with current workflows and functions client.startService({ - workflowsPath, + agentsPath: agentsPath, functions: { llmChat }, }), ]); diff --git a/agent_chat/src/workflows/index.ts b/agent_chat/src/workflows/index.ts deleted file mode 100644 index b6411ba..0000000 --- a/agent_chat/src/workflows/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./workflow";