├── packages ├── ai-agent-sdk │ ├── .gitignore │ ├── src │ │ ├── core │ │ │ ├── base │ │ │ │ ├── index.ts │ │ │ │ └── base.ts │ │ │ ├── llm │ │ │ │ ├── index.ts │ │ │ │ ├── llm.ts │ │ │ │ └── llm.types.ts │ │ │ ├── zee │ │ │ │ ├── index.ts │ │ │ │ ├── zee.types.ts │ │ │ │ └── zee.ts │ │ │ ├── agent │ │ │ │ ├── index.ts │ │ │ │ ├── agent.types.ts │ │ │ │ └── agent.ts │ │ │ └── tools │ │ │ │ ├── index.ts │ │ │ │ ├── goldrush │ │ │ │ ├── index.ts │ │ │ │ ├── nft-balances.ts │ │ │ │ ├── goldrush.ts │ │ │ │ ├── token-balances.ts │ │ │ │ ├── transactions.ts │ │ │ │ └── historical-token-price.ts │ │ │ │ ├── tool.ts │ │ │ │ └── tool.types.ts │ │ ├── index.ts │ │ ├── functions.ts │ │ └── tests │ │ │ ├── agent.test.ts │ │ │ ├── llm.test.ts │ │ │ ├── goldrush.tools.test.ts │ │ │ └── zee.test.ts │ ├── .env.example │ ├── CHANGELOG.md │ ├── vitest.config.ts │ ├── LICENSE │ ├── tsconfig.json │ └── package.json └── create-zee-app │ ├── templates │ ├── 001-zee-barebones │ │ ├── .gitignore │ │ ├── .env.example │ │ ├── README.md │ │ ├── tsconfig.json │ │ ├── LICENSE │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ └── package-lock.json │ └── 002-onchain-workflow │ │ ├── .gitignore │ │ ├── .env.example │ │ ├── tsconfig.json │ │ ├── LICENSE │ │ ├── package.json │ │ ├── src │ │ └── index.ts │ │ └── README.md │ ├── bin │ └── create-zee-app │ ├── tsconfig.json │ ├── LICENSE │ ├── package.json │ ├── README.md │ └── src │ └── index.ts ├── docs ├── package.json ├── get-started │ ├── installation.mdx │ ├── quickstart.mdx │ └── overview.mdx ├── favicon.svg ├── concepts │ ├── zee-workflows.mdx │ ├── tools.mdx │ ├── agents.mdx │ └── llms.mdx ├── mint.json ├── logo │ ├── dark.svg │ └── light.svg ├── tools │ └── goldrush-onchain-data.mdx └── zee-use-cases.mdx ├── pnpm-workspace.yaml ├── .prettierignore ├── .prettierrc ├── LICENSE ├── .github └── workflows │ └── ci.yml ├── package.json ├── .gitignore ├── eslint.config.mjs └── README.md /packages/ai-agent-sdk/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .env 4 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/base/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./base"; 2 | -------------------------------------------------------------------------------- /packages/create-zee-app/templates/001-zee-barebones/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | node_modules 3 | -------------------------------------------------------------------------------- /packages/create-zee-app/templates/002-onchain-workflow/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | node_modules 3 | -------------------------------------------------------------------------------- /packages/create-zee-app/bin/create-zee-app: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import "../dist/index.js"; 3 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/llm/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./llm"; 2 | export * from "./llm.types"; 3 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/zee/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./zee"; 2 | export * from "./zee.types"; 3 | -------------------------------------------------------------------------------- /packages/create-zee-app/templates/001-zee-barebones/.env.example: -------------------------------------------------------------------------------- 1 | AI_AGENT_SDK_API_KEY! 2 | OPENAI_API_KEY! -------------------------------------------------------------------------------- /packages/create-zee-app/templates/002-onchain-workflow/.env.example: -------------------------------------------------------------------------------- 1 | GOLDRUSH_API_KEY! 2 | OPENAI_API_KEY! -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/agent/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./agent"; 2 | export * from "./agent.types"; 3 | -------------------------------------------------------------------------------- /docs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "mintlify": "^4.0.346", 4 | "prettier": "^3.4.2" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/tools/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./goldrush"; 2 | export * from "./tool"; 3 | export * from "./tool.types"; 4 | -------------------------------------------------------------------------------- /packages/create-zee-app/templates/001-zee-barebones/README.md: -------------------------------------------------------------------------------- 1 | # Your AI agent 2 | 3 | This is a barebones template for creating an AI agent. 4 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/.env.example: -------------------------------------------------------------------------------- 1 | # LLM API Keys 2 | OPENAI_API_KEY 3 | GOOGLE_GENERATIVE_AI_API_KEY 4 | ANTHROPIC_API_KEY 5 | 6 | # Tool API Keys 7 | GOLDRUSH_API_KEY 8 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./core/agent"; 2 | export * from "./core/llm"; 3 | export * from "./core/tools"; 4 | export * from "./core/zee"; 5 | export * from "./functions"; 6 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog for AI Agent SDK 2 | 3 | ## 0.3.0 4 | 5 | **Features** 6 | 7 | - Shifted to Vercel's AI SDK 8 | - Updated ZEE workflow 9 | - Added multimodal input (images and files) support 10 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/tools/goldrush/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./goldrush"; 2 | export * from "./historical-token-price"; 3 | export * from "./nft-balances"; 4 | export * from "./token-balances"; 5 | export * from "./transactions"; 6 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vitest/config"; 2 | 3 | export default defineConfig({ 4 | test: { 5 | exclude: ["dist", "node_modules"], 6 | testTimeout: 500_000, 7 | }, 8 | }); 9 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | # all packages in subdirs of packages/ 3 | - "packages/*" 4 | # exclude test directories 5 | - "!**/test/**" 6 | # Ignore the template 7 | - "!packages/create-zee-app/template" 8 | # exclude build directories 9 | - "!**/dist/**" 10 | -------------------------------------------------------------------------------- /packages/create-zee-app/templates/001-zee-barebones/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES6", 4 | "module": "commonjs", 5 | "strict": true, 6 | "esModuleInterop": true, 7 | "skipLibCheck": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "outDir": "./dist", 10 | "baseUrl": "./src" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/create-zee-app/templates/002-onchain-workflow/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES6", 4 | "module": "commonjs", 5 | "strict": true, 6 | "esModuleInterop": true, 7 | "skipLibCheck": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "outDir": "./dist", 10 | "baseUrl": "./src" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/get-started/installation.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Installation 3 | description: How to install the AI Agent SDK. 4 | icon: "download" 5 | --- 6 | 7 | 8 | 9 | ```shell npm 10 | npm install @covalenthq/ai-agent-sdk 11 | ``` 12 | 13 | ```shell pnpm 14 | pnpm install @covalenthq/ai-agent-sdk 15 | ``` 16 | 17 | ```shell yarn 18 | yarn add @covalenthq/ai-agent-sdk 19 | ``` 20 | 21 | 22 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/tools/tool.ts: -------------------------------------------------------------------------------- 1 | import type { ToolParams } from "."; 2 | import { tool } from "ai"; 3 | import type { AnyZodObject } from "zod"; 4 | 5 | export class Tool { 6 | constructor(params: ToolParams) { 7 | return tool({ 8 | id: `${params.provider}.${params.name}` satisfies `${string}.${string}`, 9 | description: params.description, 10 | parameters: params.parameters, 11 | execute: params.execute, 12 | }); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/tools/tool.types.ts: -------------------------------------------------------------------------------- 1 | import type { ModelProvider } from "../llm"; 2 | import type { Tool } from "./tool"; 3 | import type { AnyZodObject, infer as ZodInfer } from "zod"; 4 | 5 | export interface ToolParams { 6 | name: string; 7 | description: string; 8 | parameters: ZOD_OBJECT; 9 | execute: (params: ZodInfer) => Promise; 10 | provider: ModelProvider["provider"]; 11 | } 12 | 13 | export type ToolSet = Record>; 14 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/agent/agent.types.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | GenerateTextParams, 3 | LLMTextResponse, 4 | ModelProvider, 5 | } from "../llm"; 6 | import type { ToolSet } from "../tools"; 7 | 8 | export type AgentConfig = { 9 | name: string; 10 | model: ModelProvider; 11 | description: string; 12 | instructions?: string[]; 13 | tools?: ToolSet; 14 | temperature?: number; 15 | }; 16 | 17 | export type AgentGenerateParameters = Omit< 18 | GenerateTextParams, 19 | "prompt" | "tools" | "toolChoice" 20 | >; 21 | 22 | export type AgentResponse = LLMTextResponse; 23 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Ignore artifacts 2 | dist/ 3 | build/ 4 | node_modules/ 5 | coverage/ 6 | *.min.js 7 | *.min.css 8 | 9 | # Ignore configuration files 10 | *.config.js 11 | *.config.ts 12 | .env 13 | .env.local 14 | 15 | # Ignore common files 16 | package-lock.json 17 | yarn.lock 18 | pnpm-lock.yaml 19 | 20 | # Ignore documentation 21 | CHANGELOG.md 22 | LICENSE 23 | README.md 24 | 25 | # Ignore specific patterns 26 | **/*.svg 27 | **/*.png 28 | **/*.jpg 29 | **/*.jpeg 30 | **/*.gif 31 | **/*.ico 32 | **/*.woff 33 | **/*.woff2 34 | **/*.ttf 35 | **/*.eot 36 | **/*.mp4 37 | **/*.webm 38 | **/*.ogg 39 | **/*.mp3 40 | **/*.wav 41 | **/*.flac 42 | **/*.aac 43 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "tabWidth": 4, 4 | "useTabs": false, 5 | "semi": true, 6 | "singleQuote": false, 7 | "quoteProps": "as-needed", 8 | "jsxSingleQuote": false, 9 | "trailingComma": "es5", 10 | "bracketSpacing": true, 11 | "bracketSameLine": false, 12 | "arrowParens": "always", 13 | "requirePragma": false, 14 | "insertPragma": false, 15 | "proseWrap": "preserve", 16 | "htmlWhitespaceSensitivity": "css", 17 | "vueIndentScriptAndStyle": false, 18 | "endOfLine": "auto", 19 | "embeddedLanguageFormatting": "auto", 20 | "singleAttributePerLine": false, 21 | "plugins": ["@trivago/prettier-plugin-sort-imports"] 22 | } 23 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/base/base.ts: -------------------------------------------------------------------------------- 1 | import "dotenv/config"; 2 | import pino from "pino"; 3 | 4 | export const logger = pino({ 5 | level: "debug", 6 | }); 7 | 8 | export type MODULE = "agent" | "llm" | "tools" | "server" | "zee"; 9 | 10 | export class Base { 11 | private logger: pino.Logger; 12 | private module: MODULE; 13 | 14 | constructor(module: MODULE) { 15 | this.logger = logger; 16 | this.module = module; 17 | } 18 | 19 | // TODO: setup logger for different levels 20 | info(message: string, ...args: unknown[]) { 21 | // this.logger.info(`[${this.module}] ${message}`, ...args); 22 | console.log(`[${this.module}] ${message}`, ...args); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/functions.ts: -------------------------------------------------------------------------------- 1 | import type { UserContentAttachments } from "./core/llm/llm.types"; 2 | import type { 3 | AssistantContent, 4 | CoreAssistantMessage, 5 | CoreSystemMessage, 6 | CoreUserMessage, 7 | } from "ai"; 8 | 9 | export const userMessage = ( 10 | content: string | UserContentAttachments 11 | ): CoreUserMessage => { 12 | return { 13 | role: "user", 14 | content, 15 | }; 16 | }; 17 | 18 | export const assistantMessage = ( 19 | content: AssistantContent 20 | ): CoreAssistantMessage => { 21 | return { 22 | role: "assistant", 23 | content, 24 | }; 25 | }; 26 | 27 | export const systemMessage = (content: string): CoreSystemMessage => { 28 | return { 29 | role: "system", 30 | content, 31 | }; 32 | }; 33 | -------------------------------------------------------------------------------- /docs/favicon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Covalent 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/create-zee-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "ESNext", 5 | "moduleResolution": "node", 6 | "lib": ["ES2022", "DOM"], 7 | "rootDir": "./src", 8 | "outDir": "./dist", 9 | "strict": true, 10 | "alwaysStrict": true, 11 | "noImplicitAny": true, 12 | "noImplicitThis": true, 13 | "strictNullChecks": true, 14 | "strictFunctionTypes": true, 15 | "strictBindCallApply": true, 16 | "noUncheckedIndexedAccess": true, 17 | "noPropertyAccessFromIndexSignature": true, 18 | "esModuleInterop": true, 19 | "skipLibCheck": true, 20 | "forceConsistentCasingInFileNames": true, 21 | "useUnknownInCatchVariables": true, 22 | "sourceMap": true, 23 | "declaration": true, 24 | "declarationMap": true, 25 | "removeComments": true, 26 | "preserveConstEnums": true, 27 | "isolatedModules": true, 28 | "resolveJsonModule": true 29 | }, 30 | "include": ["src/**/*"], 31 | "exclude": ["node_modules", "dist"] 32 | } 33 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | branches: 8 | - main 9 | types: [opened, synchronize] 10 | 11 | jobs: 12 | validate: 13 | runs-on: ubuntu-latest 14 | strategy: 15 | matrix: 16 | command: [lint, build] 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v4 20 | 21 | - uses: pnpm/action-setup@v4 22 | name: Install pnpm 23 | with: 24 | version: 10 25 | run_install: false 26 | 27 | - name: Cache node_modules 28 | uses: actions/cache@v4 29 | id: cache-nodemodules 30 | with: 31 | path: node_modules 32 | key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/pnpm-lock.yaml') }} 33 | 34 | - name: Install dependencies 35 | run: pnpm install 36 | 37 | - name: Run ${{ matrix.command }} 38 | run: pnpm ${{ matrix.command }} 39 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Covalent 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/create-zee-app/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Covalent 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "CommonJS", 5 | "moduleResolution": "node", 6 | "lib": ["ES2022", "DOM"], 7 | "rootDir": "./src", 8 | "outDir": "./dist", 9 | "strict": true, 10 | "alwaysStrict": true, 11 | "noImplicitAny": true, 12 | "noImplicitThis": true, 13 | "strictNullChecks": true, 14 | "strictFunctionTypes": true, 15 | "strictBindCallApply": true, 16 | "noUncheckedIndexedAccess": true, 17 | "noPropertyAccessFromIndexSignature": true, 18 | "esModuleInterop": true, 19 | "skipLibCheck": true, 20 | "forceConsistentCasingInFileNames": true, 21 | "useUnknownInCatchVariables": true, 22 | "sourceMap": true, 23 | "declaration": true, 24 | "declarationMap": true, 25 | "removeComments": true, 26 | "preserveConstEnums": true, 27 | "isolatedModules": true, 28 | "resolveJsonModule": true, 29 | "types": ["node"] 30 | }, 31 | "include": ["src/**/*"], 32 | "exclude": ["node_modules", "dist"] 33 | } 34 | -------------------------------------------------------------------------------- /packages/create-zee-app/templates/001-zee-barebones/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Covalent 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/create-zee-app/templates/002-onchain-workflow/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Covalent 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/tools/goldrush/nft-balances.ts: -------------------------------------------------------------------------------- 1 | import { type ModelProvider } from "../../llm"; 2 | import { BaseGoldRushTool } from "./goldrush"; 3 | import { ChainName, type Chain } from "@covalenthq/client-sdk"; 4 | import { z } from "zod"; 5 | 6 | const NFTBalancesSchema = z.object({ 7 | chain: z.enum(Object.values(ChainName) as [string, ...string[]]), 8 | address: z.string(), 9 | }); 10 | 11 | export class NFTBalancesTool extends BaseGoldRushTool< 12 | typeof NFTBalancesSchema 13 | > { 14 | constructor(provider: ModelProvider["provider"]) { 15 | super({ 16 | provider, 17 | name: "nft-balances", 18 | description: 19 | "Fetch NFT balances for a wallet address on a specific blockchain", 20 | parameters: NFTBalancesSchema, 21 | execute: async ({ address, chain }) => { 22 | const nfts = await this.client.NftService.getNftsForAddress( 23 | chain as Chain, 24 | address 25 | ); 26 | 27 | if (nfts.error) { 28 | throw new Error(nfts.error_message); 29 | } 30 | 31 | return BaseGoldRushTool.bigIntSerializer(nfts.data.items ?? []); 32 | }, 33 | }); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/tools/goldrush/goldrush.ts: -------------------------------------------------------------------------------- 1 | import { Tool } from "../tool"; 2 | import { type ToolParams } from "../tool.types"; 3 | import { GoldRushClient } from "@covalenthq/client-sdk"; 4 | import type { AnyZodObject } from "zod"; 5 | 6 | export abstract class BaseGoldRushTool< 7 | ZOD_OBJECT extends AnyZodObject, 8 | > extends Tool { 9 | protected client: GoldRushClient; 10 | 11 | constructor(params: ToolParams) { 12 | if (!process.env["GOLDRUSH_API_KEY"]) { 13 | throw new Error("GOLDRUSH_API_KEY is not set in the env"); 14 | } 15 | 16 | super({ 17 | provider: params.provider, 18 | name: params.name, 19 | description: params.description, 20 | parameters: params.parameters, 21 | execute: params.execute, 22 | }); 23 | 24 | this.client = new GoldRushClient(process.env["GOLDRUSH_API_KEY"]!); 25 | } 26 | 27 | public static bigIntSerializer(data: object | object[]) { 28 | return JSON.parse( 29 | JSON.stringify(data, (_key: string, value: unknown) => { 30 | if (typeof value === "bigint") { 31 | return value.toString(); 32 | } 33 | return value; 34 | }) 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/create-zee-app/templates/001-zee-barebones/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-zee-app-template", 3 | "version": "0.3.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1", 7 | "dev": "ts-node src/index.ts" 8 | }, 9 | "keywords": [ 10 | "blockchain", 11 | "cryptocurrency", 12 | "web3", 13 | "blockchain-data", 14 | "ai-agent", 15 | "ai-agents-framework", 16 | "zero-employee-enterprise", 17 | "zee", 18 | "autonomous-agents", 19 | "autonomous-agent-framework", 20 | "autonomous-agent-sdk", 21 | "ai-agent-sdk" 22 | ], 23 | "author": "covalenthq", 24 | "homepage": "https://cxt.build/docs/overview", 25 | "repository": { 26 | "type": "git", 27 | "url": "https://github.com/covalenthq/ai-agent-sdk.git" 28 | }, 29 | "bugs": { 30 | "url": "https://github.com/covalenthq/ai-agent-sdk/issues" 31 | }, 32 | "license": "MIT", 33 | "description": "A barebones template for creating a new ZEE application.", 34 | "devDependencies": { 35 | "ts-node": "^10.9.2", 36 | "typescript": "^5.7.3" 37 | }, 38 | "dependencies": { 39 | "dotenv": "^16.4.7", 40 | "@covalenthq/ai-agent-sdk": "^0.3.0" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ai-agent-sdk", 3 | "description": "Monorepo for AI Agent SDK", 4 | "workspaces": [ 5 | "packages/ai-agent-sdk", 6 | "packages/create-zee-app", 7 | "docs/" 8 | ], 9 | "scripts": { 10 | "build": "pnpm run -r build", 11 | "clean": "pnpm run -r clean", 12 | "test": "pnpm run -r test", 13 | "lint": "pnpm run -r lint", 14 | "format": "prettier --write ." 15 | }, 16 | "author": "covalenthq", 17 | "homepage": "https://cxt.build/docs/overview", 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/covalenthq/ai-agent-sdk.git" 21 | }, 22 | "bugs": { 23 | "url": "https://github.com/covalenthq/ai-agent-sdk/issues" 24 | }, 25 | "license": "MIT", 26 | "devDependencies": { 27 | "@eslint/eslintrc": "^3.2.0", 28 | "@eslint/js": "^9.19.0", 29 | "@trivago/prettier-plugin-sort-imports": "^5.2.2", 30 | "@typescript-eslint/eslint-plugin": "^8.20.0", 31 | "@typescript-eslint/parser": "^8.20.0", 32 | "eslint": "^9.18.0", 33 | "eslint-config-prettier": "^10.0.1", 34 | "eslint-plugin-prettier": "^5.1.3" 35 | }, 36 | "pnpm": { 37 | "overrides": { 38 | "form-data": "^4.0.5", 39 | "jsondiffpatch": "^0.7.2" 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/create-zee-app/templates/002-onchain-workflow/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "onchain-workflow-template", 3 | "version": "0.3.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1", 7 | "dev": "ts-node src/index.ts" 8 | }, 9 | "keywords": [ 10 | "blockchain", 11 | "cryptocurrency", 12 | "web3", 13 | "blockchain-data", 14 | "ai-agent", 15 | "ai-agents-framework", 16 | "zero-employee-enterprise", 17 | "zee", 18 | "autonomous-agents", 19 | "autonomous-agent-framework", 20 | "autonomous-agent-sdk", 21 | "ai-agent-sdk" 22 | ], 23 | "author": "covalenthq", 24 | "homepage": "https://cxt.build/docs/overview", 25 | "repository": { 26 | "type": "git", 27 | "url": "https://github.com/covalenthq/ai-agent-sdk.git" 28 | }, 29 | "bugs": { 30 | "url": "https://github.com/covalenthq/ai-agent-sdk/issues" 31 | }, 32 | "license": "MIT", 33 | "description": "A template for creating a new onchain workflow using the AI Agent SDK. Showcasing the use of various GoldRush Tools.", 34 | "devDependencies": { 35 | "ts-node": "^10.9.2", 36 | "typescript": "^5.7.3" 37 | }, 38 | "dependencies": { 39 | "dotenv": "^16.4.7", 40 | "@covalenthq/ai-agent-sdk": "^0.3.0" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/create-zee-app/templates/002-onchain-workflow/src/index.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Agent, 3 | type ModelProvider, 4 | NFTBalancesTool, 5 | TokenBalancesTool, 6 | ZeeWorkflow, 7 | } from "@covalenthq/ai-agent-sdk"; 8 | import "dotenv/config"; 9 | 10 | const model: ModelProvider = { 11 | provider: "openai", 12 | id: "gpt-4o-mini", 13 | }; 14 | 15 | const walletAnalyzer = new Agent({ 16 | name: "wallet analyzer", 17 | model, 18 | description: 19 | "An AI assistant that analyzes wallet activities and provides insights about holdings and transactions.", 20 | instructions: [ 21 | "Analyze wallet token balances and provide insights about holdings", 22 | "Check NFT collections owned by the wallet", 23 | "Review recent transactions and identify patterns", 24 | "Provide comprehensive analysis of the wallet's activity", 25 | ], 26 | tools: { 27 | nftBalances: new NFTBalancesTool(model.provider), 28 | tokenBalances: new TokenBalancesTool(model.provider), 29 | }, 30 | }); 31 | 32 | const zee = new ZeeWorkflow({ 33 | goal: "What are the NFT and Token balances of 'demo.eth' on 'eth-mainnet'? Elaborate on the balances.", 34 | agents: [walletAnalyzer], 35 | model, 36 | }); 37 | 38 | (async function main() { 39 | const result = await zee.run(); 40 | console.log("\nFinal Summary:"); 41 | console.dir(result, { depth: null }); 42 | })(); 43 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/tools/goldrush/token-balances.ts: -------------------------------------------------------------------------------- 1 | import { type ModelProvider } from "../../llm"; 2 | import { BaseGoldRushTool } from "./goldrush"; 3 | import { type Chain, ChainName } from "@covalenthq/client-sdk"; 4 | import { z } from "zod"; 5 | 6 | const TokenBalancesSchema = z.object({ 7 | chain: z.enum(Object.values(ChainName) as [string, ...string[]]), 8 | address: z.string(), 9 | }); 10 | 11 | export class TokenBalancesTool extends BaseGoldRushTool< 12 | typeof TokenBalancesSchema 13 | > { 14 | constructor(provider: ModelProvider["provider"]) { 15 | super({ 16 | provider, 17 | name: "token-balances", 18 | description: 19 | "Fetch token balances for a wallet address on a specific blockchain", 20 | parameters: TokenBalancesSchema, 21 | execute: async ({ address, chain }) => { 22 | const balances = 23 | await this.client.BalanceService.getTokenBalancesForWalletAddress( 24 | chain as Chain, 25 | address 26 | ); 27 | 28 | if (balances.error) { 29 | throw new Error(balances.error_message); 30 | } 31 | 32 | return BaseGoldRushTool.bigIntSerializer( 33 | balances.data.items ?? [] 34 | ); 35 | }, 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /docs/concepts/zee-workflows.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: ZEE Workflows 3 | description: Compose agents to solve complex problems. 4 | icon: "chart-network" 5 | --- 6 | 7 | The Zero-Employee Enterprise (ZEE) is a new business model where traditional workforces are augmented by autonomous agents. The business logic behind ZEE makes the agents autonomous and able to solve complex problems. 8 | 9 | A ZEE workflow contains a couple of components: 10 | 11 | - The [Agents](/concepts/agents) that are used to solve the problem. 12 | - The **planner** agent breaks down the final goal into smaller tasks and assigns them to the agents provided to the workflow. 13 | - The **router** agent facilitates communication between all the agents via necessary context for the final goal. 14 | - The **endgame** agent is the final agent that takes in the results from all the agents and formulates the final output. 15 | 16 | > These agent names are reserved by the ZEE workflow. Make sure not to use these names for your agents. 17 | 18 | ## Creating a Workflow 19 | 20 | To create a workflow, you need to create a new instance of the `ZeeWorkflow` class. 21 | 22 | ```typescript 23 | const zee = new ZeeWorkflow({ 24 | goal: "The goal of this workflow is to...", 25 | agents: [agent1, agent2], 26 | model: { 27 | provider: "openai", 28 | id: "gpt-4o-mini", 29 | }, 30 | config: { 31 | temperature: 1, 32 | maxIterations: 10, 33 | }, 34 | }); 35 | 36 | const result = await zee.run(); 37 | ``` 38 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/agent/agent.ts: -------------------------------------------------------------------------------- 1 | import type { AgentConfig, AgentGenerateParameters, AgentResponse } from "."; 2 | import { systemMessage } from "../../functions"; 3 | import { Base } from "../base"; 4 | import { LLM } from "../llm"; 5 | import { type CoreMessage } from "ai"; 6 | 7 | export class Agent extends Base { 8 | private _config: AgentConfig; 9 | private _llm: LLM; 10 | 11 | constructor(config: AgentConfig) { 12 | super("agent"); 13 | this._config = config; 14 | this._llm = new LLM(config.model); 15 | } 16 | 17 | get name() { 18 | return this._config.name; 19 | } 20 | 21 | get description() { 22 | return this._config.description; 23 | } 24 | 25 | get instructions() { 26 | return this._config.instructions; 27 | } 28 | 29 | async generate(args: AgentGenerateParameters): Promise { 30 | const _messages = [ 31 | systemMessage(this.description), 32 | ...(this.instructions?.map(systemMessage) ?? []), 33 | ...(args.messages ?? []), 34 | ] as CoreMessage[]; 35 | 36 | const response = await this._llm.generate( 37 | { 38 | ...args, 39 | tools: this._config.tools, 40 | messages: _messages, 41 | temperature: this._config.temperature, 42 | }, 43 | true 44 | ); 45 | 46 | return response as AgentResponse; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/tools/goldrush/transactions.ts: -------------------------------------------------------------------------------- 1 | import { type ModelProvider } from "../../llm"; 2 | import { BaseGoldRushTool } from "./goldrush"; 3 | import { ChainName, type Chain } from "@covalenthq/client-sdk"; 4 | import { z } from "zod"; 5 | 6 | const TransactionsSchema = z.object({ 7 | chain: z.enum(Object.values(ChainName) as [string, ...string[]]), 8 | address: z.string(), 9 | }); 10 | 11 | export class TransactionsTool extends BaseGoldRushTool< 12 | typeof TransactionsSchema 13 | > { 14 | constructor(provider: ModelProvider["provider"]) { 15 | super({ 16 | provider, 17 | name: "transactions", 18 | description: 19 | "Fetch transactions for a wallet address on a specific blockchain", 20 | parameters: TransactionsSchema, 21 | execute: async ({ address, chain }) => { 22 | const txs = 23 | await this.client.TransactionService.getAllTransactionsForAddressByPage( 24 | chain as Chain, 25 | address, 26 | { 27 | noLogs: true, 28 | withSafe: false, 29 | } 30 | ); 31 | 32 | if (txs.error) { 33 | throw new Error(txs.error_message); 34 | } 35 | 36 | return BaseGoldRushTool.bigIntSerializer(txs.data.items ?? []); 37 | }, 38 | }); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/zee/zee.types.ts: -------------------------------------------------------------------------------- 1 | import type { Agent } from "../agent"; 2 | import type { ModelProvider, UserContentAttachments } from "../llm"; 3 | 4 | export type ZeeWorkflowOptions = { 5 | goal: string; 6 | agents: Agent[]; 7 | model: ModelProvider; 8 | config?: { 9 | maxIterations?: number; 10 | temperature?: number; 11 | }; 12 | }; 13 | 14 | export interface AgentAction { 15 | type: "request" | "complete" | "followup" | "response"; 16 | from: string; 17 | to: string; 18 | content: string; 19 | metadata?: { 20 | dependencies?: { 21 | agentName: string; 22 | task: string; 23 | }[]; 24 | isTaskComplete?: boolean; 25 | attachments?: UserContentAttachments[]; 26 | originalTask?: string; 27 | originalFrom?: string; 28 | }; 29 | } 30 | 31 | export interface ContextItem { 32 | role: string; 33 | content: unknown; 34 | } 35 | 36 | export interface ZEEWorkflowResponse { 37 | content: string; 38 | context: ContextItem[]; 39 | } 40 | 41 | export enum ZEEActionResponseType { 42 | FOLLOWUP = "FOLLOWUP:", 43 | ANSWER = "ANSWER:", 44 | COMPLETE = "COMPLETE:", 45 | } 46 | 47 | export interface RawTask { 48 | instructions: string[]; 49 | attachments: UserContentAttachments[]; 50 | dependencies: string[]; 51 | } 52 | 53 | export interface ZEETask extends Omit { 54 | agentName: string; 55 | dependencies: { 56 | agentName: string; 57 | task: string; 58 | }[]; 59 | } 60 | -------------------------------------------------------------------------------- /packages/create-zee-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@covalenthq/create-zee-app", 3 | "version": "0.3.0", 4 | "description": "Create a new ZEE application to run your own autonomous agents.", 5 | "type": "module", 6 | "bin": { 7 | "create-zee-app": "bin/create-zee-app" 8 | }, 9 | "files": [ 10 | "dist", 11 | "templates", 12 | "README.md" 13 | ], 14 | "publishConfig": { 15 | "access": "public" 16 | }, 17 | "scripts": { 18 | "build": "tsc", 19 | "clean": "rm -rf dist", 20 | "dev": "tsc --watch", 21 | "start": "node dist/index.js", 22 | "prepublishOnly": "npm run clean && npm run build", 23 | "pretty": "prettier . --write", 24 | "lint": "eslint .", 25 | "test": "echo \"No tests specified\"" 26 | }, 27 | "author": "covalenthq", 28 | "homepage": "https://cxt.build/docs/overview", 29 | "repository": { 30 | "type": "git", 31 | "url": "https://github.com/covalenthq/ai-agent-sdk.git" 32 | }, 33 | "bugs": { 34 | "url": "https://github.com/covalenthq/ai-agent-sdk/issues" 35 | }, 36 | "license": "MIT", 37 | "devDependencies": { 38 | "@types/node": "^22.10.7", 39 | "prettier": "^3.4.2", 40 | "typescript": "^5.7.3" 41 | }, 42 | "dependencies": { 43 | "@clack/prompts": "^0.9.1", 44 | "@types/fs-extra": "^11.0.0", 45 | "fs-extra": "^11.0.0", 46 | "gradient-string": "^3.0.0", 47 | "ora": "^7.0.1", 48 | "picocolors": "^1.1.1" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /docs/concepts/tools.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Tools 3 | icon: "gear" 4 | description: Extend the capabilities of your agents with tools. 5 | --- 6 | 7 | Tools are functions that can be used to extend the capabilities of your agents. There are two core use-cases for tools: 8 | 9 | 1. **Function Calling**: Tools are functions that can be used to call other agents, connect to external APIs, or interact with your database. In the context of a blockchain system, tools can be used to manage private keys, sign transactions and relay them to the blockchain. 10 | 11 | 2. **Structured Output**: Tools are functions that can be used to generate structured output. This is useful for generating JSON, CSV, or other structured data. 12 | 13 | Tools are optional and can be added to an Agent to extend its capabilities. Tools are included in the calls to the language model through the [tools](https://sdk.vercel.ai/docs/ai-sdk-core/tools-and-tool-calling) property. 14 | 15 | ## Creating a Tool 16 | 17 | Tools are created using the `Tool` class and can be sent to the agent using the `tools` property during initialization. 18 | 19 | ```typescript 20 | const tool = new Tool({ 21 | provider: "openai", 22 | name: "get weather", 23 | description: "This tool is used to get the current weather in a location", 24 | parameters: z.object({ 25 | location: z.string(), 26 | }), 27 | execute: async ({ location }) => { 28 | return "The current weather in " + location + " is sunny"; 29 | }, 30 | }); 31 | ``` 32 | 33 | ## Default Tools 34 | 35 | - [GoldRush Onchain Data](/tools/goldrush-onchain-data) - Tools for interacting with blockchain data 36 | -------------------------------------------------------------------------------- /docs/get-started/quickstart.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Quickstart 3 | icon: "bolt" 4 | description: Learn the basics of the AI Agent SDK in a few minutes. 5 | --- 6 | 7 | 8 | 9 | ```bash 10 | npx @covalenthq/create-zee-app 11 | ``` 12 | 13 | 14 | 15 | 16 | ```typescript 17 | const agent1 = new Agent({ 18 | name: "Agent1", 19 | model: { 20 | provider: "openai", 21 | id: "gpt-4o-mini", 22 | }, 23 | description: "A helpful AI assistant that can engage in conversation.", 24 | instructions: [ 25 | "You are a helpful AI assistant that can engage in conversation.", 26 | "You are able to use the following tools to help the user.", 27 | ], 28 | }); 29 | ``` 30 | 31 | 32 | 33 | 34 | 35 | ```typescript 36 | const zee = new ZeeWorkflow({ 37 | goal: "A workflow of agents that come up with the most creative greeting ever!", 38 | model: { 39 | provider: "openai", 40 | id: "gpt-4o-mini", 41 | }, 42 | agents: [agent1, agent2], 43 | }); 44 | ``` 45 | 46 | 47 | 48 | 49 | 50 | ```typescript 51 | (async function main() { 52 | const result = await zee.run(); 53 | console.log(result); 54 | })(); 55 | ``` 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /packages/create-zee-app/README.md: -------------------------------------------------------------------------------- 1 | # Create ZEE App 2 | 3 | The easiest way to get started with Zero-Employee Enterprises and Autonomous Agents is by using `@covalenthq/create-zee-app`. This CLI tool enables you to quickly start building a new ZEE application using the Covalent [AI Agent SDK](https://github.com/covalenthq/ai-agent-sdk), with everything setup for you. You can create a new ZEE app using the default template, or one of the many templates available. 4 | 5 | To get started, simply run the following command: 6 | 7 | ```sh 8 | npx @covalenthq/create-zee-app@latest 9 | # or 10 | yarn @covalenthq/create-zee-app 11 | # or 12 | pnpm @covalenthq/create-zee-app 13 | # or 14 | bun @covalenthq/create-zee-app 15 | ``` 16 | 17 | and follow the prompts to create your new ZEE app. 18 | 19 | **What is a ZEE?** 20 | 21 | A ZEE, or Zero-Employee Enterprise, is a new business model where traditional workforces are augmented by a decentralized system of autonomous agents. These agents collaborate and iteratively solve complex tasks with precision and adaptability for the onchain world. 22 | 23 | **Why use Create ZEE App?** 24 | 25 | Create ZEE App is a powerful tool that simplifies the process of setting up a new ZEE application with the Covalent [AI Agent SDK](https://github.com/covalenthq/ai-agent-sdk) within seconds. Here are some reasons why you should use Create ZEE App: 26 | 27 | - **Quick Setup**: Get your project up and running in minutes with a single command. 28 | - **Best Practices**: The generated project follows industry best practices, ensuring a solid foundation for your app. 29 | - **Customizable Templates**: Start with a basic template and customize it to fit your needs. 30 | - **Integrated Tools**: Comes with built-in support for popular tools and libraries, reducing the need for additional setup. 31 | - **Consistent Structure**: Provides a consistent project structure, making it easier to manage and scale your application. 32 | - **Community Support**: Benefit from a large community of developers who use and contribute to the tool, providing plenty of resources and support. 33 | -------------------------------------------------------------------------------- /docs/mint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://mintlify.com/schema.json", 3 | "name": "AI Agent SDK", 4 | "logo": { 5 | "dark": "/logo/dark.svg", 6 | "light": "/logo/light.svg" 7 | }, 8 | "favicon": "/favicon.svg", 9 | "colors": { 10 | "primary": "#0D9373", 11 | "light": "#07C983", 12 | "dark": "#0D9373", 13 | "anchors": { 14 | "from": "#0D9373", 15 | "to": "#07C983" 16 | } 17 | }, 18 | "topbarCtaButton": { 19 | "url": "https://github.com/covalenthq/ai-agent-sdk", 20 | "type": "github" 21 | }, 22 | "tabs": [ 23 | { 24 | "name": "API Reference", 25 | "url": "api-reference" 26 | } 27 | ], 28 | "anchors": [ 29 | { 30 | "name": "Community", 31 | "icon": "telegram", 32 | "url": "https://t.me/CXT_Agent_SDK" 33 | }, 34 | { 35 | "name": "GitHub", 36 | "icon": "github", 37 | "url": "https://github.com/covalenthq/ai-agent-sdk" 38 | } 39 | ], 40 | "navigation": [ 41 | { 42 | "group": "Get Started", 43 | "pages": [ 44 | "get-started/overview", 45 | "get-started/quickstart", 46 | "get-started/installation" 47 | ] 48 | }, 49 | { 50 | "group": "Concepts", 51 | "pages": [ 52 | "concepts/llms", 53 | "concepts/agents", 54 | "concepts/tools", 55 | "concepts/zee-workflows" 56 | ] 57 | }, 58 | { 59 | "group": "", 60 | "pages": ["zee-use-cases"] 61 | }, 62 | { 63 | "group": "Tools", 64 | "pages": ["tools/goldrush-onchain-data"] 65 | } 66 | ], 67 | "footerSocials": { 68 | "x": "https://x.com/Covalent_HQ", 69 | "telegram": "https://t.me/CXT_Agent_SDK", 70 | "github": "https://github.com/covalenthq/ai-agent-sdk" 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@covalenthq/ai-agent-sdk", 3 | "version": "0.3.0", 4 | "main": "dist/index.js", 5 | "types": "dist/index.d.ts", 6 | "files": [ 7 | "dist", 8 | "README.md" 9 | ], 10 | "publishConfig": { 11 | "access": "public" 12 | }, 13 | "license": "MIT", 14 | "keywords": [ 15 | "blockchain", 16 | "cryptocurrency", 17 | "web3", 18 | "blockchain-data", 19 | "ai-agent", 20 | "ai-agents-framework", 21 | "zero-employee-enterprise", 22 | "zee", 23 | "autonomous-agents", 24 | "autonomous-agent-framework", 25 | "autonomous-agent-sdk", 26 | "ai-agent-sdk" 27 | ], 28 | "author": "covalenthq", 29 | "homepage": "https://cxt.build/docs/overview", 30 | "repository": { 31 | "type": "git", 32 | "url": "https://github.com/covalenthq/ai-agent-sdk.git" 33 | }, 34 | "bugs": { 35 | "url": "https://github.com/covalenthq/ai-agent-sdk/issues" 36 | }, 37 | "scripts": { 38 | "test": "vitest", 39 | "test:agent": "vitest src/tests/agent.test.ts", 40 | "test:llm": "vitest src/tests/llm.test.ts", 41 | "test:tools:goldrush": "vitest src/tests/goldrush.tools.test.ts", 42 | "test:zee": "vitest src/tests/zee.test.ts", 43 | "build": "tsc", 44 | "clean": "rm -rf dist", 45 | "prepublishOnly": "cp ../../README.md . && npm run clean && npm run build", 46 | "postpublish": "rm -f ./README.md", 47 | "lint": "eslint .", 48 | "pretty": "prettier . --write" 49 | }, 50 | "dependencies": { 51 | "@ai-sdk/anthropic": "^1.1.6", 52 | "@ai-sdk/google": "^1.1.11", 53 | "@ai-sdk/openai": "^1.1.9", 54 | "@covalenthq/client-sdk": "^2.2.3", 55 | "ai": "^4.1.41", 56 | "commander": "^13.1.0", 57 | "dotenv": "^16.4.7", 58 | "openai": "^4.79.1", 59 | "pino": "^9.6.0", 60 | "pino-pretty": "^13.0.0", 61 | "typescript": "^5.7.3", 62 | "zod": "^3.24.1", 63 | "zod-to-json-schema": "^3.24.1" 64 | }, 65 | "devDependencies": { 66 | "@types/node": "^22.10.7", 67 | "node-fetch": "^3.3.2", 68 | "prettier": "^3.4.2", 69 | "vitest": "^3.0.5" 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /docs/concepts/agents.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Agents 3 | icon: "head-side-gear" 4 | description: Overview of agents in the Zero-Employee Enterprise. 5 | --- 6 | 7 | Agents are the building blocks of Zero-Employee Enterprise. They are the ones that do the work. Agents are stateless and have a single purpose and can optionally use [Tools](/concepts/tools) to help them achieve their goal. 8 | 9 | Agents can be called individually or composed together to form a ZEE to iteratively and collaboratively solve complex problems. 10 | 11 | ## Creating an Agent 12 | 13 | The simplest way to create an Agent is to use initialize an Agent with a model, description, instructions and optionally tools. 14 | 15 | ```typescript 16 | const agent = new Agent({ 17 | name: "Reporting Agent", 18 | model: { 19 | provider: "openai", 20 | id: "gpt-4o-mini", 21 | }, 22 | description: "This agent is responsible for generating reports", 23 | instructions: [ 24 | "Generate a report on the current state of the company", 25 | "Use the following tools to help you generate the report", 26 | ], 27 | }); 28 | ``` 29 | 30 | ## Adding tools 31 | 32 | [Tools](/concepts/tools) are optional and can be added to an Agent to extend its capabilities. Tools are included in the calls to the language model through the [tools](https://sdk.vercel.ai/docs/ai-sdk-core/tools-and-tool-calling) property. 33 | 34 | Tools are created using the `Tool` class and can be sent to the agent using the `tools` property during initialization. 35 | 36 | ```typescript 37 | const agent = new Agent({ 38 | name: "Reporting Agent", 39 | ... 40 | tools: { 41 | tool1, 42 | tool2, 43 | tool3, 44 | }, 45 | }); 46 | ``` 47 | 48 | Read more about [Tools](/concepts/tools) to learn how to create them. 49 | 50 | ## Running an Agent 51 | 52 | Agents can be run standalone or as part of a ZEE workflow. Running an agent standalone is useful for testing and debugging. The `generate` method will run the agent standalone. 53 | 54 | ```typescript 55 | const result = await agent.generate({ 56 | messages: [userMessage("What is the current state of the company?")], 57 | }); 58 | ``` 59 | 60 | Running an agent as part of a ZEE workflow is useful for solving complex problems. Read more about [ZEE](/concepts/zee-workflows) to learn how to run agents in a ZEE workflow. 61 | -------------------------------------------------------------------------------- /docs/logo/dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/logo/light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | .pnpm-debug.log* 9 | 10 | .DS_Store 11 | 12 | # Diagnostic reports (https://nodejs.org/api/report.html) 13 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 14 | 15 | # Runtime data 16 | pids 17 | *.pid 18 | *.seed 19 | *.pid.lock 20 | 21 | # Directory for instrumented libs generated by jscoverage/JSCover 22 | lib-cov 23 | 24 | # Coverage directory used by tools like istanbul 25 | coverage 26 | *.lcov 27 | 28 | # nyc test coverage 29 | .nyc_output 30 | 31 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 32 | .grunt 33 | 34 | # Bower dependency directory (https://bower.io/) 35 | bower_components 36 | 37 | # node-waf configuration 38 | .lock-wscript 39 | 40 | # Compiled binary addons (https://nodejs.org/api/addons.html) 41 | build/Release 42 | 43 | # Dependency directories 44 | node_modules/ 45 | jspm_packages/ 46 | 47 | # Snowpack dependency directory (https://snowpack.dev/) 48 | web_modules/ 49 | 50 | # TypeScript cache 51 | *.tsbuildinfo 52 | 53 | # Optional npm cache directory 54 | .npm 55 | 56 | # Optional eslint cache 57 | .eslintcache 58 | 59 | # Optional stylelint cache 60 | .stylelintcache 61 | 62 | # Microbundle cache 63 | .rpt2_cache/ 64 | .rts2_cache_cjs/ 65 | .rts2_cache_es/ 66 | .rts2_cache_umd/ 67 | 68 | # Optional REPL history 69 | .node_repl_history 70 | 71 | # Output of 'npm pack' 72 | *.tgz 73 | 74 | # Yarn Integrity file 75 | .yarn-integrity 76 | 77 | # dotenv environment variable files 78 | .env 79 | .env.development.local 80 | .env.test.local 81 | .env.production.local 82 | .env.local 83 | 84 | # parcel-bundler cache (https://parceljs.org/) 85 | .cache 86 | .parcel-cache 87 | 88 | # Next.js build output 89 | .next 90 | out 91 | 92 | # Nuxt.js build / generate output 93 | .nuxt 94 | dist 95 | 96 | # Gatsby files 97 | .cache/ 98 | # Comment in the public line in if your project uses Gatsby and not Next.js 99 | # https://nextjs.org/blog/next-9-1#public-directory-support 100 | # public 101 | 102 | # vuepress build output 103 | .vuepress/dist 104 | 105 | # vuepress v2.x temp and cache directory 106 | .temp 107 | .cache 108 | 109 | # Docusaurus cache and generated files 110 | .docusaurus 111 | 112 | # Serverless directories 113 | .serverless/ 114 | 115 | # FuseBox cache 116 | .fusebox/ 117 | 118 | # DynamoDB Local files 119 | .dynamodb/ 120 | 121 | # TernJS port file 122 | .tern-port 123 | 124 | # Stores VSCode versions used for testing VSCode extensions 125 | .vscode-test 126 | 127 | # yarn v2 128 | .yarn/cache 129 | .yarn/unplugged 130 | .yarn/build-state.yml 131 | .yarn/install-state.gz 132 | .pnp.* 133 | -------------------------------------------------------------------------------- /eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import { FlatCompat } from "@eslint/eslintrc"; 2 | import js from "@eslint/js"; 3 | import typescriptPlugin from "@typescript-eslint/eslint-plugin"; 4 | import typescriptParser from "@typescript-eslint/parser"; 5 | import prettier from "eslint-config-prettier"; 6 | import prettierPlugin from "eslint-plugin-prettier"; 7 | import path from "node:path"; 8 | import { fileURLToPath } from "node:url"; 9 | 10 | const __filename = fileURLToPath(import.meta.url); 11 | const __dirname = path.dirname(__filename); 12 | const compat = new FlatCompat({ 13 | baseDirectory: __dirname, 14 | recommendedConfig: js.configs.recommended, 15 | allConfig: js.configs.all, 16 | }); 17 | 18 | export default [ 19 | { 20 | ignores: [ 21 | "**/*.config.js", 22 | "**/dist", 23 | "jest.config.js", 24 | "**/template/**", 25 | ], 26 | }, 27 | { 28 | files: ["**/*.ts", "**/*.tsx"], 29 | languageOptions: { 30 | parser: typescriptParser, 31 | parserOptions: { 32 | ecmaVersion: "latest", 33 | sourceType: "module", 34 | project: ["./packages/*/tsconfig.json"], 35 | }, 36 | globals: { 37 | console: true, 38 | process: true, 39 | }, 40 | }, 41 | plugins: { 42 | "@typescript-eslint": typescriptPlugin, 43 | prettier: prettierPlugin, 44 | }, 45 | rules: { 46 | ...js.configs.recommended.rules, 47 | ...typescriptPlugin.configs.recommended.rules, 48 | semi: "error", 49 | "no-multiple-empty-lines": "error", 50 | indent: "off", 51 | "no-unsafe-optional-chaining": "warn", 52 | "prettier/prettier": "error", 53 | "@typescript-eslint/no-var-requires": "off", 54 | "@typescript-eslint/no-unused-vars": [ 55 | "error", 56 | { 57 | vars: "all", 58 | args: "after-used", 59 | ignoreRestSiblings: true, 60 | argsIgnorePattern: "^_", 61 | varsIgnorePattern: "^_", 62 | }, 63 | ], 64 | "@typescript-eslint/no-empty-object-type": "error", 65 | "@typescript-eslint/no-unsafe-function-type": "error", 66 | "@typescript-eslint/no-wrapper-object-types": "error", 67 | "@typescript-eslint/no-inferrable-types": "off", 68 | "@typescript-eslint/no-non-null-assertion": "off", 69 | "@typescript-eslint/consistent-type-imports": "error", 70 | "@typescript-eslint/no-explicit-any": "warn", 71 | }, 72 | }, 73 | prettier, 74 | ]; 75 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/tools/goldrush/historical-token-price.ts: -------------------------------------------------------------------------------- 1 | import { type ModelProvider } from "../../llm"; 2 | import { BaseGoldRushTool } from "./goldrush"; 3 | import { ChainName, type Chain } from "@covalenthq/client-sdk"; 4 | import { z } from "zod"; 5 | 6 | const HistoricalTokenPriceSchema = z.object({ 7 | chain: z.enum(Object.values(ChainName) as [string, ...string[]]), 8 | contractAddress: z.string(), 9 | timeframe: z.enum(["1h", "24h", "7d", "30d"]), 10 | }); 11 | 12 | export class HistoricalTokenPriceTool extends BaseGoldRushTool< 13 | typeof HistoricalTokenPriceSchema 14 | > { 15 | constructor(provider: ModelProvider["provider"]) { 16 | super({ 17 | provider, 18 | name: "historical-token-price", 19 | description: 20 | "Fetch historical token prices for a specific token on a blockchain", 21 | parameters: HistoricalTokenPriceSchema, 22 | execute: async ({ chain, contractAddress, timeframe }) => { 23 | let from: string | null = null; 24 | 25 | const formatDate = (date: Date) => { 26 | return date.toISOString().split("T")[0]!; 27 | }; 28 | 29 | switch (timeframe) { 30 | case "1h": 31 | from = formatDate( 32 | new Date(Date.now() - 1000 * 60 * 60) 33 | ); 34 | break; 35 | case "24h": 36 | from = formatDate( 37 | new Date(Date.now() - 1000 * 60 * 60 * 24) 38 | ); 39 | break; 40 | case "7d": 41 | from = formatDate( 42 | new Date(Date.now() - 1000 * 60 * 60 * 24 * 7) 43 | ); 44 | break; 45 | case "30d": 46 | from = formatDate( 47 | new Date(Date.now() - 1000 * 60 * 60 * 24 * 30) 48 | ); 49 | break; 50 | } 51 | 52 | const prices = await this.client.PricingService.getTokenPrices( 53 | chain as Chain, 54 | "USD", 55 | contractAddress, 56 | { 57 | from: from, 58 | to: formatDate(new Date(Date.now())), 59 | } 60 | ); 61 | 62 | if (prices.error) { 63 | throw new Error(prices.error_message); 64 | } 65 | 66 | return BaseGoldRushTool.bigIntSerializer(prices.data ?? []); 67 | }, 68 | }); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /packages/create-zee-app/templates/001-zee-barebones/src/index.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Agent, 3 | type ModelProvider, 4 | Tool, 5 | ZeeWorkflow, 6 | } from "@covalenthq/ai-agent-sdk"; 7 | import "dotenv/config"; 8 | import { z } from "zod"; 9 | 10 | const model: ModelProvider = { 11 | provider: "openai", 12 | id: "gpt-4o-mini", 13 | }; 14 | 15 | const fetchNews = new Tool({ 16 | provider: model.provider, 17 | name: "fetch-news", 18 | description: 19 | "Fetch the latest news articles about a given topic. The maximum limit is 3", 20 | parameters: z.object({ 21 | topic: z.string().describe("The topic to search for"), 22 | limit: z.number().describe("Number of articles to fetch"), 23 | }), 24 | execute: async ({ limit = 3 }) => { 25 | const articles = [ 26 | { 27 | title: "AI Advances in 2024", 28 | content: 29 | "Recent developments in artificial intelligence show promising results in various fields...", 30 | }, 31 | { 32 | title: "The Future of Technology", 33 | content: 34 | "Emerging technologies are reshaping how we live and work...", 35 | }, 36 | { 37 | title: "Innovation in Tech Industry", 38 | content: 39 | "Leading companies are pushing boundaries in technological innovation...", 40 | }, 41 | ]; 42 | return articles.slice(0, limit); 43 | }, 44 | }); 45 | 46 | const researchAgent = new Agent({ 47 | name: "Research Agent", 48 | model, 49 | description: "An AI researcher that fetches and analyzes news articles.", 50 | instructions: [ 51 | "Use the fetch-news tool to get articles about the requested topic", 52 | "Analyze the content of the articles", 53 | "Identify key trends and insights", 54 | ], 55 | tools: { 56 | fetchNews, 57 | }, 58 | }); 59 | 60 | const summaryAgent = new Agent({ 61 | name: "Summary Agent", 62 | model, 63 | description: 64 | "An AI writer that creates concise summaries from research analysis.", 65 | instructions: [ 66 | "Review the research analysis provided", 67 | "Create a clear and concise summary", 68 | "Highlight the most important points", 69 | "Use bullet points for key takeaways", 70 | ], 71 | }); 72 | 73 | const zee = new ZeeWorkflow({ 74 | goal: "Analyze latest technology news and create a summary report", 75 | agents: [researchAgent, summaryAgent], 76 | model, 77 | config: { 78 | temperature: 1, 79 | maxIterations: 50, 80 | }, 81 | }); 82 | 83 | (async function main() { 84 | const result = await zee.run(); 85 | console.log("\nFinal Summary:"); 86 | console.dir(result, { depth: null }); 87 | })(); 88 | -------------------------------------------------------------------------------- /docs/tools/goldrush-onchain-data.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: GoldRush Onchain Data 3 | icon: "network-wired" 4 | description: Tools for interacting with blockchain data through the GoldRush API. 5 | --- 6 | 7 | ## GoldRush Onchain Data 8 | 9 | The SDK includes built-in tools for interacting with blockchain data through the [GoldRush API](https://goldrush.dev/). These tools allow agents to fetch token balances, NFT holdings, and transaction history across 100+ blockchains. 10 | 11 | > Each GoldRush tool requires an API key which can be set through the `GOLDRUSH_API_KEY` environment variable. Tools can be used independently or combined for comprehensive blockchain analysis. 12 | 13 | ### Available GoldRush Tools 14 | 15 | 1. **Token Balances Tool**: Fetch token balances for any wallet address across supported blockchains. This tool provides detailed information including: 16 | - Token amounts and USD values 17 | - Token metadata (symbol, decimals, contract address) 18 | 19 | ```typescript 20 | const tokenBalances = new TokenBalancesTool("openai"); 21 | ``` 22 | 23 | 2. **NFT Holdings Tool**: Fetch NFT holdings for any wallet address with comprehensive metadata: 24 | - Collection information 25 | - Token IDs and ownership details 26 | - Media URLs and metadata 27 | - Floor prices and estimated values 28 | 29 | ```typescript 30 | const nftHoldings = new NFTHoldingsTool("openai"); 31 | ``` 32 | 33 | 3. **Transaction History Tool**: Fetch detailed transaction history for any wallet address including: 34 | - Transaction types (transfers, swaps, mints) 35 | - Token movements and values 36 | - Timestamps and block information 37 | - Gas costs and transaction status 38 | 39 | ```typescript 40 | const transactionHistory = new TransactionHistoryTool("openai"); 41 | ``` 42 | 43 | 4. **Historical Token Price Tool**: Fetch historical price data for any token across supported blockchains: 44 | - Price history over customizable timeframes (1h, 24h, 7d, 30d) 45 | - Token prices in USD 46 | - Detailed price data points within the selected timeframe 47 | 48 | ```typescript 49 | const historicalPrices = new HistoricalTokenPriceTool("openai"); 50 | ``` 51 | 52 | ### Using GoldRush Tools 53 | 54 | To use GoldRush tools in your agent: 55 | 56 | ```typescript 57 | const agent = new Agent({ 58 | name: "blockchain researcher", 59 | model: { 60 | provider: "OPEN_AI", 61 | id: "gpt-4o-mini", 62 | }, 63 | description: 64 | "You are a blockchain researcher analyzing wallet activities using the GoldRush On Chain Data APIs.", 65 | instructions: [ 66 | "Analyze wallet activities using the provided blockchain tools", 67 | "Summarize token holdings, NFT collections, and recent transactions", 68 | "Provide insights about the wallet's activity patterns", 69 | ], 70 | tools: { 71 | tokenBalances: new TokenBalancesTool("openai"), 72 | nftBalances: new NFTBalancesTool("openai"), 73 | transactions: new TransactionsTool("openai"), 74 | }, 75 | }); 76 | ``` 77 | -------------------------------------------------------------------------------- /packages/create-zee-app/templates/002-onchain-workflow/README.md: -------------------------------------------------------------------------------- 1 | # Your AI Agent - Onchain Workflow 2 | 3 | This template demonstrates how to create AI agents that can analyze blockchain data using the GoldRush API tools. It showcases various capabilities like analyzing token balances, NFT holdings, and transaction history across multiple blockchains. 4 | 5 | ## Features 6 | 7 | - Token balance analysis across supported blockchains 8 | - NFT holdings tracking with metadata 9 | - Transaction history monitoring 10 | - Historical token price analysis 11 | - Multi-agent workflow coordination 12 | 13 | ## Getting Started 14 | 15 | 1. Install dependencies: 16 | 17 | ```bash 18 | npm install 19 | ``` 20 | 21 | 2. Create a `.env` file in the root directory with your API keys: 22 | 23 | ```bash 24 | OPENAI_API_KEY=your_openai_api_key 25 | GOLDRUSH_API_KEY=your_goldrush_api_key 26 | ``` 27 | 28 | 3. Run the development server: 29 | 30 | ```bash 31 | npm run dev 32 | ``` 33 | 34 | ## Available Tools 35 | 36 | ### 1. Token Balances Tool 37 | 38 | Fetches token balances for any wallet address with: 39 | 40 | - Token amounts and USD values 41 | - Token metadata (symbol, decimals, contract address) 42 | 43 | ### 2. NFT Holdings Tool 44 | 45 | Retrieves NFT holdings with: 46 | 47 | - Collection information 48 | - Token IDs and ownership details 49 | - Media URLs and metadata 50 | 51 | ### 3. Transaction History Tool 52 | 53 | Analyzes transaction history including: 54 | 55 | - Transaction types (transfers, swaps, mints) 56 | - Token movements and values 57 | - Timestamps and block information 58 | 59 | ### 4. Historical Token Price Tool 60 | 61 | Provides historical price data with: 62 | 63 | - Price history over customizable timeframes (1h, 24h, 7d, 30d) 64 | - Token prices in USD 65 | - Detailed price data points 66 | 67 | ## Example Usage 68 | 69 | ```typescript 70 | import { 71 | Agent, 72 | ZeeWorkflow, 73 | TokenBalancesTool, 74 | NFTBalancesTool, 75 | ToolSet, 76 | TransactionsTool, 77 | } from "@covalenthq/ai-agent-sdk"; 78 | 79 | const tools: ToolSet = { 80 | tokenBalances: new TokenBalancesTool("openai"), 81 | nftBalances: new NFTBalancesTool("openai"), 82 | transactions: new TransactionsTool("openai"), 83 | }; 84 | 85 | const walletAnalyzer = new Agent({ 86 | name: "WalletAnalyzer", 87 | model: { 88 | provider: "OPEN_AI", 89 | id: "gpt-4o-mini", 90 | }, 91 | description: 92 | "An AI assistant that analyzes wallet activities and provides insights about holdings and transactions.", 93 | instructions: [ 94 | "Analyze wallet token balances and provide insights about holdings", 95 | "Check NFT collections owned by the wallet", 96 | "Review recent transactions and identify patterns", 97 | "Provide comprehensive analysis of the wallet's activity", 98 | ], 99 | tools, 100 | }); 101 | ``` 102 | 103 | ## License 104 | 105 | MIT - See [LICENSE](./LICENSE) file for details. 106 | 107 | ## Support 108 | 109 | For support and discussions, join our [Telegram community](https://t.me/CXT_Agent_SDK). 110 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/llm/llm.ts: -------------------------------------------------------------------------------- 1 | import { Base } from "../base"; 2 | import type { 3 | GenerateObjectParams, 4 | GenerateTextParams, 5 | LLMParameters, 6 | LLMResponse, 7 | LLMStructuredResponse, 8 | LLMTextResponse, 9 | ModelProvider, 10 | } from "./llm.types"; 11 | import { anthropic } from "@ai-sdk/anthropic"; 12 | import { google } from "@ai-sdk/google"; 13 | import { openai } from "@ai-sdk/openai"; 14 | import { 15 | generateObject, 16 | generateText, 17 | type LanguageModel, 18 | type ToolSet, 19 | } from "ai"; 20 | import type { AnyZodObject, z } from "zod"; 21 | 22 | export class LLM extends Base { 23 | private model: LanguageModel; 24 | 25 | constructor({ provider, id }: ModelProvider) { 26 | super("llm"); 27 | switch (provider) { 28 | case "openai": 29 | this.model = openai(id); 30 | break; 31 | case "anthropic": 32 | this.model = anthropic(id); 33 | break; 34 | case "google": 35 | this.model = google(id); 36 | break; 37 | } 38 | } 39 | 40 | public async generate( 41 | args: LLMParameters, 42 | viaAgent: boolean = false 43 | ): Promise> { 44 | try { 45 | const hasTools = 46 | "tools" in args && Object.keys(args.tools ?? {}).length > 0; 47 | 48 | const isTextResponse = viaAgent || hasTools; 49 | 50 | if (isTextResponse) { 51 | const { tools, ...textArgs } = args as GenerateTextParams; 52 | const response = await generateText({ 53 | model: this.model, 54 | toolChoice: "auto", 55 | maxSteps: 3, 56 | maxRetries: 5, 57 | tools: tools as ToolSet, 58 | ...textArgs, 59 | }); 60 | 61 | if (!response.text) { 62 | throw new Error( 63 | "No response text generated by the model. Consider increasing `maxSteps` and/or `maxRetries`" 64 | ); 65 | } 66 | 67 | return { 68 | type: "assistant", 69 | value: response.text, 70 | } as LLMTextResponse; 71 | } else { 72 | const objectArgs = args as GenerateObjectParams; 73 | const response = await generateObject>({ 74 | model: this.model, 75 | maxRetries: 5, 76 | output: "object", 77 | ...objectArgs, 78 | }); 79 | 80 | if (!response.object) { 81 | throw new Error("No response object"); 82 | } 83 | 84 | return { 85 | type: "assistant", 86 | value: response.object, 87 | } as LLMStructuredResponse; 88 | } 89 | } catch (error) { 90 | throw new Error(`Failed to parse response: ${error}`); 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/llm/llm.types.ts: -------------------------------------------------------------------------------- 1 | import type { ToolSet } from "../tools"; 2 | import type { FilePart, generateObject, generateText, ImagePart } from "ai"; 3 | import type { AnyZodObject, z } from "zod"; 4 | 5 | export type OpenAIModelId = 6 | | "gpt-4o" 7 | | "gpt-4o-mini" 8 | | "gpt-4o-2024-05-13" 9 | | "gpt-4o-2024-08-06" 10 | | "gpt-4o-2024-11-20" 11 | | "gpt-4o-audio-preview" 12 | | "gpt-4o-audio-preview-2024-10-01" 13 | | "gpt-4o-audio-preview-2024-12-17" 14 | | "gpt-4o-mini-2024-07-18" 15 | | "gpt-4-turbo" 16 | | "gpt-4-turbo-2024-04-09" 17 | | "gpt-4-turbo-preview" 18 | | "gpt-4-0125-preview" 19 | | "gpt-4-1106-preview" 20 | | "gpt-4" 21 | | "gpt-4-0613" 22 | | "gpt-3.5-turbo-0125" 23 | | "gpt-3.5-turbo" 24 | | "gpt-3.5-turbo-1106"; 25 | export interface OpenAIModelProvider { 26 | provider: "openai"; 27 | id: OpenAIModelId; 28 | } 29 | 30 | export type AnthropicModelId = 31 | | "claude-3-5-sonnet-latest" 32 | | "claude-3-5-sonnet-20241022" 33 | | "claude-3-5-sonnet-20240620" 34 | | "claude-3-5-haiku-latest" 35 | | "claude-3-5-haiku-20241022" 36 | | "claude-3-opus-latest" 37 | | "claude-3-opus-20240229" 38 | | "claude-3-sonnet-20240229" 39 | | "claude-3-haiku-20240307"; 40 | export interface AnthropicModelProvider { 41 | provider: "anthropic"; 42 | id: AnthropicModelId; 43 | } 44 | 45 | export type GoogleModelId = 46 | | "gemini-2.0-flash-001" 47 | | "gemini-1.5-flash" 48 | | "gemini-1.5-flash-latest" 49 | | "gemini-1.5-flash-001" 50 | | "gemini-1.5-flash-002" 51 | | "gemini-1.5-flash-8b" 52 | | "gemini-1.5-flash-8b-latest" 53 | | "gemini-1.5-flash-8b-001" 54 | | "gemini-1.5-pro" 55 | | "gemini-1.5-pro-latest" 56 | | "gemini-1.5-pro-001" 57 | | "gemini-1.5-pro-002" 58 | | "gemini-2.0-flash-lite-preview-02-05" 59 | | "gemini-2.0-pro-exp-02-05" 60 | | "gemini-2.0-flash-thinking-exp-01-21" 61 | | "gemini-2.0-flash-exp" 62 | | "gemini-exp-1206" 63 | | "learnlm-1.5-pro-experimental"; 64 | export interface GoogleModelProvider { 65 | provider: "google"; 66 | id: GoogleModelId; 67 | } 68 | 69 | export type ModelProvider = 70 | | OpenAIModelProvider 71 | | AnthropicModelProvider 72 | | GoogleModelProvider; 73 | 74 | export type GenerateTextParams = Omit< 75 | Parameters[0], 76 | "model" | "tools" 77 | > & { 78 | tools?: ToolSet; 79 | }; 80 | 81 | export type GenerateObjectParams = Omit< 82 | Parameters[0], 83 | "model" | "schema" | "tools" | "toolChoice" | "output" | "mode" 84 | > & { 85 | schema: AnyZodObject; 86 | }; 87 | 88 | export type LLMParameters = GenerateTextParams | GenerateObjectParams; 89 | 90 | export interface LLMStructuredResponse { 91 | type: "assistant"; 92 | value: z.infer; 93 | } 94 | 95 | export interface LLMTextResponse { 96 | type: "assistant"; 97 | value: string; 98 | } 99 | 100 | export type LLMResponse = 101 | | LLMStructuredResponse 102 | | LLMTextResponse; 103 | 104 | export type UserContentAttachments = Array; 105 | -------------------------------------------------------------------------------- /docs/concepts/llms.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: LLMs 3 | description: Overview of supported language models, including OpenAI, Anthropic, and Google Gemini, Grok, and more. 4 | icon: "computer-classic" 5 | --- 6 | 7 | Each LLM is an adapter around a language model provider and the specific model version, eg: `gpt-4o-mini`. Each [Agent](/agents) can pick their own model and a [ZeeWorkflow](/zee-workflows) can be configured to use a specific LLM as default. 8 | 9 | ```tsx 10 | const llm = new LLM({ 11 | provider: "openai", 12 | id: "gpt-4o-mini", 13 | }); 14 | ``` 15 | 16 | ## List of supported LLM Model IDs 17 | 18 | 19 | 20 | ```plaintext openai 21 | "gpt-4o" 22 | "gpt-4o-mini" 23 | "gpt-4o-2024-05-13" 24 | "gpt-4o-2024-08-06" 25 | "gpt-4o-2024-11-20" 26 | "gpt-4o-audio-preview" 27 | "gpt-4o-audio-preview-2024-10-01" 28 | "gpt-4o-audio-preview-2024-12-17" 29 | "gpt-4o-mini-2024-07-18" 30 | "gpt-4-turbo" 31 | "gpt-4-turbo-2024-04-09" 32 | "gpt-4-turbo-preview" 33 | "gpt-4-0125-preview" 34 | "gpt-4-1106-preview" 35 | "gpt-4" 36 | "gpt-4-0613" 37 | "gpt-3.5-turbo-0125" 38 | "gpt-3.5-turbo" 39 | "gpt-3.5-turbo-1106" 40 | ``` 41 | 42 | ```plaintext anthropic 43 | "claude-3-5-sonnet-latest" 44 | "claude-3-5-sonnet-20241022" 45 | "claude-3-5-sonnet-20240620" 46 | "claude-3-5-haiku-latest" 47 | "claude-3-5-haiku-20241022" 48 | "claude-3-opus-latest" 49 | "claude-3-opus-20240229" 50 | "claude-3-sonnet-20240229" 51 | "claude-3-haiku-20240307" 52 | ``` 53 | 54 | ```plaintext google 55 | "gemini-2.0-flash-001" 56 | "gemini-1.5-flash" 57 | "gemini-1.5-flash-latest" 58 | "gemini-1.5-flash-001" 59 | "gemini-1.5-flash-002" 60 | "gemini-1.5-flash-8b" 61 | "gemini-1.5-flash-8b-latest" 62 | "gemini-1.5-flash-8b-001" 63 | "gemini-1.5-pro" 64 | "gemini-1.5-pro-latest" 65 | "gemini-1.5-pro-001" 66 | "gemini-1.5-pro-002" 67 | "gemini-2.0-flash-lite-preview-02-05" 68 | "gemini-2.0-pro-exp-02-05" 69 | "gemini-2.0-flash-thinking-exp-01-21" 70 | "gemini-2.0-flash-exp" 71 | "gemini-exp-1206" 72 | "learnlm-1.5-pro-experimental" 73 | ``` 74 | 75 | 76 | 77 | ## Environment Variables 78 | 79 | 80 | 81 | ```plaintext openai 82 | OPENAI_API_KEY 83 | ``` 84 | 85 | ```plaintext anthropic 86 | ANTHROPIC_API_KEY 87 | ``` 88 | 89 | ```plaintext google 90 | GOOGLE_GENERATIVE_AI_API_KEY 91 | ``` 92 | 93 | 94 | 95 | ## Use Cases 96 | 97 | ### Image Analysis 98 | 99 | LLMs can also process images along with text using image URL messages. Here's an example of analyzing an image using the LLM: 100 | 101 | ```typescript 102 | const messages = [ 103 | userMessage( 104 | "What's in this image?" 105 | ), 106 | userMessage([ 107 | { 108 | type: "image", 109 | image: "https://example.com/logo.png", 110 | }, 111 | ]), 112 | ], 113 | 114 | const schema = z.object({ 115 | description: z.string(), 116 | colors: z.array(z.string()), 117 | text_content: z.string().optional(), 118 | improvements: z.string().optional(), 119 | }); 120 | 121 | const result = await llm.generate({ 122 | messages, 123 | schema, 124 | temperature: 0.8, 125 | }); 126 | ``` 127 | 128 | The LLM will analyze the image and return a structured response containing the description, colors used, and potential improvements. You can also use base64-encoded images by providing the data URL: 129 | 130 | ```typescript 131 | const messages = [ 132 | userMessage("What's in this image?"), 133 | userMessage([ 134 | { 135 | type: "image", 136 | image: "data:image/png;base64,...", 137 | }, 138 | ]), 139 | ]; 140 | ``` 141 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | # AI Agent SDK for TypeScript 4 | 5 | [📖 Documentation](https://cxt.build/) | 6 | [✍🏻 ZEE Use-cases](https://cxt.build/docs/use-cases/overview) 7 | 8 |
9 | 10 | [![NPM Version](https://img.shields.io/npm/v/@covalenthq/ai-agent-sdk)](https://www.npmjs.com/package/@covalenthq/ai-agent-sdk) 11 | [![NPM Downloads](https://img.shields.io/npm/dt/@covalenthq/ai-agent-sdk)](https://www.npmjs.com/package/@covalenthq/ai-agent-sdk) 12 | [![GitHub license](https://img.shields.io/github/license/covalenthq/ai-agent-sdk)](https://github.com/covalenthq/ai-agent-sdk/blob/main/LICENSE) 13 | [![GitHub last commit](https://img.shields.io/github/last-commit/covalenthq/ai-agent-sdk)](https://github.com/covalenthq/ai-agent-sdk/commits/master) 14 | [![GitHub contributors](https://img.shields.io/github/contributors/covalenthq/ai-agent-sdk)](https://github.com/covalenthq/ai-agent-sdk/graphs/contributors) 15 | [![GitHub issues](https://img.shields.io/github/issues/covalenthq/ai-agent-sdk)](https://github.com/covalenthq/ai-agent-sdk/issues) 16 | [![GitHub pull requests](https://img.shields.io/github/issues-pr/covalenthq/ai-agent-sdk)](https://github.com/covalenthq/ai-agent-sdk/pulls) 17 | 18 | [![GitHub stars](https://img.shields.io/github/stars/covalenthq/ai-agent-sdk)](https://github.com/covalenthq/ai-agent-sdk/stargazers) 19 | [![GitHub forks](https://img.shields.io/github/forks/covalenthq/ai-agent-sdk)](https://github.com/covalenthq/ai-agent-sdk/network/members) 20 | 21 |
22 | 23 |

Build autonomous AI agents for the Zero-Employee Enterprise (ZEE). Create intelligent, context-aware agents with unprecedented ease and functionality. The Agent SDK supports single model inference calls to multi-agent systems that use tools. The SDK provides primitives that are designed to be easily composable, extendable and flexible for advanced use cases.

24 | 25 | ## Features 26 | 27 | - LLMs - a unified interface for all LLMs 28 | - Agents - a single model with a system prompt and a set of tools 29 | - Tools - extend the capabilities of agents with external tools 30 | - ZEE Workflows - compose agents to solve complex problems 31 | 32 | ## Using the SDK (Quick Start) 33 | 34 | ### 1. Start with a template 35 | 36 | > npx @covalenthq/create-zee-app@latest 37 | 38 | This will create a new project with a basic setup. 39 | 40 | ### 2. Modify the agent 41 | 42 | ```js 43 | const agent1 = new Agent({ 44 | name: "Agent1", 45 | model: { 46 | provider: "OPEN_AI", 47 | id: "gpt-4o-mini", 48 | }, 49 | description: "A helpful AI assistant that can engage in conversation.", 50 | instructions: ["Interact with the user in a friendly and helpful manner"], 51 | }); 52 | ``` 53 | 54 | ### 3. Modify the ZEE Workflow 55 | 56 | ```js 57 | const zee = new ZeeWorkflow({ 58 | goal: "A workflow of agents that do stuff together", 59 | agents: [agent1, agent2], 60 | model: { 61 | provider: "OPEN_AI", 62 | id: "gpt-4o-mini", 63 | }, 64 | }); 65 | ``` 66 | 67 | ### 4. Run the Zee Workflow 68 | 69 | ```js 70 | (async function main() { 71 | const result = await zee.run(); 72 | console.log(result); 73 | })(); 74 | ``` 75 | 76 | ## 🤝 Contributing 77 | 78 | Contributions, issues and feature requests are welcome! 79 | Feel free to check issues page. 80 | 81 | Or join the [AI Agent SDK Working Group](https://t.me/CXT_Agent_SDK) to get help and discuss the future of the SDK. 82 | 83 | ## Show your support 84 | 85 | Give a ⭐️ if this project helped you! 86 | 87 | ## 📝 License 88 | 89 | This project is MIT licensed. 90 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/tests/agent.test.ts: -------------------------------------------------------------------------------- 1 | import { Agent, type ModelProvider, Tool, type ToolSet, userMessage } from ".."; 2 | import fetch from "node-fetch"; 3 | import { describe, expect, test } from "vitest"; 4 | import { z } from "zod"; 5 | 6 | describe("@ai-agent-sdk/agent", () => { 7 | const providers: ModelProvider[] = [ 8 | { 9 | provider: "openai", 10 | id: "gpt-4o-mini", 11 | }, 12 | { 13 | provider: "google", 14 | id: "gemini-1.5-flash", 15 | }, 16 | { 17 | provider: "anthropic", 18 | id: "claude-3-5-sonnet-20240620", 19 | }, 20 | ]; 21 | 22 | providers.forEach((model) => { 23 | describe(`${model.provider}::${model.id}`, () => { 24 | test("default agent flow", async () => { 25 | const agent = new Agent({ 26 | name: "research agent", 27 | model: model, 28 | description: 29 | "You are a senior New York Times researcher writing an article on a topic.", 30 | instructions: [ 31 | "For a given topic, search for the top 5 links.", 32 | "Then read each URL and extract the article text, if a URL isn't available, ignore it.", 33 | "Analyze and prepare an New York Times worthy article based on the information.", 34 | ], 35 | }); 36 | 37 | const result = await agent.generate({ 38 | messages: [userMessage("Future of AI")], 39 | }); 40 | 41 | console.log(result); 42 | 43 | expect(result.type).toBe("assistant"); 44 | expect(result.value).toBeDefined(); 45 | }); 46 | 47 | test("agent with custom tool", async () => { 48 | const tools: ToolSet = { 49 | weather: new Tool({ 50 | provider: model.provider, 51 | name: "weather", 52 | description: "Fetch the current weather in a location", 53 | parameters: z.object({ 54 | location: z.string(), 55 | }), 56 | execute: async ({ location }) => { 57 | const response = await fetch( 58 | `https://api.weatherapi.com/v1/current.json?q=${location}&key=88f97127772c41a991095603230604` 59 | ); 60 | const data = await response.json(); 61 | return data; 62 | }, 63 | }), 64 | }; 65 | 66 | const agent = new Agent({ 67 | name: "weather agent", 68 | model, 69 | description: 70 | "You are a senior weather analyst writing a summary on the current weather for the provided location.", 71 | instructions: [ 72 | "Use the weather tool to get the current weather in Celsius.", 73 | "Elaborate on the weather.", 74 | ], 75 | tools, 76 | }); 77 | 78 | const result = await agent.generate({ 79 | messages: [userMessage("What is the weather in Delhi?")], 80 | }); 81 | 82 | console.log(result); 83 | 84 | expect(result.type).toBe("assistant"); 85 | expect(result.value).toBeDefined(); 86 | }); 87 | }); 88 | }); 89 | }); 90 | -------------------------------------------------------------------------------- /docs/get-started/overview.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Overview 3 | icon: "book-open" 4 | description: Overview of the AI Agent SDK, including its components, features, and how to get started with the Zero-Employee Enterprise (ZEE). 5 | --- 6 | 7 | The AI Agent SDK is a developer framework for building and running autonomous agents. It provides a set of tools and components for creating, managing, and deploying agents. These agents operate as a swarm, coordinating and collaborating to achieve complex tasks. The **[Zero-Employee Enterprise (ZEE)](/concepts/zee-workflows)** is a new business model where traditional workforces are augmented by these autonomous agents. 8 | 9 | The Agent SDK supports single model inference calls to multi-agent systems that use tools. The SDK provides primitives that are designed to be easily composable, extendable and flexible for advanced use cases. 10 | 11 | ## How the SDK works 12 | 13 | ```mermaid 14 | flowchart LR 15 | %% Styling 16 | classDef input fill:#ffffff,stroke:#000000,stroke-width:2px, color:#000 17 | classDef planner fill:#f0f0f0,stroke:#000000,stroke-width:2px, color:#000 18 | classDef agent fill:#e0e0e0,stroke:#000000,stroke-width:2px, color:#000 19 | classDef tool fill:#d0d0d0,stroke:#000000,stroke-width:2px, color:#000 20 | classDef state fill:#fafafa,stroke:#000000,stroke-width:2px,stroke-dasharray: 5 5, color:#000 21 | classDef llm fill:#ffffff,stroke:#000000,stroke-width:2px, color:#000 22 | 23 | %% Nodes 24 | inp1("🔄 Input") 25 | 26 | subgraph "Zero-Employee Enterprise" 27 | direction LR 28 | planner{"🔍 Planner Agent"} 29 | router{"🧠 Router Agent"} 30 | agent1("🤖 Primary Agent") 31 | agent2("🤖 Support Agent") 32 | agent3("🤖 Task Agent") 33 | tool1("⚡ Tool A") 34 | tool2("⚡ Tool B") 35 | tool3("⚡ Tool C") 36 | tool4("⚡ Tool D") 37 | id1[("💾 Context")] 38 | end 39 | 40 | subgraph "Language Models" 41 | direction TB 42 | llm1[["OpenAI"]] 43 | llm2[["Google"]] 44 | llm3[["Anthropic"]] 45 | end 46 | 47 | %% Connections 48 | inp1 --> planner 49 | planner --> router 50 | router <--> agent1 51 | router <--> agent2 52 | router <--> agent3 53 | agent1 <--> tool1 54 | agent2 <--> tool2 55 | agent3 <--> tool3 56 | agent3 <--> tool4 57 | 58 | %% Apply styles 59 | class inp1 input 60 | class planner planner 61 | class router router 62 | class agent1,agent2,agent3 agent 63 | class tool1,tool2,tool3,tool4 tool 64 | class id1 state 65 | class llm1,llm2,llm3 llm 66 | ``` 67 | 68 | The SDK enables developers to compose simple single-agent systems or entire systems of agents that work together to form the Zero-Employee Enterprise ([ZEE](/concepts/zee-workflows)). [Agents](/concepts/agents) are the building blocks of the ZEE workflow. Each agent is backed by a language model that can be configured to use a variety of [LLMs](/concepts/llms). Agents can additionally use [Tools](/concepts/tools) to perform actions on the ZEE using outside information. 69 | 70 | ```typescript 71 | const agent = new Agent({ 72 | name: "Reporting Agent", 73 | ... 74 | tools: { tool1, tool2, tool3 }, 75 | }); 76 | 77 | const zee = new ZeeWorkflow({ 78 | goal: "The goal of this workflow is to...", 79 | ... 80 | agents: [agent1, agent2, agent3], 81 | }); 82 | ``` 83 | 84 | ### Concepts 85 | 86 | - [LLMs](/concepts/llms) - a unified interface for all LLMs 87 | - [Agents](/concepts/agents) - a single model with a system prompt and a set of tools 88 | - [Tools](/concepts/tools) - extend the capabilities of agents with external tools 89 | - [ZEE Workflows](/concepts/zee-workflows) - compose agents to solve complex problems 90 | -------------------------------------------------------------------------------- /packages/create-zee-app/src/index.ts: -------------------------------------------------------------------------------- 1 | import { 2 | cancel, 3 | intro, 4 | isCancel, 5 | outro, 6 | password, 7 | select, 8 | text, 9 | } from "@clack/prompts"; 10 | import fs from "fs/promises"; 11 | import { pastel } from "gradient-string"; 12 | import path from "path"; 13 | import picocolors from "picocolors"; 14 | import { URL } from "url"; 15 | 16 | const banner = [ 17 | " _ ___ _ _ ____ ____ _ __", 18 | " / \\ |_ _| / \\ __ _ ___ _ __ | |_ / ___|| _ \\| |/ /", 19 | " / _ \\ | | / _ \\ / _` |/ _ \\ '_ \\| __| \\___ \\| | | | ' /", 20 | " / ___ \\ | | / ___ \\ (_| | __/ | | | |_ ___) | |_| | . \\", 21 | "/_/ \\_\\___| /_/ \\_\\__, |\\___|_| |_|\\__| |____/|____/|_|\\_\\", 22 | " |___/", 23 | ]; 24 | 25 | console.log(pastel(banner.join("\n"))); 26 | 27 | const { green, red, gray } = picocolors; 28 | 29 | const __dirname = path.dirname(new URL(import.meta.url).pathname); 30 | const TEMPLATES_DIR = path.resolve(__dirname, "..", "templates"); 31 | 32 | const ADJECTIVES = [ 33 | "adorable", 34 | "beautiful", 35 | "bright", 36 | "calm", 37 | "delightful", 38 | "enchanting", 39 | "friendly", 40 | "gorgeous", 41 | "glorious", 42 | "lovely", 43 | "perfect", 44 | "precious", 45 | "shiny", 46 | "sparkling", 47 | "super", 48 | "wicked", 49 | ]; 50 | 51 | const generateAdjective = () => { 52 | const n: string = ADJECTIVES[ 53 | Math.floor(Math.random() * ADJECTIVES.length) 54 | ] as string; 55 | return n; 56 | }; 57 | 58 | async function main() { 59 | intro("Build autonomous AI agents for the Zero-Employee Enterprise (ZEE)."); 60 | 61 | const projectName = await text({ 62 | message: `What is the name of your project? ${gray("[required]")}`, 63 | initialValue: `my-${generateAdjective()}-zee`, 64 | validate: (value) => { 65 | if (value.length === 0) return "Project name is required"; 66 | if (!/^[a-z0-9-]+$/.test(value)) 67 | return "Project name can only contain lowercase letters, numbers, and dashes"; 68 | return; 69 | }, 70 | }); 71 | 72 | if (isCancel(projectName)) { 73 | cancel("Operation cancelled"); 74 | process.exit(0); 75 | } 76 | 77 | const openaiApiKey = await password({ 78 | message: `Please input your OpenAI API key (will be stored in .env file) ${gray("[optional]")}`, 79 | }); 80 | 81 | if (isCancel(openaiApiKey)) { 82 | cancel("Operation cancelled"); 83 | process.exit(0); 84 | } 85 | 86 | const template = await select({ 87 | message: "Choose the template you want to use", 88 | options: [ 89 | { 90 | value: "001-zee-barebones", 91 | label: "Just a barebones template", 92 | }, 93 | { 94 | value: "002-onchain-workflow", 95 | label: "Analyze blockchain data to get a wallet's token balances, etc.", 96 | }, 97 | ], 98 | }); 99 | 100 | if (isCancel(template)) { 101 | cancel("Operation cancelled"); 102 | process.exit(0); 103 | } 104 | 105 | const targetDir = path.join(process.cwd(), projectName); 106 | const templateDir = path.resolve(TEMPLATES_DIR, template); 107 | 108 | try { 109 | await fs.mkdir(targetDir, { recursive: true }); 110 | 111 | await copyTemplateFiles(templateDir, targetDir); 112 | 113 | const envPath = path.join(targetDir, ".env"); 114 | await fs.writeFile(envPath, `OPENAI_API_KEY=${openaiApiKey}\n`, { 115 | flag: "a", 116 | }); 117 | 118 | const packageJsonPath = path.join(targetDir, "package.json"); 119 | const packageJson = JSON.parse( 120 | await fs.readFile(packageJsonPath, "utf-8") 121 | ); 122 | packageJson.name = projectName; 123 | await fs.writeFile( 124 | packageJsonPath, 125 | JSON.stringify(packageJson, null, 2) 126 | ); 127 | 128 | const indexTsPath = path.join(targetDir, "src/index.ts"); 129 | const indexTsContent = await fs.readFile(indexTsPath, "utf-8"); 130 | const updatedContent = indexTsContent.replace( 131 | /name: ['"].*?['"].*?\/\/ REPLACE/, 132 | `name: '${projectName}'` 133 | ); 134 | await fs.writeFile(indexTsPath, updatedContent); 135 | 136 | outro(green("Project created successfully! 🎉")); 137 | console.log("\nNext steps:"); 138 | console.log(` cd ${projectName}`); 139 | console.log(" npm install"); 140 | console.log(" npm run dev"); 141 | } catch (error) { 142 | console.error(red("Error creating project:"), error); 143 | process.exit(1); 144 | } 145 | } 146 | 147 | async function copyTemplateFiles(source: string, target: string) { 148 | const files = await fs.readdir(source, { withFileTypes: true }); 149 | 150 | for (const file of files) { 151 | const sourcePath = path.join(source, file.name); 152 | const targetPath = path.join(target, file.name); 153 | 154 | if (file.isDirectory()) { 155 | await fs.mkdir(targetPath, { recursive: true }); 156 | await copyTemplateFiles(sourcePath, targetPath); 157 | } else { 158 | await fs.copyFile(sourcePath, targetPath); 159 | } 160 | } 161 | } 162 | 163 | main().catch(console.error); 164 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/tests/llm.test.ts: -------------------------------------------------------------------------------- 1 | import { LLM, Tool, userMessage, type ModelProvider, type ToolSet } from ".."; 2 | import fetch from "node-fetch"; 3 | import { describe, expect, test } from "vitest"; 4 | import { z } from "zod"; 5 | 6 | describe("@ai-agent-sdk/llm", () => { 7 | const providers: ModelProvider[] = [ 8 | { 9 | provider: "openai", 10 | id: "gpt-4o-mini", 11 | }, 12 | { 13 | provider: "google", 14 | id: "gemini-1.5-flash", 15 | }, 16 | { 17 | provider: "anthropic", 18 | id: "claude-3-5-sonnet-20240620", 19 | }, 20 | ]; 21 | 22 | providers.forEach((model) => { 23 | describe(`${model.provider}::${model.id}`, () => { 24 | const llm = new LLM(model); 25 | 26 | test("structured output", async () => { 27 | const schema = z.object({ 28 | answer: z.string(), 29 | explanation: z.string(), 30 | }); 31 | 32 | const result = await llm.generate({ 33 | prompt: "What is 5 plus 7?", 34 | schema, 35 | }); 36 | 37 | console.log(result); 38 | 39 | if (typeof result.value !== "object") { 40 | throw new Error("Expected structured output"); 41 | } 42 | 43 | expect(result.type).toBe("assistant"); 44 | expect(result.value["answer"]).toBeDefined(); 45 | expect(result.value["explanation"]).toBeDefined(); 46 | }); 47 | 48 | test("tool calling", async () => { 49 | const tools: ToolSet = { 50 | weather: new Tool({ 51 | provider: model.provider, 52 | name: "weather", 53 | description: "Fetch the current weather in a location", 54 | parameters: z.object({ 55 | location: z.string(), 56 | }), 57 | execute: async ({ location }) => { 58 | const response = await fetch( 59 | `https://api.weatherapi.com/v1/current.json?q=${location}&key=88f97127772c41a991095603230604` 60 | ); 61 | const data = await response.json(); 62 | return data; 63 | }, 64 | }), 65 | }; 66 | 67 | const result = await llm.generate({ 68 | prompt: "What is the weather in San Francisco?", 69 | tools, 70 | }); 71 | 72 | console.log(result); 73 | 74 | expect(result.type).toBe("assistant"); 75 | expect(result.value).toBeDefined(); 76 | }); 77 | 78 | test("multimodal image url input", async () => { 79 | const schema = z.object({ 80 | description: z.string(), 81 | colors: z.array(z.string()), 82 | text_content: z.string().optional(), 83 | improvements: z.string().optional(), 84 | }); 85 | 86 | const result = await llm.generate({ 87 | messages: [ 88 | userMessage( 89 | "What's in this image? Suggest Improvements to the logo as well" 90 | ), 91 | userMessage([ 92 | { 93 | type: "image", 94 | image: "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/1200px-Google_2015_logo.svg.png", 95 | }, 96 | ]), 97 | ], 98 | schema, 99 | }); 100 | 101 | console.log(result); 102 | 103 | expect(result.type).toBe("assistant"); 104 | expect(result.value).toBeDefined(); 105 | }); 106 | 107 | test("multimodal image base64 input", async () => { 108 | const schema = z.object({ 109 | description: z.string(), 110 | colors: z.array(z.string()), 111 | text_content: z.string().optional(), 112 | }); 113 | 114 | const base64Image = 115 | "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; 116 | 117 | const result = await llm.generate({ 118 | messages: [ 119 | userMessage("What's in this image?"), 120 | userMessage([ 121 | { 122 | type: "image", 123 | image: base64Image, 124 | }, 125 | ]), 126 | ], 127 | schema, 128 | }); 129 | 130 | console.log(result); 131 | 132 | expect(result.type).toBe("assistant"); 133 | expect(result.value).toBeDefined(); 134 | }); 135 | 136 | // TODO: add audio and file multimodal input tests 137 | }); 138 | }); 139 | }); 140 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/tests/goldrush.tools.test.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Agent, 3 | HistoricalTokenPriceTool, 4 | NFTBalancesTool, 5 | TokenBalancesTool, 6 | TransactionsTool, 7 | userMessage, 8 | type ModelProvider, 9 | type ToolSet, 10 | } from ".."; 11 | import "dotenv/config"; 12 | import { describe, expect, test } from "vitest"; 13 | 14 | describe("@ai-agent-sdk/tools/goldrush", () => { 15 | const providers: ModelProvider[] = [ 16 | { 17 | provider: "openai", 18 | id: "gpt-4o-mini", 19 | }, 20 | { 21 | provider: "google", 22 | id: "gemini-1.5-flash", 23 | }, 24 | { 25 | provider: "anthropic", 26 | id: "claude-3-5-sonnet-20240620", 27 | }, 28 | ]; 29 | 30 | providers.forEach((model) => { 31 | describe(`${model.provider}::${model.id}`, () => { 32 | test("token balances tool with an agent", async () => { 33 | const tools: ToolSet = { 34 | tokenBalances: new TokenBalancesTool(model.provider), 35 | }; 36 | 37 | const agent = new Agent({ 38 | name: "token balances agent", 39 | model, 40 | description: 41 | "You are a senior blockchain researcher analyzing wallet activities across different chains.", 42 | instructions: [ 43 | "Summarize token holdings", 44 | "Provide insights about the token holdings", 45 | ], 46 | tools, 47 | }); 48 | 49 | const result = await agent.generate({ 50 | messages: [ 51 | userMessage( 52 | "What are the token balances for karanpargal.eth on eth-mainnet?" 53 | ), 54 | ], 55 | }); 56 | 57 | console.log(result); 58 | 59 | expect(result.type).toBe("assistant"); 60 | expect(result.value).toBeDefined(); 61 | }); 62 | 63 | test("token balances tool with an agent", async () => { 64 | const tools: ToolSet = { 65 | transactions: new TransactionsTool(model.provider), 66 | }; 67 | 68 | const agent = new Agent({ 69 | name: "token balances agent", 70 | model, 71 | description: 72 | "You are a senior blockchain researcher analyzing wallet activities across different chains.", 73 | instructions: [ 74 | "Summarize transactions", 75 | "Provide insights about the transactions", 76 | ], 77 | tools, 78 | }); 79 | 80 | const result = await agent.generate({ 81 | messages: [ 82 | userMessage( 83 | "What are the transactions for karanpargal.eth on eth-mainnet?" 84 | ), 85 | ], 86 | }); 87 | 88 | console.log(result); 89 | 90 | expect(result.type).toBe("assistant"); 91 | expect(result.value).toBeDefined(); 92 | }); 93 | 94 | test("nft balances tool with an agent", async () => { 95 | const tools: ToolSet = { 96 | nftBalances: new NFTBalancesTool(model.provider), 97 | }; 98 | 99 | const agent = new Agent({ 100 | name: "nft balances agent", 101 | model, 102 | description: 103 | "You are a senior blockchain researcher analyzing wallet activities across different chains.", 104 | instructions: [ 105 | "Summarize nft holdings", 106 | "Provide insights about the nft holdings", 107 | ], 108 | tools, 109 | }); 110 | 111 | const result = await agent.generate({ 112 | messages: [ 113 | userMessage( 114 | "What are the nft holdings for karanpargal.eth on eth-mainnet?" 115 | ), 116 | ], 117 | }); 118 | 119 | console.log(result); 120 | 121 | expect(result.type).toBe("assistant"); 122 | expect(result.value).toBeDefined(); 123 | }); 124 | 125 | test("nft balances tool with an agent", async () => { 126 | const tools: ToolSet = { 127 | historicalTokenPrice: new HistoricalTokenPriceTool( 128 | model.provider 129 | ), 130 | }; 131 | 132 | const agent = new Agent({ 133 | name: "historical token price agent", 134 | model, 135 | description: 136 | "You are a senior blockchain researcher analyzing activities across different chains.", 137 | instructions: [ 138 | "Summarize historical token prices", 139 | "Provide insights about the historical token prices", 140 | ], 141 | tools, 142 | }); 143 | 144 | const result = await agent.generate({ 145 | messages: [ 146 | userMessage( 147 | "What are the historical token prices for 0x7abc8a5768e6be61a6c693a6e4eacb5b60602c4d on eth-mainnet over the past week?" 148 | ), 149 | ], 150 | }); 151 | 152 | console.log(result); 153 | 154 | expect(result.type).toBe("assistant"); 155 | expect(result.value).toBeDefined(); 156 | }); 157 | 158 | test("multiple goldrush tools with an agent", async () => { 159 | const tools: ToolSet = { 160 | tokenBalances: new TokenBalancesTool(model.provider), 161 | nftBalances: new NFTBalancesTool(model.provider), 162 | transactions: new TransactionsTool(model.provider), 163 | }; 164 | 165 | const agent = new Agent({ 166 | name: "goldrush agent", 167 | model, 168 | description: 169 | "You are a senior blockchain researcher analyzing wallet activities across different chains.", 170 | instructions: [ 171 | "Analyze wallet activities using the provided blockchain tools", 172 | "Summarize token holdings, NFT collections, and recent transactions", 173 | "Provide insights about the wallet's activity patterns", 174 | ], 175 | tools, 176 | }); 177 | 178 | const result = await agent.generate({ 179 | messages: [ 180 | userMessage( 181 | "What is the activity of karanpargal.eth on eth-mainnet?" 182 | ), 183 | ], 184 | }); 185 | 186 | console.log(result); 187 | 188 | expect(result.type).toBe("assistant"); 189 | expect(result.value).toBeDefined(); 190 | }); 191 | }); 192 | }); 193 | }); 194 | -------------------------------------------------------------------------------- /docs/zee-use-cases.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: ZEE Use Cases 3 | icon: "anchor" 4 | description: Use cases for the ZEE with the AI Agent SDK. 5 | --- 6 | 7 | 8 | Agent workflows can facilitate collaboration on specific tasks across a wide variety of use cases. Below is a list of example crypto-native use cases. 9 | 10 | --- 11 | 12 | ### 1. DeFi Investment Agent: Automated Portfolio Manager for Yield Optimization 13 | 14 | **Concept**: An autonomous agent that dynamically manages crypto portfolios by reallocating assets across DeFi protocols to maximize yield. 15 | 16 | **Features**: 17 | - Pulls real-time liquidity pool and yield farming data from the [GoldRush API tool](../tools/goldrush-onchain-data). 18 | - Uses reinforcement learning to monitor, analyze, and optimize yield strategies based on market conditions and risk profiles. 19 | - Allocates or rebalances funds automatically in lending protocols, liquidity pools, or staking platforms. 20 | - Sends notifications to users on portfolio changes, yield updates, and recommendations for optimizing returns. 21 | 22 | 23 | --- 24 | 25 | ### 2. NFT Valuation and Rarity Analyzer: Market-Pricing Model for Digital Assets 26 | 27 | **Concept**: An AI model that provides a rarity and value estimate for NFTs based on onchain data, rarity, and transaction history. NFT collectors and investors can leverage this tool to make informed decisions when buying, selling, or holding NFTs based on projected market trends. 28 | 29 | **Features**: 30 | - Analyzes data on NFT trades, transfers, and token metadata using Covalent's API. 31 | - Employs a machine learning model to predict the market value of NFTs based on rarity traits, trading volume, and past sale prices. 32 | - Provides real-time NFT pricing, rarity scoring, and market trend visualization, highlighting growth in specific NFT sectors (e.g., gaming vs. art). 33 | - Alerts users to emerging valuable collections or assets based on trading patterns. 34 | --- 35 | 36 | 37 | ### 3. Onchain Identity Scorer: Web3 Profile and Trustworthiness Model 38 | 39 | **Concept**: An AI tool that assigns trust and activity scores to wallets based on transaction patterns, DeFi participation, and social behaviors on the blockchain. 40 | 41 | **Features**: 42 | - Analyzes wallet behaviors, including transaction history, staking activities, loan repayments, and NFT holdings, using Covalent's data. 43 | - Applies clustering and classification algorithms to segment users into behavior categories, such as "DeFi power user," "whale," or "NFT collector." 44 | - Builds a “trust score” based on onchain behaviors, useful for evaluating users’ reliability in DAO governance or decentralized lending. 45 | - Integrates with DeFi platforms to offer enhanced KYC and AML (anti-money laundering) features based on users’ onchain reputation. 46 | --- 47 | 48 | 49 | ### 4. NFT Creation Agent: AI-Powered NFT Design and Deployment Assistant 50 | 51 | **Concept**: An agent that helps artists and creators design and deploy NFTs onchain, simplifying the creation process and expanding access to the NFT market. 52 | 53 | **Features**: 54 | - Integrates with the [GoldRush API tool](/tools/goldrush-onchain-data) to pull trend data on popular NFT attributes, themes, and pricing patterns. 55 | - Leverages generative AI models to create art styles and themes, allowing users to customize traits or rarity levels. 56 | - Deploys NFTs directly to blockchain networks, with metadata stored on IPFS for decentralized access. 57 | - Provides a launch strategy based on marketplace analysis, recommending listing prices, timing, and rarity settings. 58 | --- 59 | 60 | 61 | ### 5. Transaction Risk Assessment Agent: Real-Time Fraud Detection for Onchain Transactions 62 | 63 | **Concept**: An agent that analyzes real-time transactions and flags potentially risky or suspicious activity to protect users from scams. 64 | 65 | **Features**: 66 | - Monitors transaction patterns, sender history, token movement, and transaction amounts using the [GoldRush API tool](../tools/goldrush-onchain-data). 67 | - Detects anomalies such as unusual transaction sizes, rapid asset movement across multiple wallets, or transactions to known scam wallets. 68 | - Uses machine learning to identify patterns associated with scams (e.g., phishing, rug pulls, and pump-and-dump schemes). 69 | - Sends real-time alerts to users, warning them of potentially fraudulent transactions and advising on preventive actions. 70 | --- 71 | 72 | 73 | ### 6. Wallet Risk Assessment Agent: AI-Powered Insurance Risk Scorer 74 | 75 | **Concept**: An AI tool that evaluates wallet activity and assigns a risk score, enabling insurance providers to assess policy eligibility and premiums for onchain users. 76 | 77 | **Features**: 78 | 79 | - Analyzes wallet transaction history, including DeFi participation, staking, borrowing, and repayment behaviors, using the [GoldRush API tool](../tools/goldrush-onchain-data). 80 | - Detects patterns associated with risky activities, such as frequent liquidations, high leverage, or interactions with suspicious wallets. 81 | - Uses clustering and classification algorithms to segment wallets into risk categories (e.g., low-risk saver, moderate-risk trader, high-risk speculator). 82 | - Assigns a comprehensive risk score based on historical activity, fund flows, and exposure to volatile assets. 83 | - Provides real-time risk assessments and insurance premium recommendations, helping users and providers manage blockchain-related risks effectively. 84 | --- 85 | 86 | 87 | ### 7. Agent to Perform Onchain Actions 88 | 89 | **Concept**: An intelligent agent that automates complex onchain transactions for DeFi users, simplifying blockchain interactions. 90 | 91 | **Features**: 92 | 93 | - Executes actions like swapping tokens, bridging assets, staking, borrowing, and repaying loans. 94 | - Optimizes transaction parameters such as gas fees and liquidity pool choices using Covalent's API data. 95 | - Uses AI to ensure transaction safety by detecting potential risks before execution. 96 | - Automates workflows, enabling multi-step operations (e.g., swapping, bridging, and staking in a single transaction). 97 | - Provides detailed transaction logs and user-friendly updates. 98 | --- 99 | 100 | 101 | ### 8. Onchain Betting Algorithm: AI-Powered Prediction Market System 102 | 103 | **Concept**: An AI-driven betting platform that leverages onchain data to offer predictions and dynamic betting markets, enabling users to engage with decentralized prediction markets. 104 | 105 | **Features**: 106 | 107 | - Pulls real-time onchain data such as token prices, transaction volumes, and protocol metrics using the [GoldRush API tool](../tools/goldrush-onchain-data). 108 | - Employs machine learning models to forecast outcomes of events, such as token price changes, governance proposal results, or market trends. 109 | - Dynamically adjusts betting odds based on real-time data and user activity to ensure accurate and fair market pricing. 110 | - Detects anomalies and potential manipulation in betting patterns using AI-powered anomaly detection algorithms. 111 | - Provides detailed insights into potential payouts and risk levels for each bet, helping users make informed decisions. 112 | - Integrates with decentralized wallets for seamless onchain betting and payout distribution. 113 | --- 114 | 115 | 116 | ### 9. AI Boiler Room: Autonomous Agents Simulating Market Dynamics Across Chains 117 | 118 | **Concept**: A network of AI agents that interact with each other in a simulated blockchain environment, mimicking market dynamics and user behaviors based on real onchain activity. 119 | 120 | **Features**: 121 | 122 | - Pulls cross-chain transaction data, token swaps, liquidity movements, and wallet interactions from the [GoldRush API tool](../tools/goldrush-onchain-data). 123 | - Creates AI agents with distinct profiles (e.g., traders, arbitrage bots, NFT collectors) to simulate various blockchain user types. 124 | - Agents analyze real onchain data to make decisions like swapping tokens, bridging assets, or participating in DeFi protocols. 125 | - Simulates market reactions and liquidity flows by enabling AI agents to interact with each other in real time. 126 | - Provides insights into potential market scenarios, such as price fluctuations, liquidity crunches, or arbitrage opportunities. 127 | - Useful for stress testing DeFi protocols, exploring economic strategies, or building predictive models for market behavior. 128 | --- 129 | 130 | 131 | ### 10. DeFi Lending Optimizer (Chaos Labs) 132 | 133 | **Concept**: An AI agent that maximizes returns for DeFi lenders by optimizing lending and borrowing activities. 134 | 135 | **Features**: 136 | 137 | - Pulls real-time interest rates, utilization rates, and collateral factors from the [GoldRush API tool](../tools/goldrush-onchain-data). 138 | - Recommends optimal platforms and lending strategies based on user preferences and market conditions. 139 | - Monitors liquidation risks and alerts users to potential threats. 140 | - Utilizes RF to test out different parameters to increase borrowing without exposing risk on the protocol 141 | - Automates rebalancing across multiple protocols for enhanced yield optimization. 142 | - Generates user-friendly reports on lending performance and opportunities. 143 | --- 144 | 145 | 146 | ### 11. Cross-Chain Arbitrage Finder 147 | 148 | **Concept**: An AI assistant that identifies profitable arbitrage opportunities across blockchains and DEXs. 149 | 150 | **Features**: 151 | 152 | - Aggregates token price and liquidity data from the [GoldRush API tool](../tools/goldrush-onchain-data) across multiple platforms. 153 | - Detects price discrepancies and suggests actionable arbitrage opportunities. 154 | - Recommends steps for executing trades, including gas fee optimization. 155 | - Tracks historical arbitrage performance to refine future recommendations. 156 | - Provides real-time alerts on emerging opportunities. 157 | --- 158 | 159 | 160 | ### 12. Meme Coin Trend Forecaster: Predictive Market Tool for Hype-Driven Tokens 161 | 162 | **Concept**: An AI-powered tool that predicts emerging trends and market movements in meme coins, enabling investors to identify high-growth opportunities early. 163 | 164 | **Features**: 165 | 166 | - Pulls real-time trading volumes, wallet activity, and token performance metrics for meme coins using the [GoldRush API tool](../tools/goldrush-onchain-data). 167 | - Incorporates social sentiment data from platforms like Twitter, Reddit, and Discord to gauge community hype and interest. 168 | - Uses machine learning models to forecast meme coin price movements and detect potential breakout tokens. 169 | - Highlights emerging meme coins based on unusual trading activity, wallet accumulation, and increased sentiment scores. 170 | - Sends alerts for trending meme coins or potential sell opportunities, helping users optimize their investments. 171 | --- 172 | 173 | 174 | ### 13. Sentiment-Based Meme Coin Trading Bot 175 | 176 | **Concept**: A trading bot that combines sentiment analysis with onchain data to automate profitable meme coin trades. 177 | 178 | **Features**: 179 | 180 | - Uses the [GoldRush API tool](../tools/goldrush-onchain-data) to monitor meme coin trading activity and floor price movements. 181 | - Integrates off-chain sentiment analysis from social media and news to predict market behavior. 182 | - Automates buy/sell actions based on predefined profit thresholds and sentiment scores. 183 | - Sends real-time updates on trade outcomes and market conditions. 184 | - Provides detailed performance summaries and optimizes strategies based on historical data. -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/tests/zee.test.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Agent, 3 | type ModelProvider, 4 | NFTBalancesTool, 5 | TokenBalancesTool, 6 | Tool, 7 | ZeeWorkflow, 8 | } from ".."; 9 | import fetch from "node-fetch"; 10 | import { describe, test } from "vitest"; 11 | import { z } from "zod"; 12 | 13 | describe("@ai-agent-sdk/zee", () => { 14 | const providers: ModelProvider[] = [ 15 | { 16 | provider: "openai", 17 | id: "gpt-4o-mini", 18 | }, 19 | // ! FIX: ZEE is not working with Google models (content is needed) 20 | // { 21 | // provider: "google", 22 | // id: "gemini-1.5-flash", 23 | // }, 24 | { 25 | provider: "anthropic", 26 | id: "claude-3-5-sonnet-20240620", 27 | }, 28 | ]; 29 | providers.forEach((model) => { 30 | describe(`${model.provider}::${model.id}`, () => { 31 | test("workflow with two agents", async () => { 32 | const screenplayWriter = new Agent({ 33 | name: "screenplay writer", 34 | description: "You are an expert screenplay writer", 35 | instructions: [ 36 | "Write a script outline with 3-5 main characters and key plot points.", 37 | "Outline the three-act structure and suggest 2-3 twists.", 38 | "Ensure the script aligns with a genre and target audience.", 39 | ], 40 | model, 41 | }); 42 | 43 | const producer = new Agent({ 44 | name: "movie producer", 45 | description: "Experienced movie producer", 46 | instructions: [ 47 | "Based on the script outline, plan the cast and crew for the movie.", 48 | "Summarize the budget for the movie.", 49 | "Provide a synopsis of the movie.", 50 | ], 51 | model, 52 | }); 53 | 54 | const zee = new ZeeWorkflow({ 55 | goal: "Plan a scene-by-scene script for a movie that is 10 minutes long and has a happy ending. Create a scene-by-scene budget for the provided script. Suggest a cast and crew for the movie.", 56 | agents: [screenplayWriter, producer], 57 | model, 58 | config: { 59 | temperature: 1, 60 | }, 61 | }); 62 | 63 | const result = await zee.run(); 64 | 65 | console.log(result); 66 | }); 67 | 68 | test("workflow with agent forced followup", async () => { 69 | const scriptWriter = new Agent({ 70 | name: "script writer", 71 | description: 72 | "You are an expert screenplay writer who creates detailed scripts and character descriptions.", 73 | instructions: [ 74 | "Write a brief script outline with main plot points.", 75 | "Only if you are providing the script, then start your script with 'COMPLETE:', else just provide desired response.", 76 | ], 77 | model, 78 | }); 79 | 80 | const producer = new Agent({ 81 | name: "movie producer", 82 | description: 83 | "Experienced movie producer who needs specific character details for casting.", 84 | instructions: [ 85 | "Review the script outline.", 86 | "You MUST ask the script writer for detailed character descriptions before making casting decisions.", 87 | "Once you have character details, provide casting suggestions and budget breakdown.", 88 | "Use 'FOLLOWUP:' to ask for character details.", 89 | "Start your final plan with 'COMPLETE:'", 90 | ], 91 | model, 92 | }); 93 | 94 | const zee = new ZeeWorkflow({ 95 | goal: "Create a 10-minute movie script with matching cast and $500,000 budget breakdown.", 96 | agents: [scriptWriter, producer], 97 | model, 98 | }); 99 | 100 | const result = await zee.run(); 101 | 102 | console.log(result); 103 | }); 104 | 105 | test("workflow with custom tools", async () => { 106 | const weatherAgent = new Agent({ 107 | name: "weather agent", 108 | model, 109 | description: 110 | "You provided weather information for a location.", 111 | instructions: [ 112 | "Call the weather tool to get the current weather information for a location.", 113 | ], 114 | tools: { 115 | weather: new Tool({ 116 | provider: model.provider, 117 | name: "weather", 118 | description: 119 | "Fetch the current weather in a location", 120 | parameters: z.object({ 121 | location: z.string(), 122 | }), 123 | execute: async ({ location }) => { 124 | const response = await fetch( 125 | `https://api.weatherapi.com/v1/current.json?q=${location}&key=88f97127772c41a991095603230604` 126 | ); 127 | const data = await response.json(); 128 | return data; 129 | }, 130 | }), 131 | }, 132 | }); 133 | 134 | const analystAgent = new Agent({ 135 | name: "analyst agent", 136 | model, 137 | description: 138 | "You are an analyst that analyzes weather information.", 139 | instructions: [ 140 | "Analyze and summarize the weather information provided.", 141 | ], 142 | }); 143 | 144 | const zee = new ZeeWorkflow({ 145 | goal: "What's the weather in Delhi? Elaborate on the weather.", 146 | agents: [weatherAgent, analystAgent], 147 | model, 148 | }); 149 | 150 | const result = await zee.run(); 151 | 152 | console.log(result); 153 | }); 154 | 155 | test("workflow with goldrush tools", async () => { 156 | const nftBalancesAgent = new Agent({ 157 | name: "nft balances agent", 158 | model, 159 | description: 160 | "You are provide NFT balances for a wallet address for a chain.", 161 | instructions: ["Provide the nft holdings"], 162 | tools: { 163 | nftBalances: new NFTBalancesTool(model.provider), 164 | }, 165 | }); 166 | 167 | const tokenBalancesAgent = new Agent({ 168 | name: "token balances agent", 169 | model, 170 | description: 171 | "You are provide token balances for a wallet address for a chain.", 172 | instructions: ["Provide the token holdings"], 173 | tools: { 174 | tokenBalances: new TokenBalancesTool(model.provider), 175 | }, 176 | }); 177 | 178 | const analystAgent = new Agent({ 179 | name: "analyst agent", 180 | model, 181 | description: 182 | "You are an expert blockchain analyst that analyzes wallet activities across different chains.", 183 | instructions: [ 184 | "Analyze and summarize the wallet balances.", 185 | ], 186 | }); 187 | 188 | const zee = new ZeeWorkflow({ 189 | goal: "Whats are the NFT and Token balances of the wallet address 'karanpargal.eth' on the chain 'eth-mainnet'? Elaborate on the balances.", 190 | agents: [ 191 | nftBalancesAgent, 192 | tokenBalancesAgent, 193 | analystAgent, 194 | ], 195 | model, 196 | }); 197 | 198 | const result = await zee.run(); 199 | 200 | console.log(result); 201 | }); 202 | 203 | test("exceeding max iterations", async () => { 204 | const strategist = new Agent({ 205 | name: "campaign strategist", 206 | description: 207 | "You are an experienced political campaign strategist who specializes in message development and voter outreach strategies.", 208 | instructions: [ 209 | "Analyze the campaign goal and develop key messaging points.", 210 | "Identify target voter demographics.", 211 | "Propose specific outreach strategies.", 212 | ], 213 | model, 214 | }); 215 | 216 | const mediaManager = new Agent({ 217 | name: "media manager", 218 | description: 219 | "You are a media and communications expert who transforms campaign strategies into actionable media plans.", 220 | instructions: [ 221 | "Review the campaign strategy.", 222 | "Create a detailed media plan including social media, traditional media, and advertising.", 223 | "Suggest content themes and timing for different platforms.", 224 | ], 225 | model, 226 | }); 227 | 228 | const budgetManager = new Agent({ 229 | name: "budget manager", 230 | description: 231 | "You are a budget manager who manages the campaign budget.", 232 | instructions: [ 233 | "Review the campaign strategy.", 234 | "Create a detailed budget plan for the campaign", 235 | "Suggest content themes and timing for different platforms.", 236 | ], 237 | model, 238 | }); 239 | 240 | const zee = new ZeeWorkflow({ 241 | goal: "Develop a 30-day local political campaign strategy focusing on environmental policies and community engagement. Include both traditional and digital media approaches. Summarize a budget for the provided campaign strategy.", 242 | agents: [strategist, mediaManager, budgetManager], 243 | model, 244 | config: { 245 | maxIterations: 5, 246 | }, 247 | }); 248 | const result = await zee.run(); 249 | 250 | console.log(result); 251 | }); 252 | 253 | test("workflow with image messages", async () => { 254 | const imageAnalyser = new Agent({ 255 | name: "image analyser", 256 | description: "You are an expert image analyser", 257 | instructions: [ 258 | "Analyze the image and provide a detailed description of the image.", 259 | ], 260 | model, 261 | }); 262 | 263 | const zee = new ZeeWorkflow({ 264 | goal: "Analyze the image at https://drive.usercontent.google.com/download?id=1NwUfXIVOus3mPz8EA0UIib3ZxM6hNIjx and provide a detailed analysis of what it depicts.", 265 | agents: [imageAnalyser], 266 | model, 267 | config: { 268 | temperature: 1, 269 | }, 270 | }); 271 | 272 | const result = await zee.run(); 273 | 274 | console.log(result); 275 | }); 276 | }); 277 | }); 278 | }); 279 | -------------------------------------------------------------------------------- /packages/ai-agent-sdk/src/core/zee/zee.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | AgentAction, 3 | ContextItem, 4 | RawTask, 5 | ZEETask, 6 | ZeeWorkflowOptions, 7 | ZEEWorkflowResponse, 8 | } from "."; 9 | import { systemMessage, Tool, userMessage, ZEEActionResponseType } from "../.."; 10 | import { Agent } from "../agent"; 11 | import { Base } from "../base/base"; 12 | import { type CoreMessage, type FilePart, type ImagePart } from "ai"; 13 | import { z } from "zod"; 14 | 15 | export class ZeeWorkflow extends Base { 16 | private agents: Record = {}; 17 | private defaultAgents: Record = {}; 18 | private addedAgents: Record = {}; 19 | private context: ContextItem[] = []; 20 | private actionQueue: AgentAction[] = []; 21 | private maxIterations: number = 50; 22 | private temperature: number = 0.5; 23 | private goal: string; 24 | 25 | constructor({ agents, model, goal, config }: ZeeWorkflowOptions) { 26 | super("zee"); 27 | console.log("\n╭────────────────────────────────────────"); 28 | console.log("│ 🚀 Initializing ZeeWorkflow"); 29 | console.log(`│ 🎯 Goal: ${goal}`); 30 | console.log("╰────────────────────────────────────────"); 31 | 32 | if (config?.maxIterations) { 33 | this.maxIterations = config.maxIterations; 34 | } 35 | 36 | if (config?.temperature !== undefined) { 37 | if (config.temperature >= 0 && config.temperature <= 1) { 38 | this.temperature = config.temperature; 39 | } else { 40 | throw new Error( 41 | "Invalid temperature. Must be between 0 and 1." 42 | ); 43 | } 44 | } 45 | 46 | this.goal = goal; 47 | 48 | this.context.push(userMessage(goal)); 49 | 50 | const plannerAgent = new Agent({ 51 | name: "planner", 52 | description: `You are a task planner that wants to complete the user's goal - "${goal}".`, 53 | instructions: [ 54 | "Plan the user's goal into smaller sequential tasks.", 55 | "Do NOT create a task that is not directly related to the user's goal.", 56 | "Do NOT create a final compilation task.", 57 | `Return a JSON array of tasks, where each task has: 58 | - instructions: array of instructions for completing the task 59 | - attachments: array of attachments items, each being an array of objects with {type: 'image', image: url} or {type: 'file', data: url, mimeType: mimeType} 60 | - dependencies: array of strings describing what this task needs from other tasks 61 | Example response format: 62 | ${JSON.stringify( 63 | [ 64 | { 65 | instructions: ["Analyze the logo design"], 66 | attachments: [ 67 | [ 68 | { 69 | type: "image", 70 | image: "https://example.com/logo.png", 71 | }, 72 | ], 73 | ], 74 | dependencies: [], 75 | }, 76 | { 77 | instructions: [ 78 | "Write brand guidelines based on logo analysis", 79 | ], 80 | attachments: [], 81 | dependencies: [ 82 | "Needs logo analysis to write guidelines", 83 | ], 84 | }, 85 | ], 86 | null, 87 | 2 88 | )}`, 89 | "Return ONLY the JSON array, no other text", 90 | ], 91 | model, 92 | temperature: this.temperature, 93 | }); 94 | 95 | const routerAgent = new Agent({ 96 | name: "router", 97 | description: 98 | "You coordinate information flow between agents and assign tasks to achieve the user's goal.", 99 | instructions: [], 100 | model, 101 | tools: { 102 | executeAgent: new Tool({ 103 | name: "execute agent", 104 | description: "Get information from a single agent", 105 | parameters: z.object({ 106 | agentName: z.string(), 107 | tasks: z.array( 108 | z.union([ 109 | z.string(), 110 | z.array( 111 | z.union([ 112 | z.object({ 113 | type: z.literal("image"), 114 | image: z.string(), 115 | mimeType: z.string().optional(), 116 | }), 117 | z.object({ 118 | type: z.literal("file"), 119 | data: z.string(), 120 | mimeType: z.string(), 121 | }), 122 | ]) 123 | ), 124 | ]) 125 | ), 126 | }), 127 | execute: async ({ agentName, tasks }) => { 128 | const agent = this.getAgent(agentName); 129 | if (!agent) { 130 | throw new Error( 131 | `Agent '${agentName}' not found. Available agents: '${Object.keys(this.addedAgents).join("', '")}'.` 132 | ); 133 | } 134 | 135 | const response = await agent.generate({ 136 | messages: tasks.map(userMessage), 137 | }); 138 | 139 | return response.value; 140 | }, 141 | provider: model.provider, 142 | }), 143 | }, 144 | temperature: this.temperature, 145 | }); 146 | 147 | const endgameAgent = new Agent({ 148 | name: "endgame", 149 | description: 150 | "You conclude the workflow based on all completed tasks.", 151 | instructions: [ 152 | "Review all completed tasks and compile in a single response.", 153 | "Ensure the response addresses the original goal.", 154 | ], 155 | model, 156 | temperature: this.temperature, 157 | }); 158 | 159 | [plannerAgent, routerAgent, endgameAgent].forEach((agent) => { 160 | if (!this.defaultAgents[agent.name]) { 161 | this.defaultAgents[agent.name] = agent; 162 | } else { 163 | throw new Error(`Agent '${agent.name}' already exists`); 164 | } 165 | }); 166 | 167 | agents.forEach((agent) => { 168 | if (!this.addedAgents[agent.name]) { 169 | this.addedAgents[agent.name] = agent; 170 | } else { 171 | throw new Error(`Agent '${agent.name}' already exists`); 172 | } 173 | }); 174 | 175 | [ 176 | ...Object.values(this.defaultAgents), 177 | ...Object.values(this.addedAgents), 178 | ].forEach((agent) => { 179 | if (!this.agents[agent.name]) { 180 | this.agents[agent.name] = agent; 181 | } else { 182 | throw new Error(`Agent '${agent.name}' already exists`); 183 | } 184 | }); 185 | } 186 | 187 | private getAgent(agentName: string): Agent { 188 | const maybeAgent = this.agents[agentName]; 189 | if (maybeAgent) { 190 | return maybeAgent; 191 | } 192 | 193 | throw new Error( 194 | `Agent '${agentName}' not found. Available agents: ${Object.keys(this.agents).join(", ")}.` 195 | ); 196 | } 197 | 198 | private parseTasks(response: string): ZEETask[] { 199 | console.log("\n📝 Parsed Tasks"); 200 | 201 | try { 202 | const tasks = JSON.parse(response) as ZEETask[]; 203 | 204 | if (!Array.isArray(tasks)) { 205 | throw new Error("'planner' response must be an array"); 206 | } 207 | 208 | console.log(`\n🔍 Found ${tasks.length} tasks to process\n`); 209 | 210 | tasks.forEach((task, index) => { 211 | if (!task.agentName || !Array.isArray(task.instructions)) { 212 | throw new Error(`Invalid task format at index ${index}`); 213 | } 214 | 215 | console.log(`\n╭────────────────────────────────────────`); 216 | console.log( 217 | `│ 📋 TASK ${index + 1} of ${tasks.length}: Assigned to '${task.agentName}'` 218 | ); 219 | console.log(`├────────────────────────────────────────`); 220 | 221 | console.log(`│ 📝 Instructions:`); 222 | task.instructions.forEach((instruction, i) => { 223 | console.log(`│ ${i + 1}. ${instruction}`); 224 | }); 225 | 226 | if (task.dependencies.length) { 227 | console.log(`│ 🔄 Dependencies:`); 228 | task.dependencies.forEach((dep, i) => { 229 | console.log( 230 | `│ ${i + 1}. Needs input from '${dep.agentName}': "${dep.task}"` 231 | ); 232 | }); 233 | } 234 | 235 | if (task.attachments.length) { 236 | console.log(`│ 📎 Attachments:`); 237 | task.attachments.forEach((items, i) => { 238 | items.forEach((item, j) => { 239 | const typeStr = item.type; 240 | const contentStr = 241 | (item as ImagePart).image || 242 | (item as FilePart).data; 243 | const contentPreview = String(contentStr).substring( 244 | 0, 245 | 60 246 | ); 247 | console.log( 248 | `│ ${i + 1}.${j + 1} ${typeStr}: ${contentPreview}${String(contentStr).length > 60 ? "..." : ""}` 249 | ); 250 | }); 251 | }); 252 | } 253 | 254 | console.log(`╰────────────────────────────────────────`); 255 | 256 | if (task.attachments && !Array.isArray(task.attachments)) { 257 | throw new Error( 258 | `Invalid attachments format at index ${index}` 259 | ); 260 | } 261 | }); 262 | 263 | return tasks; 264 | } catch (error) { 265 | console.error("\n❌ Error parsing 'planner' response:", error); 266 | console.log("Raw response:", response); 267 | throw new Error( 268 | `Failed to parse 'planner' response: ${error instanceof Error ? error.message : String(error)}` 269 | ); 270 | } 271 | } 272 | 273 | private async processActionItem(action: AgentAction) { 274 | console.log("\n📨 Processing action:", { 275 | type: action.type, 276 | from: action.from, 277 | to: action.to, 278 | }); 279 | 280 | if (action.metadata?.isTaskComplete) { 281 | switch (action.type) { 282 | case "complete": { 283 | console.log(`\n✅ Task completed by: '${action.from}'`); 284 | break; 285 | } 286 | case "response": { 287 | console.log( 288 | `\n☑️ Followup task completed by: '${action.from}'` 289 | ); 290 | break; 291 | } 292 | } 293 | this.context.push({ 294 | role: action.from, 295 | content: action.content, 296 | }); 297 | console.log("\n📝 Added to context"); 298 | 299 | return; 300 | } 301 | 302 | try { 303 | const targetAgent = this.getAgent(action.to); 304 | 305 | console.log("\n📦 Current context:", this.context.length); 306 | 307 | const relevantContext: string | null = 308 | (action.to === "router" 309 | ? action.type === "followup" 310 | ? this.context 311 | .map((ctx) => `${ctx.role}: ${ctx.content}`) 312 | .join("\n") 313 | : this.context 314 | .filter((ctx) => ctx.role !== "user") 315 | .map((ctx) => `${ctx.role}: ${ctx.content}`) 316 | .join("\n") 317 | : this.context 318 | .filter( 319 | (ctx) => 320 | (action.metadata?.dependencies || []).some( 321 | (dep) => dep.agentName === ctx.role 322 | ) || ctx.role === "user" 323 | ) 324 | .map((ctx) => `${ctx.role}: ${ctx.content}`) 325 | .join("\n")) || null; 326 | 327 | console.log(`\n🔍 Filtered relevant context for '${action.to}'`); 328 | console.log("\n📤 Sending information:", { 329 | relevantContext, 330 | content: action.content, 331 | }); 332 | console.log(`\n💭 '${action.to}' thinking...`); 333 | 334 | const messages: CoreMessage[] = []; 335 | 336 | if (action.to !== "router") { 337 | messages.push( 338 | systemMessage( 339 | `You have to: 340 | 1. Complete your task by providing an answer ONLY for the 'Current task' from the context. 341 | 2. If the answer in not in the context, try to avoid asking for more information. 342 | 3. If you ABSOLUTELY need additional information to complete your task, request more information by asking a question 343 | 344 | Instructions for responding: 345 | - If you need more information, start with "${ZEEActionResponseType.FOLLOWUP}" followed by your question 346 | - If this is your answer, start with "${ZEEActionResponseType.COMPLETE}" followed by your response.` 347 | ) 348 | ); 349 | } else if (action.type === "followup") { 350 | messages.push( 351 | systemMessage( 352 | `You're handling a followup question from an agent who needs more information to complete their task. 353 | 354 | ${action.metadata?.originalFrom ? `Question from: '${action.metadata.originalFrom}'` : ""} 355 | ${action.metadata?.originalTask ? `\nOriginal task: ${action.metadata.originalTask}` : ""} 356 | 357 | You have access to the COMPLETE context of all previous communications between agents. 358 | Use this full context to provide the most accurate and helpful answer. 359 | 360 | Your job is to provide a direct, helpful answer based on the complete context and your knowledge. 361 | Be specific and thorough in your response, as the agent is relying on your expertise. 362 | 363 | Start your response with "${ZEEActionResponseType.ANSWER}" followed by your answer. 364 | Example: "${ZEEActionResponseType.ANSWER} The script should use standard screenplay format." 365 | ` 366 | ) 367 | ); 368 | } 369 | 370 | messages.push( 371 | userMessage( 372 | `${relevantContext ? `Relevant context -> ${relevantContext}` : ""} 373 | \nCurrent task -> ${action.content}` 374 | ) 375 | ); 376 | 377 | if (action.metadata?.attachments?.length) { 378 | messages.push(...action.metadata.attachments.map(userMessage)); 379 | } 380 | 381 | const response = await targetAgent.generate({ messages }); 382 | 383 | const responseContent = response.value; 384 | 385 | this.processAgentResponse(responseContent, action); 386 | } catch (error) { 387 | console.error(`\n❌ Error processing action:`, error); 388 | 389 | if (error instanceof Error && error.message.includes("not found")) { 390 | console.error( 391 | `\n❌ Agent '${action.to}' not found. Available agents: ${Object.keys(this.agents).join(", ")}` 392 | ); 393 | 394 | if (action.type === "followup" && action.to !== "router") { 395 | console.log( 396 | `\n⚠️ Redirecting followup to router instead of invalid agent '${action.to}'` 397 | ); 398 | const redirectAction: AgentAction = { 399 | ...action, 400 | to: "router", 401 | content: `${action.content}\n\nNOTE: This was originally directed to '${action.to}' but that agent doesn't exist. Please handle this followup request.`, 402 | }; 403 | this.actionQueue.unshift(redirectAction); 404 | return; 405 | } 406 | } 407 | 408 | this.context.push({ 409 | role: "error", 410 | content: `Error in communication between ${action.from} -> ${action.to}: ${error instanceof Error ? error.message : String(error)}`, 411 | }); 412 | } 413 | } 414 | 415 | private processAgentResponse(responseContent: string, action: AgentAction) { 416 | // * INFO: 1. Agent needs more information 417 | if (responseContent.startsWith(ZEEActionResponseType.FOLLOWUP)) { 418 | const infoContent = responseContent 419 | .replace(ZEEActionResponseType.FOLLOWUP, "") 420 | .trim(); 421 | 422 | console.log(`\n╭────────────────────────────────────────`); 423 | console.log(`│ ❓ '${action.to}' asked a followup:`); 424 | console.log(`│ 🔍 "${infoContent}"`); 425 | console.log(`╰────────────────────────────────────────`); 426 | 427 | const dependencyInfo = action.metadata?.dependencies 428 | ? `\n\nContext: Agent has dependencies on: ${action.metadata.dependencies.map((d) => d.agentName).join(", ")}` 429 | : "\n\nContext: Agent has no explicit dependencies"; 430 | 431 | const enrichedContent = `${infoContent}${dependencyInfo}`; 432 | 433 | const infoResponse: AgentAction = { 434 | type: "followup", 435 | from: action.to!, 436 | to: "router", 437 | content: enrichedContent, 438 | metadata: { 439 | originalTask: action.content, 440 | originalFrom: action.from, 441 | }, 442 | }; 443 | 444 | this.actionQueue.unshift(infoResponse); 445 | 446 | console.log( 447 | `\n🔄 Followup chain: '${action.to}' → router → '${action.to}'` 448 | ); 449 | } 450 | 451 | // * INFO: 2. 'Router' providing an answer to a followup 452 | else if (action.to === "router" && action.type === "followup") { 453 | let answerContent = responseContent; 454 | 455 | if (!responseContent.startsWith(ZEEActionResponseType.ANSWER)) { 456 | console.log( 457 | `\n⚠️ 'Router' response missing ${ZEEActionResponseType.ANSWER} prefix, treating as direct answer` 458 | ); 459 | } else { 460 | answerContent = responseContent 461 | .replace(ZEEActionResponseType.ANSWER, "") 462 | .trim(); 463 | } 464 | 465 | console.log(`\n╭────────────────────────────────────────`); 466 | console.log(`│ 📝 'Router' answered:`); 467 | console.log( 468 | `│ 💬 "${answerContent.substring(0, 100)}${answerContent.length > 100 ? "..." : ""}"` 469 | ); 470 | console.log(`╰────────────────────────────────────────`); 471 | 472 | const answerResponse: AgentAction = { 473 | type: "response", 474 | from: "router", 475 | to: action.from, 476 | content: answerContent, 477 | metadata: { 478 | isTaskComplete: true, 479 | }, 480 | }; 481 | 482 | if ( 483 | action.metadata?.originalFrom && 484 | action.metadata?.originalTask 485 | ) { 486 | const originalQuestion = 487 | action.content?.split("\n\nContext:")?.[0]?.trim() || 488 | "details about characters"; 489 | 490 | const originalTask: AgentAction = { 491 | type: "request", 492 | from: "router", 493 | to: action.from, 494 | content: `${action.metadata.originalTask}\n\nYou previously asked: "${originalQuestion}"\n\nAnswer from router: ${answerContent}\n\nPlease complete your task with this information.`, 495 | metadata: { 496 | dependencies: action.metadata.dependencies, 497 | attachments: action.metadata.attachments, 498 | }, 499 | }; 500 | this.actionQueue.unshift(originalTask); 501 | } 502 | 503 | this.actionQueue.unshift(answerResponse); 504 | 505 | console.log(`\n🔄 Answer being sent: 'router' → '${action.from}'`); 506 | } 507 | 508 | // * INFO 3. Agent completed its task 509 | else if (responseContent.startsWith(ZEEActionResponseType.COMPLETE)) { 510 | const completeContent = responseContent 511 | .replace(ZEEActionResponseType.COMPLETE, "") 512 | .trim(); 513 | 514 | console.log(`\n╭────────────────────────────────────────`); 515 | console.log(`│ ✅ '${action.to}' completed task:`); 516 | console.log(`╰────────────────────────────────────────`); 517 | 518 | const completeAction: AgentAction = { 519 | type: "complete", 520 | from: action.to!, 521 | to: action.from, 522 | content: completeContent, 523 | metadata: { 524 | isTaskComplete: true, 525 | }, 526 | }; 527 | this.actionQueue.unshift(completeAction); 528 | } 529 | 530 | // * INFO 4. Handle unformatted responses gracefully 531 | else { 532 | console.log(`\n╭────────────────────────────────────────`); 533 | console.log( 534 | `│ ⚠️ Response from '${action.to}' doesn't use expected format:` 535 | ); 536 | console.log( 537 | `│ 🔍 "${responseContent.substring(0, 100)}${responseContent.length > 100 ? "..." : ""}"` 538 | ); 539 | console.log(`│ 📌 Treating as complete response`); 540 | console.log(`╰────────────────────────────────────────`); 541 | 542 | const completeAction: AgentAction = { 543 | type: "complete", 544 | from: action.to!, 545 | to: action.from, 546 | content: responseContent, 547 | metadata: { 548 | isTaskComplete: true, 549 | }, 550 | }; 551 | this.actionQueue.unshift(completeAction); 552 | } 553 | } 554 | 555 | public async run(): Promise { 556 | console.log("\n╭────────────────────────────────────────"); 557 | console.log("│ 🎬 Starting workflow execution"); 558 | console.log("╰────────────────────────────────────────"); 559 | 560 | console.log("\n📋 Getting tasks from 'planner'..."); 561 | const plannerResponse = await this.getAgent("planner").generate({ 562 | messages: [userMessage(this.goal)], 563 | }); 564 | 565 | const rawTasks = JSON.parse(plannerResponse.value) as RawTask[]; 566 | 567 | console.log("\n📋 Assigning agents to tasks via 'router'..."); 568 | const routerResponse = await this.getAgent("router").generate({ 569 | messages: [ 570 | systemMessage( 571 | `The available agents are: ${JSON.stringify( 572 | Object.values(this.addedAgents).map( 573 | ({ name, description, instructions }) => ({ 574 | name, 575 | description, 576 | instructions, 577 | }) 578 | ) 579 | )} 580 | For each task: 581 | 1. Analyze the task requirements 582 | 2. Select the most suitable agent based on their name, description, and instructions 583 | 3. Convert the dependencies from string[] to {agentName: string, task: string}[]: 584 | - For each dependency, determine which agent should handle it 585 | - Create objects with "agentName" and "task" fields instead of string dependencies 586 | 4. Return a JSON array where each item includes the original task data plus: 587 | - agentName: string (the name of the chosen agent) 588 | - dependencies: the restructured dependencies array with objects 589 | 5. Reorder the tasks based on the dependencies for easier processing 590 | 591 | IMPORTANT: Return ONLY the JSON array, no other text` 592 | ), 593 | userMessage(JSON.stringify(rawTasks)), 594 | ], 595 | }); 596 | 597 | const tasks = this.parseTasks(routerResponse.value); 598 | 599 | tasks.forEach((task) => { 600 | this.actionQueue.push({ 601 | type: "request", 602 | from: "router", 603 | to: task.agentName, 604 | content: task.instructions.join("\n"), 605 | metadata: { 606 | dependencies: task.dependencies, 607 | attachments: task.attachments, 608 | }, 609 | }); 610 | }); 611 | 612 | let iterationCount = 0; 613 | while ( 614 | this.actionQueue.length > 0 && 615 | iterationCount < this.maxIterations 616 | ) { 617 | if (iterationCount >= this.maxIterations) { 618 | console.warn("\n⚠️ Reached maximum iterations limit"); 619 | } 620 | 621 | iterationCount++; 622 | const nextAction = this.actionQueue[0]; 623 | 624 | console.log("\n╭────────────────────────────────────────"); 625 | console.log( 626 | `│ 🔄 ITERATION ${iterationCount} of max ${this.maxIterations}` 627 | ); 628 | console.log(`│ 📊 Queue size: ${this.actionQueue.length} actions`); 629 | console.log( 630 | `│ 📑 Next action: ${nextAction?.type} from '${nextAction?.from}' to '${nextAction?.to}'` 631 | ); 632 | console.log("╰────────────────────────────────────────"); 633 | 634 | const action = this.actionQueue.shift()!; 635 | 636 | try { 637 | await this.processActionItem(action); 638 | } catch (error) { 639 | console.error( 640 | `\n❌ Error processing action from ${action.from}:`, 641 | error 642 | ); 643 | this.context.push({ 644 | role: "error", 645 | content: `Error in communication between ${action.from} -> ${action.to}: ${error instanceof Error ? error.message : String(error)}`, 646 | }); 647 | } 648 | } 649 | 650 | if (iterationCount >= this.maxIterations) { 651 | console.warn("\n⚠️ Reached maximum iterations limit"); 652 | } else { 653 | console.log("\n╭────────────────────────────────────────"); 654 | console.log("│ ✨ All agents have completed their tasks"); 655 | console.log("╰────────────────────────────────────────"); 656 | } 657 | 658 | console.log("\n📋 Getting final compilation from endgame agent..."); 659 | const endgameResponse = await this.getAgent("endgame").generate({ 660 | messages: [userMessage(JSON.stringify(this.context))], 661 | }); 662 | 663 | console.log("\n╭────────────────────────────────────────"); 664 | console.log(`│ 🟢 Workflow completed in ${iterationCount} iterations!`); 665 | console.log("╰────────────────────────────────────────"); 666 | 667 | return { 668 | content: endgameResponse.value, 669 | context: this.context, 670 | }; 671 | } 672 | } 673 | -------------------------------------------------------------------------------- /packages/create-zee-app/templates/001-zee-barebones/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-zee-app-template", 3 | "version": "0.3.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "create-zee-app-template", 9 | "version": "0.3.0", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@covalenthq/ai-agent-sdk": "^0.3.0", 13 | "dotenv": "^16.4.7" 14 | }, 15 | "devDependencies": { 16 | "ts-node": "^10.9.2", 17 | "typescript": "^5.7.3" 18 | } 19 | }, 20 | "node_modules/@ai-sdk/anthropic": { 21 | "version": "1.1.11", 22 | "resolved": "https://registry.npmjs.org/@ai-sdk/anthropic/-/anthropic-1.1.11.tgz", 23 | "integrity": "sha512-FsjF+Qdy4c56dbXyUcec+UDOOnYayL1gd3Mysu1rSZ4RTAPuvsDewNJeSObqhJ7kMXnuHHLmDA5CcM4WvbSD/g==", 24 | "dependencies": { 25 | "@ai-sdk/provider": "1.0.9", 26 | "@ai-sdk/provider-utils": "2.1.10" 27 | }, 28 | "engines": { 29 | "node": ">=18" 30 | }, 31 | "peerDependencies": { 32 | "zod": "^3.0.0" 33 | } 34 | }, 35 | "node_modules/@ai-sdk/google": { 36 | "version": "1.1.17", 37 | "resolved": "https://registry.npmjs.org/@ai-sdk/google/-/google-1.1.17.tgz", 38 | "integrity": "sha512-LFdRO+BMUagDplhZExOSr0cfmnoeV1s/gxpIsqt/AWCYnqY/dYGT74nhjbQ+rILeoE8vwnwUu/7OOZexhccm9A==", 39 | "dependencies": { 40 | "@ai-sdk/provider": "1.0.9", 41 | "@ai-sdk/provider-utils": "2.1.10" 42 | }, 43 | "engines": { 44 | "node": ">=18" 45 | }, 46 | "peerDependencies": { 47 | "zod": "^3.0.0" 48 | } 49 | }, 50 | "node_modules/@ai-sdk/openai": { 51 | "version": "1.1.14", 52 | "resolved": "https://registry.npmjs.org/@ai-sdk/openai/-/openai-1.1.14.tgz", 53 | "integrity": "sha512-r5oD+Sz7z8kfxnXfqR53fYQ1xbT/BeUGhQ26FWzs5gO4j52pGUpzCt0SBm3SH1ZSjFY5O/zoKRnsbrPeBe1sNA==", 54 | "dependencies": { 55 | "@ai-sdk/provider": "1.0.9", 56 | "@ai-sdk/provider-utils": "2.1.10" 57 | }, 58 | "engines": { 59 | "node": ">=18" 60 | }, 61 | "peerDependencies": { 62 | "zod": "^3.0.0" 63 | } 64 | }, 65 | "node_modules/@ai-sdk/provider": { 66 | "version": "1.0.9", 67 | "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-1.0.9.tgz", 68 | "integrity": "sha512-jie6ZJT2ZR0uVOVCDc9R2xCX5I/Dum/wEK28lx21PJx6ZnFAN9EzD2WsPhcDWfCgGx3OAZZ0GyM3CEobXpa9LA==", 69 | "dependencies": { 70 | "json-schema": "^0.4.0" 71 | }, 72 | "engines": { 73 | "node": ">=18" 74 | } 75 | }, 76 | "node_modules/@ai-sdk/provider-utils": { 77 | "version": "2.1.10", 78 | "resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-2.1.10.tgz", 79 | "integrity": "sha512-4GZ8GHjOFxePFzkl3q42AU0DQOtTQ5w09vmaWUf/pKFXJPizlnzKSUkF0f+VkapIUfDugyMqPMT1ge8XQzVI7Q==", 80 | "dependencies": { 81 | "@ai-sdk/provider": "1.0.9", 82 | "eventsource-parser": "^3.0.0", 83 | "nanoid": "^3.3.8", 84 | "secure-json-parse": "^2.7.0" 85 | }, 86 | "engines": { 87 | "node": ">=18" 88 | }, 89 | "peerDependencies": { 90 | "zod": "^3.0.0" 91 | }, 92 | "peerDependenciesMeta": { 93 | "zod": { 94 | "optional": true 95 | } 96 | } 97 | }, 98 | "node_modules/@ai-sdk/react": { 99 | "version": "1.1.18", 100 | "resolved": "https://registry.npmjs.org/@ai-sdk/react/-/react-1.1.18.tgz", 101 | "integrity": "sha512-2wlWug6NVAc8zh3pgqtvwPkSNTdA6Q4x9CmrNXCeHcXfJkJ+MuHFQz/I7Wb7mLRajf0DAxsFLIhHyBCEuTkDNw==", 102 | "dependencies": { 103 | "@ai-sdk/provider-utils": "2.1.10", 104 | "@ai-sdk/ui-utils": "1.1.16", 105 | "swr": "^2.2.5", 106 | "throttleit": "2.1.0" 107 | }, 108 | "engines": { 109 | "node": ">=18" 110 | }, 111 | "peerDependencies": { 112 | "react": "^18 || ^19 || ^19.0.0-rc", 113 | "zod": "^3.0.0" 114 | }, 115 | "peerDependenciesMeta": { 116 | "react": { 117 | "optional": true 118 | }, 119 | "zod": { 120 | "optional": true 121 | } 122 | } 123 | }, 124 | "node_modules/@ai-sdk/ui-utils": { 125 | "version": "1.1.16", 126 | "resolved": "https://registry.npmjs.org/@ai-sdk/ui-utils/-/ui-utils-1.1.16.tgz", 127 | "integrity": "sha512-jfblR2yZVISmNK2zyNzJZFtkgX57WDAUQXcmn3XUBJyo8LFsADu+/vYMn5AOyBi9qJT0RBk11PEtIxIqvByw3Q==", 128 | "dependencies": { 129 | "@ai-sdk/provider": "1.0.9", 130 | "@ai-sdk/provider-utils": "2.1.10", 131 | "zod-to-json-schema": "^3.24.1" 132 | }, 133 | "engines": { 134 | "node": ">=18" 135 | }, 136 | "peerDependencies": { 137 | "zod": "^3.0.0" 138 | }, 139 | "peerDependenciesMeta": { 140 | "zod": { 141 | "optional": true 142 | } 143 | } 144 | }, 145 | "node_modules/@covalenthq/ai-agent-sdk": { 146 | "version": "0.3.0", 147 | "resolved": "https://registry.npmjs.org/@covalenthq/ai-agent-sdk/-/ai-agent-sdk-0.3.0.tgz", 148 | "integrity": "sha512-HN5ru9EZMkJ1Y+4bTetUlPKsXLrlG6HZVQCJJw7lvGk5SEPEXBallc2Y5e3xeBjmzLD+edHUIgXlOofBDBaWTA==", 149 | "dependencies": { 150 | "@ai-sdk/anthropic": "^1.1.6", 151 | "@ai-sdk/google": "^1.1.11", 152 | "@ai-sdk/openai": "^1.1.9", 153 | "@covalenthq/client-sdk": "^2.2.3", 154 | "ai": "^4.1.41", 155 | "commander": "^13.1.0", 156 | "dotenv": "^16.4.7", 157 | "openai": "^4.79.1", 158 | "pino": "^9.6.0", 159 | "pino-pretty": "^13.0.0", 160 | "typescript": "^5.7.3", 161 | "zod": "^3.24.1", 162 | "zod-to-json-schema": "^3.24.1" 163 | } 164 | }, 165 | "node_modules/@covalenthq/client-sdk": { 166 | "version": "2.2.3", 167 | "resolved": "https://registry.npmjs.org/@covalenthq/client-sdk/-/client-sdk-2.2.3.tgz", 168 | "integrity": "sha512-FwvlYpx5+Cr2f2aNNtfE8VYRn5Fr8I8SdY1Oq37tm5NSam0am8r1+zeC0Y2LVs9N/2vKJHoeOA+ivwf/uE6XSQ==", 169 | "license": "Apache-2.0", 170 | "dependencies": { 171 | "big.js": "^6.2.1" 172 | } 173 | }, 174 | "node_modules/@cspotcode/source-map-support": { 175 | "version": "0.8.1", 176 | "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", 177 | "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", 178 | "dev": true, 179 | "license": "MIT", 180 | "dependencies": { 181 | "@jridgewell/trace-mapping": "0.3.9" 182 | }, 183 | "engines": { 184 | "node": ">=12" 185 | } 186 | }, 187 | "node_modules/@jridgewell/resolve-uri": { 188 | "version": "3.1.2", 189 | "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", 190 | "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", 191 | "dev": true, 192 | "license": "MIT", 193 | "engines": { 194 | "node": ">=6.0.0" 195 | } 196 | }, 197 | "node_modules/@jridgewell/sourcemap-codec": { 198 | "version": "1.5.0", 199 | "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", 200 | "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", 201 | "dev": true, 202 | "license": "MIT" 203 | }, 204 | "node_modules/@jridgewell/trace-mapping": { 205 | "version": "0.3.9", 206 | "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", 207 | "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", 208 | "dev": true, 209 | "license": "MIT", 210 | "dependencies": { 211 | "@jridgewell/resolve-uri": "^3.0.3", 212 | "@jridgewell/sourcemap-codec": "^1.4.10" 213 | } 214 | }, 215 | "node_modules/@opentelemetry/api": { 216 | "version": "1.9.0", 217 | "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", 218 | "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==", 219 | "engines": { 220 | "node": ">=8.0.0" 221 | } 222 | }, 223 | "node_modules/@tsconfig/node10": { 224 | "version": "1.0.11", 225 | "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", 226 | "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", 227 | "dev": true, 228 | "license": "MIT" 229 | }, 230 | "node_modules/@tsconfig/node12": { 231 | "version": "1.0.11", 232 | "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", 233 | "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", 234 | "dev": true, 235 | "license": "MIT" 236 | }, 237 | "node_modules/@tsconfig/node14": { 238 | "version": "1.0.3", 239 | "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", 240 | "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", 241 | "dev": true, 242 | "license": "MIT" 243 | }, 244 | "node_modules/@tsconfig/node16": { 245 | "version": "1.0.4", 246 | "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", 247 | "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", 248 | "dev": true, 249 | "license": "MIT" 250 | }, 251 | "node_modules/@types/diff-match-patch": { 252 | "version": "1.0.36", 253 | "resolved": "https://registry.npmjs.org/@types/diff-match-patch/-/diff-match-patch-1.0.36.tgz", 254 | "integrity": "sha512-xFdR6tkm0MWvBfO8xXCSsinYxHcqkQUlcHeSpMC2ukzOb6lwQAfDmW+Qt0AvlGd8HpsS28qKsB+oPeJn9I39jg==" 255 | }, 256 | "node_modules/@types/node": { 257 | "version": "22.10.9", 258 | "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.9.tgz", 259 | "integrity": "sha512-Ir6hwgsKyNESl/gLOcEz3krR4CBGgliDqBQ2ma4wIhEx0w+xnoeTq3tdrNw15kU3SxogDjOgv9sqdtLW8mIHaw==", 260 | "license": "MIT", 261 | "dependencies": { 262 | "undici-types": "~6.20.0" 263 | } 264 | }, 265 | "node_modules/@types/node-fetch": { 266 | "version": "2.6.12", 267 | "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.12.tgz", 268 | "integrity": "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==", 269 | "license": "MIT", 270 | "dependencies": { 271 | "@types/node": "*", 272 | "form-data": "^4.0.0" 273 | } 274 | }, 275 | "node_modules/abort-controller": { 276 | "version": "3.0.0", 277 | "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", 278 | "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", 279 | "license": "MIT", 280 | "dependencies": { 281 | "event-target-shim": "^5.0.0" 282 | }, 283 | "engines": { 284 | "node": ">=6.5" 285 | } 286 | }, 287 | "node_modules/acorn": { 288 | "version": "8.14.0", 289 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", 290 | "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", 291 | "dev": true, 292 | "license": "MIT", 293 | "bin": { 294 | "acorn": "bin/acorn" 295 | }, 296 | "engines": { 297 | "node": ">=0.4.0" 298 | } 299 | }, 300 | "node_modules/acorn-walk": { 301 | "version": "8.3.4", 302 | "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", 303 | "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", 304 | "dev": true, 305 | "license": "MIT", 306 | "dependencies": { 307 | "acorn": "^8.11.0" 308 | }, 309 | "engines": { 310 | "node": ">=0.4.0" 311 | } 312 | }, 313 | "node_modules/agentkeepalive": { 314 | "version": "4.6.0", 315 | "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.6.0.tgz", 316 | "integrity": "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==", 317 | "license": "MIT", 318 | "dependencies": { 319 | "humanize-ms": "^1.2.1" 320 | }, 321 | "engines": { 322 | "node": ">= 8.0.0" 323 | } 324 | }, 325 | "node_modules/ai": { 326 | "version": "4.1.46", 327 | "resolved": "https://registry.npmjs.org/ai/-/ai-4.1.46.tgz", 328 | "integrity": "sha512-VTvAktT69IN1qcNAv7OlcOuR0q4HqUlhkVacrWmMlEoprYykF9EL5RY8IECD5d036Wqg0walwbSKZlA2noHm1A==", 329 | "dependencies": { 330 | "@ai-sdk/provider": "1.0.9", 331 | "@ai-sdk/provider-utils": "2.1.10", 332 | "@ai-sdk/react": "1.1.18", 333 | "@ai-sdk/ui-utils": "1.1.16", 334 | "@opentelemetry/api": "1.9.0", 335 | "jsondiffpatch": "0.6.0" 336 | }, 337 | "engines": { 338 | "node": ">=18" 339 | }, 340 | "peerDependencies": { 341 | "react": "^18 || ^19 || ^19.0.0-rc", 342 | "zod": "^3.0.0" 343 | }, 344 | "peerDependenciesMeta": { 345 | "react": { 346 | "optional": true 347 | }, 348 | "zod": { 349 | "optional": true 350 | } 351 | } 352 | }, 353 | "node_modules/arg": { 354 | "version": "4.1.3", 355 | "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", 356 | "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", 357 | "dev": true, 358 | "license": "MIT" 359 | }, 360 | "node_modules/asynckit": { 361 | "version": "0.4.0", 362 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 363 | "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", 364 | "license": "MIT" 365 | }, 366 | "node_modules/atomic-sleep": { 367 | "version": "1.0.0", 368 | "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", 369 | "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", 370 | "license": "MIT", 371 | "engines": { 372 | "node": ">=8.0.0" 373 | } 374 | }, 375 | "node_modules/big.js": { 376 | "version": "6.2.2", 377 | "resolved": "https://registry.npmjs.org/big.js/-/big.js-6.2.2.tgz", 378 | "integrity": "sha512-y/ie+Faknx7sZA5MfGA2xKlu0GDv8RWrXGsmlteyJQ2lvoKv9GBK/fpRMc2qlSoBAgNxrixICFCBefIq8WCQpQ==", 379 | "license": "MIT", 380 | "engines": { 381 | "node": "*" 382 | }, 383 | "funding": { 384 | "type": "opencollective", 385 | "url": "https://opencollective.com/bigjs" 386 | } 387 | }, 388 | "node_modules/chalk": { 389 | "version": "5.4.1", 390 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", 391 | "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", 392 | "engines": { 393 | "node": "^12.17.0 || ^14.13 || >=16.0.0" 394 | }, 395 | "funding": { 396 | "url": "https://github.com/chalk/chalk?sponsor=1" 397 | } 398 | }, 399 | "node_modules/colorette": { 400 | "version": "2.0.20", 401 | "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", 402 | "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", 403 | "license": "MIT" 404 | }, 405 | "node_modules/combined-stream": { 406 | "version": "1.0.8", 407 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 408 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 409 | "license": "MIT", 410 | "dependencies": { 411 | "delayed-stream": "~1.0.0" 412 | }, 413 | "engines": { 414 | "node": ">= 0.8" 415 | } 416 | }, 417 | "node_modules/commander": { 418 | "version": "13.1.0", 419 | "resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz", 420 | "integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==", 421 | "license": "MIT", 422 | "engines": { 423 | "node": ">=18" 424 | } 425 | }, 426 | "node_modules/create-require": { 427 | "version": "1.1.1", 428 | "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", 429 | "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", 430 | "dev": true, 431 | "license": "MIT" 432 | }, 433 | "node_modules/dateformat": { 434 | "version": "4.6.3", 435 | "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", 436 | "integrity": "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==", 437 | "license": "MIT", 438 | "engines": { 439 | "node": "*" 440 | } 441 | }, 442 | "node_modules/delayed-stream": { 443 | "version": "1.0.0", 444 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 445 | "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", 446 | "license": "MIT", 447 | "engines": { 448 | "node": ">=0.4.0" 449 | } 450 | }, 451 | "node_modules/dequal": { 452 | "version": "2.0.3", 453 | "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", 454 | "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", 455 | "engines": { 456 | "node": ">=6" 457 | } 458 | }, 459 | "node_modules/diff": { 460 | "version": "4.0.2", 461 | "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", 462 | "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", 463 | "dev": true, 464 | "license": "BSD-3-Clause", 465 | "engines": { 466 | "node": ">=0.3.1" 467 | } 468 | }, 469 | "node_modules/diff-match-patch": { 470 | "version": "1.0.5", 471 | "resolved": "https://registry.npmjs.org/diff-match-patch/-/diff-match-patch-1.0.5.tgz", 472 | "integrity": "sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==" 473 | }, 474 | "node_modules/dotenv": { 475 | "version": "16.4.7", 476 | "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", 477 | "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", 478 | "engines": { 479 | "node": ">=12" 480 | }, 481 | "funding": { 482 | "url": "https://dotenvx.com" 483 | } 484 | }, 485 | "node_modules/end-of-stream": { 486 | "version": "1.4.4", 487 | "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", 488 | "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", 489 | "license": "MIT", 490 | "dependencies": { 491 | "once": "^1.4.0" 492 | } 493 | }, 494 | "node_modules/event-target-shim": { 495 | "version": "5.0.1", 496 | "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", 497 | "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", 498 | "license": "MIT", 499 | "engines": { 500 | "node": ">=6" 501 | } 502 | }, 503 | "node_modules/eventsource-parser": { 504 | "version": "3.0.0", 505 | "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.0.0.tgz", 506 | "integrity": "sha512-T1C0XCUimhxVQzW4zFipdx0SficT651NnkR0ZSH3yQwh+mFMdLfgjABVi4YtMTtaL4s168593DaoaRLMqryavA==", 507 | "engines": { 508 | "node": ">=18.0.0" 509 | } 510 | }, 511 | "node_modules/es-set-tostringtag": { 512 | "version": "2.1.0", 513 | "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", 514 | "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", 515 | "license": "MIT", 516 | "engines": { 517 | "node": ">= 0.4" 518 | } 519 | }, 520 | "node_modules/fast-copy": { 521 | "version": "3.0.2", 522 | "resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-3.0.2.tgz", 523 | "integrity": "sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ==", 524 | "license": "MIT" 525 | }, 526 | "node_modules/fast-redact": { 527 | "version": "3.5.0", 528 | "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.5.0.tgz", 529 | "integrity": "sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A==", 530 | "license": "MIT", 531 | "engines": { 532 | "node": ">=6" 533 | } 534 | }, 535 | "node_modules/fast-safe-stringify": { 536 | "version": "2.1.1", 537 | "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", 538 | "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", 539 | "license": "MIT" 540 | }, 541 | "node_modules/form-data": { 542 | "version": "4.0.5", 543 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", 544 | "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", 545 | "license": "MIT", 546 | "dependencies": { 547 | "asynckit": "^0.4.0", 548 | "combined-stream": "^1.0.8", 549 | "es-set-tostringtag": "^2.1.0", 550 | "hasown": "^2.0.2", 551 | "mime-types": "^2.1.12" 552 | }, 553 | "engines": { 554 | "node": ">= 6" 555 | } 556 | }, 557 | "node_modules/form-data-encoder": { 558 | "version": "1.7.2", 559 | "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", 560 | "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==", 561 | "license": "MIT" 562 | }, 563 | "node_modules/hasown": { 564 | "version": "2.0.2", 565 | "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", 566 | "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", 567 | "license": "MIT", 568 | "engines": { 569 | "node": ">= 0.4" 570 | } 571 | }, 572 | "node_modules/formdata-node": { 573 | "version": "4.4.1", 574 | "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", 575 | "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", 576 | "license": "MIT", 577 | "dependencies": { 578 | "node-domexception": "1.0.0", 579 | "web-streams-polyfill": "4.0.0-beta.3" 580 | }, 581 | "engines": { 582 | "node": ">= 12.20" 583 | } 584 | }, 585 | "node_modules/help-me": { 586 | "version": "5.0.0", 587 | "resolved": "https://registry.npmjs.org/help-me/-/help-me-5.0.0.tgz", 588 | "integrity": "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==", 589 | "license": "MIT" 590 | }, 591 | "node_modules/humanize-ms": { 592 | "version": "1.2.1", 593 | "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", 594 | "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", 595 | "license": "MIT", 596 | "dependencies": { 597 | "ms": "^2.0.0" 598 | } 599 | }, 600 | "node_modules/joycon": { 601 | "version": "3.1.1", 602 | "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", 603 | "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", 604 | "license": "MIT", 605 | "engines": { 606 | "node": ">=10" 607 | } 608 | }, 609 | "node_modules/json-schema": { 610 | "version": "0.4.0", 611 | "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", 612 | "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" 613 | }, 614 | "node_modules/jsondiffpatch": { 615 | "version": "0.6.0", 616 | "resolved": "https://registry.npmjs.org/jsondiffpatch/-/jsondiffpatch-0.6.0.tgz", 617 | "integrity": "sha512-3QItJOXp2AP1uv7waBkao5nCvhEv+QmJAd38Ybq7wNI74Q+BBmnLn4EDKz6yI9xGAIQoUF87qHt+kc1IVxB4zQ==", 618 | "dependencies": { 619 | "@types/diff-match-patch": "^1.0.36", 620 | "chalk": "^5.3.0", 621 | "diff-match-patch": "^1.0.5" 622 | }, 623 | "bin": { 624 | "jsondiffpatch": "bin/jsondiffpatch.js" 625 | }, 626 | "engines": { 627 | "node": "^18.0.0 || >=20.0.0" 628 | } 629 | }, 630 | "node_modules/make-error": { 631 | "version": "1.3.6", 632 | "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", 633 | "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", 634 | "dev": true, 635 | "license": "ISC" 636 | }, 637 | "node_modules/mime-db": { 638 | "version": "1.52.0", 639 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", 640 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", 641 | "license": "MIT", 642 | "engines": { 643 | "node": ">= 0.6" 644 | } 645 | }, 646 | "node_modules/mime-types": { 647 | "version": "2.1.35", 648 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", 649 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", 650 | "license": "MIT", 651 | "dependencies": { 652 | "mime-db": "1.52.0" 653 | }, 654 | "engines": { 655 | "node": ">= 0.6" 656 | } 657 | }, 658 | "node_modules/minimist": { 659 | "version": "1.2.8", 660 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", 661 | "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", 662 | "license": "MIT", 663 | "funding": { 664 | "url": "https://github.com/sponsors/ljharb" 665 | } 666 | }, 667 | "node_modules/ms": { 668 | "version": "2.1.3", 669 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 670 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", 671 | "license": "MIT" 672 | }, 673 | "node_modules/nanoid": { 674 | "version": "3.3.8", 675 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", 676 | "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", 677 | "funding": [ 678 | { 679 | "type": "github", 680 | "url": "https://github.com/sponsors/ai" 681 | } 682 | ], 683 | "bin": { 684 | "nanoid": "bin/nanoid.cjs" 685 | }, 686 | "engines": { 687 | "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" 688 | } 689 | }, 690 | "node_modules/node-domexception": { 691 | "version": "1.0.0", 692 | "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", 693 | "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", 694 | "funding": [ 695 | { 696 | "type": "github", 697 | "url": "https://github.com/sponsors/jimmywarting" 698 | }, 699 | { 700 | "type": "github", 701 | "url": "https://paypal.me/jimmywarting" 702 | } 703 | ], 704 | "license": "MIT", 705 | "engines": { 706 | "node": ">=10.5.0" 707 | } 708 | }, 709 | "node_modules/node-fetch": { 710 | "version": "2.7.0", 711 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", 712 | "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", 713 | "license": "MIT", 714 | "dependencies": { 715 | "whatwg-url": "^5.0.0" 716 | }, 717 | "engines": { 718 | "node": "4.x || >=6.0.0" 719 | }, 720 | "peerDependencies": { 721 | "encoding": "^0.1.0" 722 | }, 723 | "peerDependenciesMeta": { 724 | "encoding": { 725 | "optional": true 726 | } 727 | } 728 | }, 729 | "node_modules/on-exit-leak-free": { 730 | "version": "2.1.2", 731 | "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz", 732 | "integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==", 733 | "license": "MIT", 734 | "engines": { 735 | "node": ">=14.0.0" 736 | } 737 | }, 738 | "node_modules/once": { 739 | "version": "1.4.0", 740 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 741 | "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", 742 | "license": "ISC", 743 | "dependencies": { 744 | "wrappy": "1" 745 | } 746 | }, 747 | "node_modules/openai": { 748 | "version": "4.83.0", 749 | "resolved": "https://registry.npmjs.org/openai/-/openai-4.83.0.tgz", 750 | "integrity": "sha512-fmTsqud0uTtRKsPC7L8Lu55dkaTwYucqncDHzVvO64DKOpNTuiYwjbR/nVgpapXuYy8xSnhQQPUm+3jQaxICgw==", 751 | "license": "Apache-2.0", 752 | "dependencies": { 753 | "@types/node": "^18.11.18", 754 | "@types/node-fetch": "^2.6.4", 755 | "abort-controller": "^3.0.0", 756 | "agentkeepalive": "^4.2.1", 757 | "form-data-encoder": "1.7.2", 758 | "formdata-node": "^4.3.2", 759 | "node-fetch": "^2.6.7" 760 | }, 761 | "bin": { 762 | "openai": "bin/cli" 763 | }, 764 | "peerDependencies": { 765 | "ws": "^8.18.0", 766 | "zod": "^3.23.8" 767 | }, 768 | "peerDependenciesMeta": { 769 | "ws": { 770 | "optional": true 771 | }, 772 | "zod": { 773 | "optional": true 774 | } 775 | } 776 | }, 777 | "node_modules/openai/node_modules/@types/node": { 778 | "version": "18.19.75", 779 | "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.75.tgz", 780 | "integrity": "sha512-UIksWtThob6ZVSyxcOqCLOUNg/dyO1Qvx4McgeuhrEtHTLFTf7BBhEazaE4K806FGTPtzd/2sE90qn4fVr7cyw==", 781 | "license": "MIT", 782 | "dependencies": { 783 | "undici-types": "~5.26.4" 784 | } 785 | }, 786 | "node_modules/openai/node_modules/undici-types": { 787 | "version": "5.26.5", 788 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 789 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 790 | "license": "MIT" 791 | }, 792 | "node_modules/pino": { 793 | "version": "9.6.0", 794 | "resolved": "https://registry.npmjs.org/pino/-/pino-9.6.0.tgz", 795 | "integrity": "sha512-i85pKRCt4qMjZ1+L7sy2Ag4t1atFcdbEt76+7iRJn1g2BvsnRMGu9p8pivl9fs63M2kF/A0OacFZhTub+m/qMg==", 796 | "license": "MIT", 797 | "dependencies": { 798 | "atomic-sleep": "^1.0.0", 799 | "fast-redact": "^3.1.1", 800 | "on-exit-leak-free": "^2.1.0", 801 | "pino-abstract-transport": "^2.0.0", 802 | "pino-std-serializers": "^7.0.0", 803 | "process-warning": "^4.0.0", 804 | "quick-format-unescaped": "^4.0.3", 805 | "real-require": "^0.2.0", 806 | "safe-stable-stringify": "^2.3.1", 807 | "sonic-boom": "^4.0.1", 808 | "thread-stream": "^3.0.0" 809 | }, 810 | "bin": { 811 | "pino": "bin.js" 812 | } 813 | }, 814 | "node_modules/pino-abstract-transport": { 815 | "version": "2.0.0", 816 | "resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-2.0.0.tgz", 817 | "integrity": "sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw==", 818 | "license": "MIT", 819 | "dependencies": { 820 | "split2": "^4.0.0" 821 | } 822 | }, 823 | "node_modules/pino-pretty": { 824 | "version": "13.0.0", 825 | "resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-13.0.0.tgz", 826 | "integrity": "sha512-cQBBIVG3YajgoUjo1FdKVRX6t9XPxwB9lcNJVD5GCnNM4Y6T12YYx8c6zEejxQsU0wrg9TwmDulcE9LR7qcJqA==", 827 | "license": "MIT", 828 | "dependencies": { 829 | "colorette": "^2.0.7", 830 | "dateformat": "^4.6.3", 831 | "fast-copy": "^3.0.2", 832 | "fast-safe-stringify": "^2.1.1", 833 | "help-me": "^5.0.0", 834 | "joycon": "^3.1.1", 835 | "minimist": "^1.2.6", 836 | "on-exit-leak-free": "^2.1.0", 837 | "pino-abstract-transport": "^2.0.0", 838 | "pump": "^3.0.0", 839 | "secure-json-parse": "^2.4.0", 840 | "sonic-boom": "^4.0.1", 841 | "strip-json-comments": "^3.1.1" 842 | }, 843 | "bin": { 844 | "pino-pretty": "bin.js" 845 | } 846 | }, 847 | "node_modules/pino-std-serializers": { 848 | "version": "7.0.0", 849 | "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.0.0.tgz", 850 | "integrity": "sha512-e906FRY0+tV27iq4juKzSYPbUj2do2X2JX4EzSca1631EB2QJQUqGbDuERal7LCtOpxl6x3+nvo9NPZcmjkiFA==", 851 | "license": "MIT" 852 | }, 853 | "node_modules/process-warning": { 854 | "version": "4.0.1", 855 | "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-4.0.1.tgz", 856 | "integrity": "sha512-3c2LzQ3rY9d0hc1emcsHhfT9Jwz0cChib/QN89oME2R451w5fy3f0afAhERFZAwrbDU43wk12d0ORBpDVME50Q==", 857 | "funding": [ 858 | { 859 | "type": "github", 860 | "url": "https://github.com/sponsors/fastify" 861 | }, 862 | { 863 | "type": "opencollective", 864 | "url": "https://opencollective.com/fastify" 865 | } 866 | ], 867 | "license": "MIT" 868 | }, 869 | "node_modules/pump": { 870 | "version": "3.0.2", 871 | "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz", 872 | "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", 873 | "license": "MIT", 874 | "dependencies": { 875 | "end-of-stream": "^1.1.0", 876 | "once": "^1.3.1" 877 | } 878 | }, 879 | "node_modules/quick-format-unescaped": { 880 | "version": "4.0.4", 881 | "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", 882 | "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==", 883 | "license": "MIT" 884 | }, 885 | "node_modules/react": { 886 | "version": "19.0.0", 887 | "resolved": "https://registry.npmjs.org/react/-/react-19.0.0.tgz", 888 | "integrity": "sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==", 889 | "peer": true, 890 | "engines": { 891 | "node": ">=0.10.0" 892 | } 893 | }, 894 | "node_modules/real-require": { 895 | "version": "0.2.0", 896 | "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz", 897 | "integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==", 898 | "license": "MIT", 899 | "engines": { 900 | "node": ">= 12.13.0" 901 | } 902 | }, 903 | "node_modules/safe-stable-stringify": { 904 | "version": "2.5.0", 905 | "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", 906 | "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", 907 | "license": "MIT", 908 | "engines": { 909 | "node": ">=10" 910 | } 911 | }, 912 | "node_modules/secure-json-parse": { 913 | "version": "2.7.0", 914 | "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz", 915 | "integrity": "sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==", 916 | "license": "BSD-3-Clause" 917 | }, 918 | "node_modules/sonic-boom": { 919 | "version": "4.2.0", 920 | "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.0.tgz", 921 | "integrity": "sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww==", 922 | "license": "MIT", 923 | "dependencies": { 924 | "atomic-sleep": "^1.0.0" 925 | } 926 | }, 927 | "node_modules/split2": { 928 | "version": "4.2.0", 929 | "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", 930 | "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", 931 | "license": "ISC", 932 | "engines": { 933 | "node": ">= 10.x" 934 | } 935 | }, 936 | "node_modules/strip-json-comments": { 937 | "version": "3.1.1", 938 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", 939 | "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", 940 | "license": "MIT", 941 | "engines": { 942 | "node": ">=8" 943 | }, 944 | "funding": { 945 | "url": "https://github.com/sponsors/sindresorhus" 946 | } 947 | }, 948 | "node_modules/swr": { 949 | "version": "2.3.2", 950 | "resolved": "https://registry.npmjs.org/swr/-/swr-2.3.2.tgz", 951 | "integrity": "sha512-RosxFpiabojs75IwQ316DGoDRmOqtiAj0tg8wCcbEu4CiLZBs/a9QNtHV7TUfDXmmlgqij/NqzKq/eLelyv9xA==", 952 | "dependencies": { 953 | "dequal": "^2.0.3", 954 | "use-sync-external-store": "^1.4.0" 955 | }, 956 | "peerDependencies": { 957 | "react": "^16.11.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" 958 | } 959 | }, 960 | "node_modules/thread-stream": { 961 | "version": "3.1.0", 962 | "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-3.1.0.tgz", 963 | "integrity": "sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==", 964 | "license": "MIT", 965 | "dependencies": { 966 | "real-require": "^0.2.0" 967 | } 968 | }, 969 | "node_modules/throttleit": { 970 | "version": "2.1.0", 971 | "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-2.1.0.tgz", 972 | "integrity": "sha512-nt6AMGKW1p/70DF/hGBdJB57B8Tspmbp5gfJ8ilhLnt7kkr2ye7hzD6NVG8GGErk2HWF34igrL2CXmNIkzKqKw==", 973 | "engines": { 974 | "node": ">=18" 975 | }, 976 | "funding": { 977 | "url": "https://github.com/sponsors/sindresorhus" 978 | } 979 | }, 980 | "node_modules/tr46": { 981 | "version": "0.0.3", 982 | "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", 983 | "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", 984 | "license": "MIT" 985 | }, 986 | "node_modules/ts-node": { 987 | "version": "10.9.2", 988 | "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", 989 | "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", 990 | "dev": true, 991 | "license": "MIT", 992 | "dependencies": { 993 | "@cspotcode/source-map-support": "^0.8.0", 994 | "@tsconfig/node10": "^1.0.7", 995 | "@tsconfig/node12": "^1.0.7", 996 | "@tsconfig/node14": "^1.0.0", 997 | "@tsconfig/node16": "^1.0.2", 998 | "acorn": "^8.4.1", 999 | "acorn-walk": "^8.1.1", 1000 | "arg": "^4.1.0", 1001 | "create-require": "^1.1.0", 1002 | "diff": "^4.0.1", 1003 | "make-error": "^1.1.1", 1004 | "v8-compile-cache-lib": "^3.0.1", 1005 | "yn": "3.1.1" 1006 | }, 1007 | "bin": { 1008 | "ts-node": "dist/bin.js", 1009 | "ts-node-cwd": "dist/bin-cwd.js", 1010 | "ts-node-esm": "dist/bin-esm.js", 1011 | "ts-node-script": "dist/bin-script.js", 1012 | "ts-node-transpile-only": "dist/bin-transpile.js", 1013 | "ts-script": "dist/bin-script-deprecated.js" 1014 | }, 1015 | "peerDependencies": { 1016 | "@swc/core": ">=1.2.50", 1017 | "@swc/wasm": ">=1.2.50", 1018 | "@types/node": "*", 1019 | "typescript": ">=2.7" 1020 | }, 1021 | "peerDependenciesMeta": { 1022 | "@swc/core": { 1023 | "optional": true 1024 | }, 1025 | "@swc/wasm": { 1026 | "optional": true 1027 | } 1028 | } 1029 | }, 1030 | "node_modules/typescript": { 1031 | "version": "5.7.3", 1032 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", 1033 | "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", 1034 | "license": "Apache-2.0", 1035 | "bin": { 1036 | "tsc": "bin/tsc", 1037 | "tsserver": "bin/tsserver" 1038 | }, 1039 | "engines": { 1040 | "node": ">=14.17" 1041 | } 1042 | }, 1043 | "node_modules/undici-types": { 1044 | "version": "6.20.0", 1045 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", 1046 | "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", 1047 | "license": "MIT" 1048 | }, 1049 | "node_modules/use-sync-external-store": { 1050 | "version": "1.4.0", 1051 | "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.4.0.tgz", 1052 | "integrity": "sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw==", 1053 | "peerDependencies": { 1054 | "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" 1055 | } 1056 | }, 1057 | "node_modules/v8-compile-cache-lib": { 1058 | "version": "3.0.1", 1059 | "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", 1060 | "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", 1061 | "dev": true, 1062 | "license": "MIT" 1063 | }, 1064 | "node_modules/web-streams-polyfill": { 1065 | "version": "4.0.0-beta.3", 1066 | "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", 1067 | "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", 1068 | "license": "MIT", 1069 | "engines": { 1070 | "node": ">= 14" 1071 | } 1072 | }, 1073 | "node_modules/webidl-conversions": { 1074 | "version": "3.0.1", 1075 | "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", 1076 | "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", 1077 | "license": "BSD-2-Clause" 1078 | }, 1079 | "node_modules/whatwg-url": { 1080 | "version": "5.0.0", 1081 | "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", 1082 | "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", 1083 | "license": "MIT", 1084 | "dependencies": { 1085 | "tr46": "~0.0.3", 1086 | "webidl-conversions": "^3.0.0" 1087 | } 1088 | }, 1089 | "node_modules/wrappy": { 1090 | "version": "1.0.2", 1091 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 1092 | "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", 1093 | "license": "ISC" 1094 | }, 1095 | "node_modules/yn": { 1096 | "version": "3.1.1", 1097 | "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", 1098 | "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", 1099 | "dev": true, 1100 | "license": "MIT", 1101 | "engines": { 1102 | "node": ">=6" 1103 | } 1104 | }, 1105 | "node_modules/zod": { 1106 | "version": "3.24.1", 1107 | "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.1.tgz", 1108 | "integrity": "sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==", 1109 | "license": "MIT", 1110 | "funding": { 1111 | "url": "https://github.com/sponsors/colinhacks" 1112 | } 1113 | }, 1114 | "node_modules/zod-to-json-schema": { 1115 | "version": "3.24.1", 1116 | "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.1.tgz", 1117 | "integrity": "sha512-3h08nf3Vw3Wl3PK+q3ow/lIil81IT2Oa7YpQyUUDsEWbXveMesdfK1xBd2RhCkynwZndAxixji/7SYJJowr62w==", 1118 | "license": "ISC", 1119 | "peerDependencies": { 1120 | "zod": "^3.24.1" 1121 | } 1122 | } 1123 | } 1124 | } 1125 | --------------------------------------------------------------------------------