├── .babelrc ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── doc_issue.md │ ├── feature_request.md │ └── websiteAgenticJS_bug_report.md └── workflows │ ├── ci-cli-tests-windows.yml │ ├── ci-cli-tests.yml │ ├── ci-environment-tests.yml │ ├── pr-validation-workflow.yml │ ├── release.yml │ ├── stable-main-check-workflow.yml │ ├── tools-ci-tests.yml │ ├── tools-pr-validation-workflow.yml │ └── tools-release.yml ├── .gitignore ├── .husky └── pre-commit ├── .prettierignore ├── .prettierrc ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LABELS.md ├── LICENSE ├── README.md ├── babel.config.js ├── eslint.config.mjs ├── jest.config.js ├── package-lock.json ├── package.json ├── packages └── tools │ ├── .storybook │ ├── main.js │ └── preview.js │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── jest.polyfills.js │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── KaibanJS.pdf │ └── kaiban.txt │ ├── rollup.config.mjs │ ├── src │ ├── _utils │ │ ├── AgentWithToolPreviewer.jsx │ │ ├── ToolPreviewer.jsx │ │ ├── rag │ │ │ ├── loaders │ │ │ │ ├── browserPDFLoader │ │ │ │ │ └── index.ts │ │ │ │ └── textInputLoader │ │ │ │ │ └── index.ts │ │ │ └── ragToolkit.ts │ │ ├── tools.css │ │ └── tools_agent_preview.css │ ├── exa │ │ ├── README.md │ │ ├── index.js │ │ ├── index.ts │ │ ├── tool.stories.jsx │ │ └── tool.test.js │ ├── firecrawl │ │ ├── README.md │ │ ├── index.js │ │ ├── index.ts │ │ ├── tool.stories.jsx │ │ └── tool.test.js │ ├── github-issues │ │ ├── README.md │ │ ├── index.js │ │ ├── index.ts │ │ ├── tool.stories.jsx │ │ └── tool.test.js │ ├── index.ts │ ├── jina-url-to-markdown │ │ ├── README.md │ │ ├── index.js │ │ ├── index.ts │ │ ├── tool.stories.jsx │ │ └── tool.test.js │ ├── make-webhook │ │ ├── README.md │ │ ├── index.js │ │ ├── index.ts │ │ ├── tool.stories.jsx │ │ └── tool.test.js │ ├── pdf-search │ │ ├── README.md │ │ ├── index.js │ │ ├── index.ts │ │ ├── rag │ │ │ ├── loaders │ │ │ │ ├── browserPDFLoader │ │ │ │ │ └── index.ts │ │ │ │ └── textInputLoader │ │ │ │ │ └── index.ts │ │ │ └── ragToolkit.ts │ │ ├── tool.stories.jsx │ │ └── tool.test.js │ ├── serper │ │ ├── README.md │ │ ├── index.js │ │ ├── index.ts │ │ ├── tool.stories.jsx │ │ └── tool.test.js │ ├── simple-rag │ │ ├── README.md │ │ ├── index.js │ │ ├── index.ts │ │ ├── rag │ │ │ ├── loaders │ │ │ │ ├── browserPDFLoader │ │ │ │ │ └── index.ts │ │ │ │ └── textInputLoader │ │ │ │ │ └── index.ts │ │ │ └── ragToolkit.ts │ │ ├── tool.stories.jsx │ │ └── tool.test.js │ ├── tavily │ │ ├── README.md │ │ ├── index.js │ │ ├── index.ts │ │ ├── tool.stories.jsx │ │ └── tool.test.js │ ├── textfile-search │ │ ├── README.md │ │ ├── index.js │ │ ├── index.ts │ │ ├── rag │ │ │ ├── loaders │ │ │ │ ├── browserPDFLoader │ │ │ │ │ └── index.ts │ │ │ │ └── textInputLoader │ │ │ │ │ └── index.ts │ │ │ └── ragToolkit.ts │ │ ├── tool.stories.jsx │ │ └── tool.test.js │ ├── website-search │ │ ├── README.md │ │ ├── index.js │ │ ├── index.ts │ │ ├── rag │ │ │ ├── loaders │ │ │ │ ├── browserPDFLoader │ │ │ │ │ └── index.ts │ │ │ │ └── textInputLoader │ │ │ │ │ └── index.ts │ │ │ └── ragToolkit.ts │ │ ├── tool.stories.jsx │ │ └── tool.test.js │ ├── wolfram-alpha │ │ ├── README.md │ │ ├── index.js │ │ ├── index.ts │ │ ├── tool.stories.jsx │ │ └── tool.test.js │ └── zapier-webhook │ │ ├── README.md │ │ ├── index.js │ │ ├── index.ts │ │ ├── tool.stories.jsx │ │ └── tool.test.js │ └── tsconfig.json ├── playground ├── nodejs-esm │ ├── .env.example │ ├── README.md │ ├── index.cjs │ ├── index.js │ ├── mcp-esm.js │ ├── package-lock.json │ └── package.json ├── nodejs-ts │ ├── README.md │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── nodejs │ ├── index.js │ ├── mcp.js │ ├── package-lock.json │ └── package.json └── react │ ├── .eslintrc.cjs │ ├── .gitignore │ ├── .storybook │ ├── main.js │ └── preview.js │ ├── README.md │ ├── index.html │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── AgentsBoardDebugger.jsx │ ├── App.jsx │ ├── components │ │ ├── Spinner.jsx │ │ └── spinner.css │ ├── index.css │ ├── main.jsx │ ├── stories │ │ ├── Insights.stories.js │ │ ├── LLMs.stories.js │ │ ├── ResumeCreationTeam.stories.js │ │ ├── SportNewsTeam.stories.js │ │ ├── SummaryOutputSchema.stories.js │ │ ├── TaskBlocking.stories.js │ │ ├── TaskChaining.stories.js │ │ ├── TripPlanningTeam.stories.js │ │ ├── WithProxy.stories.js │ │ └── assets │ │ │ ├── accessibility.png │ │ │ ├── accessibility.svg │ │ │ ├── addon-library.png │ │ │ ├── assets.png │ │ │ ├── avif-test-image.avif │ │ │ ├── context.png │ │ │ ├── discord.svg │ │ │ ├── docs.png │ │ │ ├── figma-plugin.png │ │ │ ├── github.svg │ │ │ ├── share.png │ │ │ ├── styling.png │ │ │ ├── testing.png │ │ │ ├── theming.png │ │ │ ├── tutorials.svg │ │ │ └── youtube.svg │ └── teams │ │ ├── event_planning │ │ ├── openai.js │ │ ├── openai_mixed.js │ │ └── openai_parallel.js │ │ ├── llms │ │ ├── anthropic.js │ │ ├── azure_openai.js │ │ ├── cohere.js │ │ ├── deepseek.js │ │ ├── gemini.js │ │ ├── groq.js │ │ ├── mistral.js │ │ ├── ollama.js │ │ └── openai.js │ │ ├── output_schema │ │ └── openai.js │ │ ├── product_specs │ │ ├── anthropic.js │ │ ├── gemini.js │ │ ├── mistral.js │ │ └── openai.js │ │ ├── research_team │ │ └── openai.js │ │ ├── resume_creation │ │ ├── openai.js │ │ ├── openai_custom_prompts.js │ │ ├── openai_reasoning_models.js │ │ ├── openai_with_hitl.js │ │ └── openai_with_insights.js │ │ ├── sport_news │ │ ├── anthropic.js │ │ ├── deepseek.js │ │ ├── gemini.js │ │ ├── mistral.js │ │ ├── openai.js │ │ └── openaiWithReActAgents.js │ │ ├── task_blocking │ │ └── basic_blocking.js │ │ ├── trip_planning │ │ ├── gemini.js │ │ └── openai.js │ │ └── with_proxy │ │ ├── anthropic.js │ │ ├── gemini.js │ │ ├── mistral.js │ │ └── openai.js │ └── vite.config.js ├── rollup.config.mjs ├── src ├── agents │ ├── baseAgent.ts │ ├── index.ts │ └── reactChampionAgent.ts ├── index.ts ├── stores │ ├── agentStore.ts │ ├── agentStore.types.ts │ ├── index.ts │ ├── taskStore.ts │ ├── taskStore.types.ts │ ├── teamStore.ts │ ├── teamStore.types.ts │ ├── workflowLoopStore.ts │ └── workflowLoopStore.types.ts ├── subscribers │ ├── deterministicExecutionSubscriber.ts │ ├── taskSubscriber.ts │ └── teamSubscriber.ts ├── tools │ ├── baseTool.ts │ └── blockTaskTool.ts ├── types │ └── logs │ │ ├── agentLogs.types.ts │ │ ├── common.ts │ │ ├── index.ts │ │ ├── taskLogs.types.ts │ │ └── workflowLogs.types.ts └── utils │ ├── agents.ts │ ├── enums.ts │ ├── errors.ts │ ├── llm.types.ts │ ├── llmCostCalculator.ts │ ├── logger.ts │ ├── objectUtils.ts │ ├── parser.ts │ ├── prettyLogs.ts │ ├── prompts.ts │ ├── tasks.ts │ └── telemetry.ts ├── tests ├── e2e │ ├── __snapshots__ │ │ ├── agentOperations.test.js.snap │ │ ├── customLLMs.test.js.snap │ │ ├── eventPlanningTeam-mixed.test.json │ │ ├── eventPlanningTeam-parallel.test.json │ │ ├── eventPlanningTeam-sequential.test.json │ │ ├── insightsTeam.test.js.snap │ │ ├── llmProxy.test.js.snap │ │ ├── outputSchemaTeam.test.js.snap │ │ ├── productSpecTeam.test.js.snap │ │ ├── resumeCreationTeam.test.js.snap │ │ ├── sportNewsTeam.test.js.snap │ │ ├── taskBlocking.test.js.snap │ │ └── tripPlanningTeam.test.js.snap │ ├── agentOperations.test.js │ ├── customLLMs.test.js │ ├── eventPlanningTeam.test.js │ ├── examples │ │ └── teams │ │ │ ├── agent_operations │ │ │ ├── openaiSetEnv.js │ │ │ ├── openaiSetEnv1.js │ │ │ ├── openaiSetEnvAfterFirstTask.requests.json │ │ │ └── openaiSetEnvBeforeStart.requests.json │ │ │ ├── by_llm │ │ │ ├── anthropic │ │ │ │ ├── productSpecsTeam.js │ │ │ │ ├── productSpecsTeam.requests.js │ │ │ │ └── productSpecsTeamWithAPIErrors.requests.js │ │ │ ├── google │ │ │ │ ├── productSpecsTeam.js │ │ │ │ └── productSpecsTeam.requests.js │ │ │ ├── mistral │ │ │ │ ├── productSpecsTeam.js │ │ │ │ └── productSpecsTeam.requests.js │ │ │ └── openai │ │ │ │ ├── productSpecsTeam.js │ │ │ │ └── productSpecsTeam.requests.js │ │ │ ├── event_planning │ │ │ ├── openai.js │ │ │ ├── openai.requests.json │ │ │ ├── openai_mixed.js │ │ │ ├── openai_mixed.requests.json │ │ │ ├── openai_parallel.js │ │ │ └── openai_parallel.requests.json │ │ │ ├── insights │ │ │ ├── openai.js │ │ │ └── openai.requests.json │ │ │ ├── llm_proxy │ │ │ ├── anthropic.js │ │ │ ├── anthropic.requests.json │ │ │ ├── gemini.js │ │ │ ├── gemini.requests.json │ │ │ ├── openai.js │ │ │ └── openai.requests.json │ │ │ ├── llms │ │ │ └── openai.js │ │ │ ├── output_schema │ │ │ ├── openai.js │ │ │ └── openai.requests.json │ │ │ ├── product_specs │ │ │ ├── openai.js │ │ │ ├── openai.requests.json │ │ │ ├── openai_hitl.js │ │ │ ├── openai_hitl.requests.json │ │ │ ├── openai_hitl_2.js │ │ │ └── openai_hitl_2.requests.json │ │ │ ├── resume_creation │ │ │ ├── openai.js │ │ │ └── openai.requests.json │ │ │ ├── sport_news │ │ │ ├── deepseek.js │ │ │ ├── deepseek.requests.json │ │ │ ├── gemini.js │ │ │ ├── gemini.requests.json │ │ │ ├── openai.js │ │ │ └── openai.requests.json │ │ │ ├── task_blocking │ │ │ ├── security.js │ │ │ └── security.requests.json │ │ │ └── trip_planning │ │ │ ├── openai.js │ │ │ ├── openai.requests.json │ │ │ ├── openai_with_custom_prompts.js │ │ │ └── openai_with_custom_prompts.requests.json │ ├── insightsTeam.test.js │ ├── llmProxy.test.js │ ├── outputSchemaTeam.test.js │ ├── productSpecTeam.test.js │ ├── resumeCreationTeam.test.js │ ├── sportNewsTeam.test.js │ ├── taskBlocking.test.js │ └── tripPlanningTeam.test.js ├── integration │ └── workflowExecution │ │ └── pauseResume.test.js ├── unit │ ├── agentsUtils.test.js │ ├── agentsUtils.test.ts │ └── typesValidation.test.ts └── utils │ └── moscaFetch │ ├── Readme.md │ └── index.js ├── tsconfig.json └── xscripts ├── cli.mjs └── codeSnapshot.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | // "presets": ["@babel/preset-env"], 3 | // "plugins": ["@babel/plugin-syntax-import-meta"] 4 | } 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a bug report for KaibanJS 4 | title: '[BUG] - Bug title here' 5 | labels: bug 6 | assignees: '' 7 | --- 8 | 9 | ### Describe the Bug 10 | 11 | A clear and concise description of what the bug is. 12 | 13 | ### KaibanJS Team Config 14 | 15 | Provide a link to a playground or configuration file to reproduce the issue in your KaibanJS setup, if applicable. For example, see: [Example Playground](https://www.kaibanjs.com/share/v0EdWee1mYpzlv6KeuLG) 16 | 17 | ### Steps to Reproduce 18 | 19 | A step-by-step description of how to reproduce the issue, based on the linked reproduction. Screenshots can be provided. 20 | 21 | ### Current vs. Expected behavior 22 | 23 | A clear and concise description of what the bug is, and what you expected to happen. 24 | 25 | ### Environment 26 | 27 | - Framework/Library: [e.g., React, Vue, NodeJS, Vanilla JavaScript] 28 | - KaibanJS Version: [e.g., 0.1.0] 29 | - JavaScript Runtime: [e.g., Chrome, NodeJS] 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/doc_issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Doc Issue Report 3 | about: Create a doc issue report for KaibanJS documentation 4 | title: '[DOC ISSUE] - Issue title here' 5 | labels: documentation 6 | assignees: '' 7 | --- 8 | 9 | ### Describe the Issue 10 | 11 | A clear and concise description of what the issue is. Include any error messages, incorrect details, missing information, or misleading documentation. 12 | 13 | ### Doc URL 14 | 15 | Provide the URL where the issue occurs, if applicable. 16 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: feature 6 | assignees: '' 7 | --- 8 | 9 | **Is your feature request related to a problem? Please describe.** 10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 11 | 12 | **Describe the solution you'd like** 13 | A clear and concise description of what you want to happen. 14 | 15 | **Describe alternatives you've considered** 16 | A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Additional context** 19 | Add any other context or screenshots about the feature request here. 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/websiteAgenticJS_bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Website Issue Report 3 | about: Create a report to help us improve the KaibanJS website 4 | title: '[WEBSITE ISSUE] - Brief description of the issue' 5 | labels: website, bug 6 | assignees: '' 7 | --- 8 | 9 | ### Describe the Issue 10 | 11 | A clear and concise description of what the bug or issue is. Include any error messages, unusual behaviors, incorrect information, or areas of the website that are impacted. 12 | 13 | ### URL 14 | 15 | Provide the URL where the issue was encountered, or specify the general area of the website, if applicable. 16 | 17 | ### Steps to Reproduce 18 | 19 | Provide a step-by-step process to reproduce the issue. 20 | 21 | 1. Go to '...' 22 | 2. Click on '....' 23 | 3. Scroll down to '....' 24 | 4. See error 25 | 26 | ### Expected Behavior 27 | 28 | Describe what you expected to happen. 29 | 30 | ### Screenshots 31 | 32 | If applicable, add screenshots to help explain your problem. 33 | 34 | ### Possible Solution 35 | 36 | If you have suggestions on a fix for the bug, please describe it here. 37 | 38 | ### Additional Context 39 | 40 | Add any other context about the problem here. This can include links to related issues, information about the device or browser version, etc. 41 | 42 | ### Environment Details 43 | 44 | Please provide specifics about your environment, such as the browser type and version, operating system, screen resolution, and other relevant details that could help diagnose the issue. 45 | 46 | - Browser: [e.g., Chrome, Safari] 47 | - Operating System: [e.g., iOS, Windows] 48 | - Screen Resolution: [e.g., 1920x1080] 49 | - Device: [e.g., Desktop, iPhone X] 50 | -------------------------------------------------------------------------------- /.github/workflows/ci-environment-tests.yml: -------------------------------------------------------------------------------- 1 | name: CI Environment Tests 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | build-and-test: 8 | runs-on: ubuntu-latest 9 | env: # Set the environment variable for all steps in this job 10 | OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} 11 | VITE_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} 12 | steps: 13 | - name: Checkout KaibanJS Library 14 | uses: actions/checkout@v2 15 | with: 16 | repository: kaiban-ai/KaibanJS 17 | path: kaibanjs 18 | 19 | - name: Checkout KaibanJS-React-Vite Repository 20 | uses: actions/checkout@v2 21 | with: 22 | repository: darielnoel/KaibanJS-React-Vite 23 | token: ${{ secrets.GITHUB_TOKEN }} # This is needed to access the repository 24 | path: react-vite-app 25 | 26 | - name: Checkout KaibanJS-NodeJS Repository 27 | uses: actions/checkout@v2 28 | with: 29 | repository: darielnoel/KaibanJS-NodeJS 30 | token: ${{ secrets.GITHUB_TOKEN }} # This is needed to access the repository 31 | path: kaibanjs-nodejs 32 | 33 | - name: Set up Node.js 34 | uses: actions/setup-node@v2 35 | with: 36 | node-version: 18.x 37 | 38 | - name: Build and Pack KaibanJS Library 39 | run: | 40 | cd kaibanjs 41 | npm install 42 | npm run build 43 | npm pack 44 | id: kaibanjs-build 45 | 46 | - name: Install other dependencies for React + Vite App 47 | run: | 48 | cd react-vite-app 49 | npm install 50 | 51 | - name: Install KaibanJS in React + Vite App using Pack 52 | run: | 53 | cd react-vite-app 54 | npm install ../kaibanjs/*.tgz 55 | 56 | - name: Build React + Vite App 57 | run: | 58 | cd react-vite-app 59 | npm run build 60 | 61 | # - name: Run tests for React + Vite App 62 | # run: | 63 | # cd react-vite-app 64 | # npm test 65 | 66 | # Handle NodeJS App after React + Vite App 67 | - name: Install other dependencies for NodeJS App 68 | run: | 69 | cd kaibanjs-nodejs 70 | npm install 71 | 72 | - name: Install KaibanJS in NodeJS App using Pack 73 | run: | 74 | cd kaibanjs-nodejs 75 | npm install ../kaibanjs/*.tgz 76 | 77 | - name: Test NodeJS App 78 | run: | 79 | cd kaibanjs-nodejs 80 | npm test 81 | -------------------------------------------------------------------------------- /.github/workflows/pr-validation-workflow.yml: -------------------------------------------------------------------------------- 1 | name: PR Validation CI 2 | 3 | on: 4 | pull_request: 5 | branches: [main] 6 | 7 | jobs: 8 | build-and-test: 9 | runs-on: ubuntu-latest 10 | env: 11 | OPENAI_API_KEY: 'fake-api-key-so-we-can-use-ci-in-forked-repositories' 12 | OPENAI_API_KEY_2: 'fake-api-key-so-we-can-use-ci-in-forked-repositories' 13 | ANTHROPIC_API_KEY: 'fake-api-key-so-we-can-use-ci-in-forked-repositories' 14 | GOOGLE_API_KEY: 'fake-api-key-so-we-can-use-ci-in-forked-repositories' 15 | MISTRAL_API_KEY: 'fake-api-key-so-we-can-use-ci-in-forked-repositories' 16 | DEEPSEEK_API_KEY: 'fake-api-key-so-we-can-use-ci-in-forked-repositories' 17 | steps: 18 | - name: Checkout code 19 | uses: actions/checkout@v2 20 | 21 | - name: Set up Node.js 22 | uses: actions/setup-node@v2 23 | with: 24 | node-version: '18' 25 | 26 | - name: Install dependencies 27 | run: npm install --also=dev 28 | 29 | - name: Run ESLint Check 30 | run: npm run lint:check 31 | 32 | - name: Check Prettier Formatting 33 | run: npm run format:check 34 | 35 | - name: Build for integration tests 36 | run: npm run build:test 37 | 38 | - name: Run integration tests 39 | run: npm run test:integration 40 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release Version 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | version: 7 | description: 'Enter the version for this release' 8 | required: true 9 | 10 | jobs: 11 | release: 12 | runs-on: ubuntu-latest 13 | env: 14 | OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} 15 | ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} 16 | GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} 17 | MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} 18 | DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }} 19 | steps: 20 | - name: Checkout code 21 | uses: actions/checkout@v2 22 | with: 23 | ref: 'main' # Ensures the main branch is checked out 24 | token: ${{ secrets.PAT_GITHUB }} 25 | 26 | - name: Set up Node.js 27 | uses: actions/setup-node@v2 28 | with: 29 | node-version: '18' 30 | registry-url: 'https://registry.npmjs.org/' 31 | 32 | - name: Reset local changes 33 | run: | 34 | git fetch origin main 35 | git reset --hard origin/main 36 | git clean -fdx 37 | 38 | - name: Configure git user 39 | run: | 40 | git config user.name "Dariel Noel" 41 | git config user.email "darielnoel@gmail.com" 42 | 43 | - name: Install dependencies 44 | run: npm install --also=dev 45 | 46 | - name: Build production version 47 | run: npm run build 48 | 49 | - name: Display changes 50 | run: | 51 | echo "Showing status..." 52 | git status 53 | echo "Showing diff..." 54 | git diff 55 | 56 | - name: Update package.json version and create Git tag 57 | run: npm version ${{ github.event.inputs.version }} 58 | 59 | - name: Push changes and tags 60 | run: | 61 | git push origin main --follow-tags 62 | env: 63 | GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} 64 | 65 | - name: Publish to npm 66 | run: npm publish 67 | env: 68 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 69 | -------------------------------------------------------------------------------- /.github/workflows/stable-main-check-workflow.yml: -------------------------------------------------------------------------------- 1 | name: Stable Main CI 2 | 3 | on: 4 | push: 5 | branches: [main] # Triggered on commits pushed to these branches 6 | 7 | jobs: 8 | build-and-test: 9 | runs-on: ubuntu-latest 10 | env: 11 | OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} 12 | ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} 13 | GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} 14 | MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} 15 | DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }} 16 | steps: 17 | - name: Checkout code 18 | uses: actions/checkout@v2 19 | 20 | - name: Set up Node.js 21 | uses: actions/setup-node@v2 22 | with: 23 | node-version: '18' 24 | 25 | - name: Install dependencies 26 | run: npm install --also=dev 27 | 28 | - name: Build for integration tests 29 | run: npm run build:test 30 | 31 | - name: Run integration tests 32 | run: npm run test:integration 33 | -------------------------------------------------------------------------------- /.github/workflows/tools-ci-tests.yml: -------------------------------------------------------------------------------- 1 | name: Tools - CI Tests 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | paths: 7 | - 'packages/tools/**' # Only trigger on changes to tools package 8 | 9 | jobs: 10 | build-and-test: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v2 15 | 16 | - name: Set up Node.js 17 | uses: actions/setup-node@v2 18 | with: 19 | node-version: '18' 20 | 21 | - name: Install dependencies 22 | working-directory: packages/tools 23 | run: npm install --also=dev 24 | 25 | - name: Build tools package 26 | working-directory: packages/tools 27 | run: npm run build 28 | 29 | - name: Run tools tests 30 | working-directory: packages/tools 31 | run: npm run test 32 | -------------------------------------------------------------------------------- /.github/workflows/tools-pr-validation-workflow.yml: -------------------------------------------------------------------------------- 1 | name: Tools - PR Validation 2 | 3 | on: 4 | pull_request: 5 | branches: [main] 6 | paths: 7 | - 'packages/tools/**' # Only trigger on changes to tools package 8 | 9 | jobs: 10 | build-and-test: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v2 15 | 16 | - name: Set up Node.js 17 | uses: actions/setup-node@v2 18 | with: 19 | node-version: '18' 20 | 21 | - name: Install dependencies 22 | working-directory: packages/tools 23 | run: npm install --also=dev 24 | 25 | - name: Build tools package 26 | working-directory: packages/tools 27 | run: npm run build 28 | 29 | - name: Run tools tests 30 | working-directory: packages/tools 31 | run: npm run test 32 | -------------------------------------------------------------------------------- /.github/workflows/tools-release.yml: -------------------------------------------------------------------------------- 1 | name: Tools - Release Package 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | version: 7 | description: 'Enter the version for this release' 8 | required: true 9 | 10 | jobs: 11 | release: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout code 15 | uses: actions/checkout@v2 16 | with: 17 | ref: 'main' 18 | token: ${{ secrets.PAT_GITHUB }} 19 | 20 | - name: Set up Node.js 21 | uses: actions/setup-node@v2 22 | with: 23 | node-version: '18' 24 | registry-url: 'https://registry.npmjs.org/' 25 | 26 | - name: Reset local changes 27 | run: | 28 | git fetch origin main 29 | git reset --hard origin/main 30 | git clean -fdx 31 | 32 | - name: Configure git user 33 | run: | 34 | git config user.name "Dariel Noel" 35 | git config user.email "darielnoel@gmail.com" 36 | 37 | - name: Install dependencies 38 | run: cd packages/tools && npm install --also=dev 39 | 40 | - name: Build production version 41 | run: cd packages/tools && npm run build 42 | 43 | - name: Display changes 44 | run: | 45 | echo "Showing status..." 46 | git status 47 | echo "Showing diff..." 48 | git diff 49 | 50 | - name: Update package.json version 51 | run: | 52 | cd packages/tools 53 | npm version ${{ github.event.inputs.version }} 54 | 55 | - name: Push changes and tags 56 | run: | 57 | git push origin main 58 | git tag -a "tools-v${{ github.event.inputs.version }}" -m "Release version ${{ github.event.inputs.version }} for @kaibanjs/tools" 59 | git push origin "tools-v${{ github.event.inputs.version }}" 60 | env: 61 | GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} 62 | 63 | - name: Publish to npm 64 | run: | 65 | cd packages/tools 66 | npm publish 67 | env: 68 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 69 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # Dependencies 4 | node_modules 5 | .pnp 6 | .pnp.js 7 | 8 | # Local env files 9 | .env 10 | .env.local 11 | .env.development.local 12 | .env.test.local 13 | .env.production.local 14 | 15 | # Testing 16 | coverage 17 | 18 | # Turbo 19 | .turbo 20 | 21 | # Vercel 22 | .vercel 23 | 24 | # Build Outputs 25 | .next/ 26 | out/ 27 | build 28 | dist 29 | 30 | # Debug 31 | npm-debug.log* 32 | yarn-debug.log* 33 | yarn-error.log* 34 | 35 | # Misc 36 | .DS_Store 37 | *.pem 38 | _todo.md 39 | .vscode 40 | 41 | *storybook.log 42 | _todo.md 43 | 44 | .eslintcache 45 | 46 | server.js 47 | 48 | # Generated files from MoscaFetch 49 | recordedData.json -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | npx lint-staged -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Ignore artifacts: 2 | dist 3 | build 4 | coverage 5 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "tabWidth": 2, 4 | "semi": true, 5 | "singleQuote": true, 6 | "printWidth": 80 7 | } 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 AI Champions 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 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | ['@babel/preset-env', { targets: { node: 'current' } }], 4 | '@babel/preset-typescript', 5 | ], 6 | }; 7 | -------------------------------------------------------------------------------- /eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import globals from 'globals'; 2 | import pluginJs from '@eslint/js'; 3 | import pluginTs from 'typescript-eslint'; 4 | import parserTs from '@typescript-eslint/parser'; 5 | import pluginReact from 'eslint-plugin-react'; 6 | import pluginJest from 'eslint-plugin-jest'; 7 | 8 | export default [ 9 | { 10 | ignores: ['node_modules/*', 'dist/*', 'packages/tools/dist/*'], 11 | }, 12 | pluginJs.configs.recommended, 13 | ...pluginTs.configs.recommended, 14 | pluginReact.configs.flat.recommended, 15 | pluginJest.configs['flat/recommended'], 16 | { 17 | files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'], 18 | settings: { 19 | react: { 20 | version: 'detect', 21 | }, 22 | }, 23 | languageOptions: { 24 | globals: { ...globals.browser, ...globals.node }, 25 | parserOptions: { 26 | ecmaVersion: 2020, 27 | sourceType: 'commonjs', 28 | ecmaFeatures: { jsx: true }, 29 | }, 30 | parser: parserTs, 31 | }, 32 | rules: { 33 | '@typescript-eslint/no-explicit-any': 'off', 34 | 'react/jsx-filename-extension': [ 35 | 'warn', 36 | { extensions: ['.js', '.jsx', '.ts', '.tsx'] }, 37 | ], 38 | '@typescript-eslint/no-unused-vars': [ 39 | 'error', 40 | { 41 | argsIgnorePattern: '^_', 42 | varsIgnorePattern: '^_', 43 | caughtErrorsIgnorePattern: '^_', 44 | }, 45 | ], 46 | '@typescript-eslint/no-require-imports': 'off', 47 | 'react/react-in-jsx-scope': 'off', 48 | 'react/prop-types': 'off', 49 | 'jest/no-focused-tests': 'off', 50 | 'jest/no-disabled-tests': 'off', 51 | }, 52 | }, 53 | ]; 54 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('jest').Config} */ 2 | module.exports = { 3 | roots: ['/src', '/tests'], 4 | testEnvironment: 'node', 5 | transform: { 6 | '^.+\\.(js|jsx|ts|tsx)$': 'babel-jest', 7 | }, 8 | moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'node'], 9 | coverageDirectory: './coverage', 10 | collectCoverageFrom: ['src/**/*.js', 'src/**/*.ts'], 11 | coveragePathIgnorePatterns: ['/node_modules/', '/tests/'], 12 | testPathIgnorePatterns: ['/node_modules/'], 13 | moduleNameMapper: { 14 | '^kaibanjs$': '/dist/bundle.cjs', 15 | }, 16 | testTimeout: 300000, // Sets global timeout to 10 seconds for all tests 17 | verbose: true, // Make Jest more verbose 18 | silent: false, // Ensure Jest is not silent (though this is not directly related to console.log output) 19 | // testMatch: ['**/tests/e2e/**/eventPlanningTeam.test.js'], // Run tests only in the specific directory 20 | }; 21 | -------------------------------------------------------------------------------- /packages/tools/.storybook/main.js: -------------------------------------------------------------------------------- 1 | /** @type { import('@storybook/react-vite').StorybookConfig } */ 2 | const config = { 3 | stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], 4 | addons: [ 5 | '@storybook/addon-onboarding', 6 | '@storybook/addon-links', 7 | '@storybook/addon-essentials', 8 | '@chromatic-com/storybook', 9 | '@storybook/addon-interactions', 10 | ], 11 | framework: { 12 | name: '@storybook/react-vite', 13 | options: {}, 14 | }, 15 | }; 16 | export default config; 17 | -------------------------------------------------------------------------------- /packages/tools/.storybook/preview.js: -------------------------------------------------------------------------------- 1 | /** @type { import('@storybook/react').Preview } */ 2 | const preview = { 3 | parameters: { 4 | controls: { 5 | matchers: { 6 | color: /(background|color)$/i, 7 | date: /Date$/i, 8 | }, 9 | }, 10 | }, 11 | }; 12 | 13 | export default preview; 14 | -------------------------------------------------------------------------------- /packages/tools/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to the `@kaibanjs/tools` package will be documented in this file. 4 | 5 | ## [0.5.0] - 2025-01-08 6 | 7 | ### Added 8 | 9 | - Jina URL to Markdown Tool for advanced web scraping and content extraction 10 | - Clean, LLM-ready markdown conversion 11 | - Support for dynamic content and anti-bot mechanisms 12 | - Configurable output formats 13 | - Powered by Jina.ai integration 14 | 15 | ### Contributors 16 | 17 | - Special thanks to Aitor Roma (@aitorroma) from the Nimbox360 team and @anthonydevs17. 18 | 19 | ## [0.4.1] - 2024-12-19 20 | 21 | ### Documentation 22 | 23 | - Added missing README files for: 24 | - Exa Search Tool 25 | - Firecrawl Tool 26 | - Updated main package README with improved tool listing 27 | - Standardized documentation format across all tools 28 | 29 | ## [0.4.0] - 2024-12-19 30 | 31 | ### Added 32 | 33 | - Zapier Webhook Tool for workflow automation integration 34 | - Make Webhook Tool for Make (formerly Integromat) integration 35 | 36 | ## [0.3.0] - 2024-12-14 37 | 38 | ### Added 39 | 40 | - Simple RAG Tool for basic RAG implementations 41 | - Website Search Tool for semantic website content search 42 | - PDF Search Tool for document analysis 43 | - Text File Search Tool for plain text processing 44 | 45 | ### Enhanced 46 | 47 | - Added support for custom vector stores 48 | - Improved documentation for all tools 49 | - Added comprehensive examples in tool READMEs 50 | 51 | ## [0.2.0] - 2024-11-17 52 | 53 | ### Added 54 | 55 | - Serper Tool for Google Search API integration 56 | - WolframAlpha Tool for computational queries 57 | - Exa Search Tool for neural search capabilities 58 | - GitHub Issues Tool for repository management 59 | 60 | ### Improved 61 | 62 | - Enhanced error handling across all tools 63 | - Better type definitions and input validation 64 | - Updated documentation with more examples 65 | 66 | ## [0.1.0] - Initial Release 67 | 68 | ### Added 69 | 70 | - Initial package setup 71 | - Basic tool implementation structure 72 | - Core utility functions 73 | - Testing framework setup 74 | - Documentation foundation 75 | -------------------------------------------------------------------------------- /packages/tools/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | testEnvironment: 'node', 3 | transformIgnorePatterns: ['node_modules/(?!(@langchain|zod)/)'], 4 | setupFiles: ['/jest.polyfills.js'], 5 | }; 6 | -------------------------------------------------------------------------------- /packages/tools/jest.polyfills.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | const { TextDecoder, TextEncoder } = require('node:util'); 3 | const { ReadableStream, TransformStream } = require('node:stream/web'); 4 | 5 | Object.defineProperties(globalThis, { 6 | TextDecoder: { value: TextDecoder }, 7 | TextEncoder: { value: TextEncoder }, 8 | ReadableStream: { value: ReadableStream }, 9 | TransformStream: { value: TransformStream }, 10 | }); 11 | 12 | const { Blob, File } = require('node:buffer'); 13 | const { fetch, Headers, FormData, Request, Response } = require('undici'); 14 | 15 | Object.defineProperties(globalThis, { 16 | fetch: { value: fetch, writable: true }, 17 | Blob: { value: Blob }, 18 | File: { value: File }, 19 | Headers: { value: Headers }, 20 | FormData: { value: FormData }, 21 | Request: { value: Request }, 22 | Response: { value: Response }, 23 | }); 24 | -------------------------------------------------------------------------------- /packages/tools/public/KaibanJS.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaiban-ai/KaibanJS/100a08e3cd8cbe0dacd11cb36bb175bdb9d4835e/packages/tools/public/KaibanJS.pdf -------------------------------------------------------------------------------- /packages/tools/src/_utils/rag/loaders/textInputLoader/index.ts: -------------------------------------------------------------------------------- 1 | import { BaseDocumentLoader } from '@langchain/core/document_loaders/base'; 2 | import { Document as BaseDocument } from 'langchain/document'; 3 | 4 | interface TextInputMetadata { 5 | [key: string]: any; 6 | } 7 | 8 | export class TextInputLoader extends BaseDocumentLoader { 9 | private text: string; 10 | private metadata: TextInputMetadata; 11 | 12 | constructor(text: string, metadata: TextInputMetadata = {}) { 13 | super(); 14 | this.text = text; 15 | this.metadata = metadata; 16 | } 17 | 18 | async load(): Promise { 19 | const document = new BaseDocument({ 20 | pageContent: this.text, 21 | metadata: this.metadata, 22 | }); 23 | return [document]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/tools/src/_utils/tools.css: -------------------------------------------------------------------------------- 1 | .firecrawl-tool { 2 | display: flex; 3 | flex-direction: column; 4 | /* height: 100vh; */ 5 | padding: 20px; 6 | width: 800px; 7 | box-sizing: border-box; 8 | } 9 | 10 | .input-container { 11 | display: flex; 12 | gap: 10px; 13 | margin-bottom: 20px; 14 | } 15 | 16 | .input-container input { 17 | flex-grow: 1; 18 | padding: 8px; 19 | font-size: 16px; 20 | } 21 | 22 | .input-container button { 23 | padding: 8px 16px; 24 | font-size: 16px; 25 | cursor: pointer; 26 | } 27 | 28 | .editor-container { 29 | flex-grow: 1; 30 | border: 1px solid #ccc; 31 | border-radius: 4px; 32 | overflow: hidden; 33 | /* height: calc(100vh - 140px); Adjust this value as needed */ 34 | } 35 | 36 | .no-content-message { 37 | color: #666; 38 | font-style: italic; 39 | text-align: center; 40 | padding: 20px; 41 | } 42 | 43 | .tool-executor h2, 44 | .tool-executor h3 { 45 | margin-top: 20px; 46 | margin-bottom: 10px; 47 | } 48 | 49 | .tool-executor .input-container { 50 | margin-top: 20px; 51 | margin-bottom: 20px; 52 | } 53 | 54 | .tool-executor .output-container { 55 | margin-top: 20px; 56 | } 57 | -------------------------------------------------------------------------------- /packages/tools/src/exa/tool.stories.jsx: -------------------------------------------------------------------------------- 1 | import { ToolPreviewer } from '../_utils/ToolPreviewer.jsx'; 2 | import { ExaSearch } from './index.ts'; 3 | import { Agent, Task, Team } from '../../../../'; 4 | import React from 'react'; 5 | import { AgentWithToolPreviewer } from '../_utils/AgentWithToolPreviewer.jsx'; 6 | 7 | export default { 8 | title: 'Tools/ExaSearch', 9 | component: ToolPreviewer, 10 | parameters: { 11 | layout: 'centered', 12 | }, 13 | tags: ['autodocs'], 14 | argTypes: {}, 15 | }; 16 | 17 | const exaTool = new ExaSearch({ 18 | apiKey: import.meta.env.VITE_EXA_API_KEY, 19 | type: 'neural', 20 | contents: { 21 | text: true, 22 | summary: true, 23 | }, 24 | }); 25 | 26 | // Create an agent with the exa tool 27 | const researchAgent = new Agent({ 28 | name: 'Insight', 29 | role: 'Research Analyst', 30 | goal: 'Provide comprehensive research and analysis on specific topics using high-quality sources.', 31 | background: 'Advanced Research and Data Analysis', 32 | tools: [exaTool], 33 | }); 34 | 35 | // Create a research task 36 | const researchTask = new Task({ 37 | description: 38 | 'Research and analyze the following topic: {query}. Focus on high-quality sources and recent developments. Please use markdown format for the output.', 39 | expectedOutput: 40 | 'A detailed analysis in markdown format with insights from reputable sources, including academic papers and expert opinions.', 41 | agent: researchAgent, 42 | }); 43 | 44 | // Create the team 45 | const team = new Team({ 46 | name: 'Deep Research Team', 47 | agents: [researchAgent], 48 | tasks: [researchTask], 49 | inputs: { 50 | query: 'Latest breakthroughs in quantum computing', 51 | }, 52 | env: { 53 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 54 | }, 55 | }); 56 | 57 | export const Default = { 58 | args: { 59 | toolInstance: exaTool, 60 | callParams: { 61 | query: 'Latest breakthroughs in quantum computing', 62 | }, 63 | }, 64 | }; 65 | 66 | export const withAgent = { 67 | render: (args) => , 68 | args: { 69 | team: team, 70 | }, 71 | }; 72 | -------------------------------------------------------------------------------- /packages/tools/src/firecrawl/README.md: -------------------------------------------------------------------------------- 1 | # Firecrawl Tool 2 | 3 | This tool integrates with Firecrawl (https://www.firecrawl.dev/), a web scraping and crawling service designed to turn websites into LLM-ready data. It enables the extraction of clean, well-formatted content from websites, making it ideal for AI applications, particularly those using Large Language Models (LLMs). 4 | 5 | ## Components 6 | 7 | The tool uses the following components: 8 | 9 | - A Firecrawl API client instance 10 | - An API Key for authentication 11 | - A custom HTTP client (ky) for making API requests 12 | - Input validation using Zod schema 13 | - Configurable output format 14 | 15 | ## Key Features 16 | 17 | - Scrapes and crawls websites, even those with dynamic content 18 | - Converts web content into clean, LLM-ready markdown 19 | - Handles complex web scraping challenges: 20 | - Rate limits 21 | - JavaScript rendering 22 | - Anti-bot mechanisms 23 | - Multiple output format options 24 | - Clean, structured data extraction 25 | - Support for dynamic content 26 | - Automatic content cleaning and formatting 27 | 28 | ## Input 29 | 30 | The input should be a JSON object with a "url" field containing the URL to scrape and retrieve content from. 31 | 32 | ## Output 33 | 34 | The output is the scraped content from the specified URL, formatted according to the configured format (default: markdown). 35 | 36 | ## Configuration Options 37 | 38 | - `apiKey`: Your Firecrawl API key 39 | - `format`: Output format (defaults to 'markdown') 40 | - `mode`: Scraping mode (currently supports 'scrape') 41 | 42 | ## Example 43 | 44 | ```javascript 45 | const tool = new Firecrawl({ 46 | apiKey: 'your-api-key', 47 | format: 'markdown', 48 | }); 49 | 50 | const result = await tool._call({ 51 | url: 'https://example.com', 52 | }); 53 | ``` 54 | 55 | ## Advanced Example with Error Handling 56 | 57 | ```javascript 58 | const tool = new Firecrawl({ 59 | apiKey: process.env.FIRECRAWL_API_KEY, 60 | format: 'markdown', 61 | }); 62 | 63 | try { 64 | const result = await tool._call({ 65 | url: 'https://example.com/blog/article', 66 | }); 67 | 68 | // Process the scraped content 69 | console.log('Scraped content:', result); 70 | 71 | // Use the content with an LLM or other processing 72 | // ... 73 | } catch (error) { 74 | console.error('Error scraping website:', error); 75 | } 76 | ``` 77 | 78 | ### Disclaimer 79 | 80 | Ensure you have proper API credentials and respect Firecrawl's usage terms and rate limits. The service offers flexible pricing plans, including a free tier for small-scale use. When scraping websites, make sure to comply with the target website's terms of service and robots.txt directives. 81 | -------------------------------------------------------------------------------- /packages/tools/src/github-issues/tool.stories.jsx: -------------------------------------------------------------------------------- 1 | import { ToolPreviewer } from '../_utils/ToolPreviewer.jsx'; 2 | import { AgentWithToolPreviewer } from '../_utils/AgentWithToolPreviewer.jsx'; 3 | import { GithubIssues } from './index.ts'; 4 | import { Agent, Task, Team } from '../../../../'; 5 | import React from 'react'; 6 | 7 | export default { 8 | title: 'Tools/Github Issues', 9 | parameters: { 10 | layout: 'centered', 11 | }, 12 | tags: ['autodocs'], 13 | argTypes: {}, 14 | }; 15 | 16 | const githubTool = new GithubIssues({ 17 | token: import.meta.env.VITE_GITHUB_TOKEN, 18 | limit: 5, 19 | }); 20 | 21 | export const Default = { 22 | render: (args) => , 23 | args: { 24 | toolInstance: githubTool, 25 | callParams: { 26 | repoUrl: 'https://github.com/facebook/react', 27 | }, 28 | }, 29 | }; 30 | 31 | // Create an agent with the GitHub tool 32 | const issueAnalyzer = new Agent({ 33 | name: 'Issue Analyzer', 34 | role: 'GitHub Repository Inspector', 35 | goal: 'Analyze and summarize GitHub repository issues', 36 | tools: [githubTool], 37 | }); 38 | 39 | // Create an analysis task 40 | const issueAnalysisTask = new Task({ 41 | description: 42 | 'Fetch and analyze issues from the following repository: {repoUrl}', 43 | agent: issueAnalyzer, 44 | expectedOutput: 'A structured summary of repository issues', 45 | }); 46 | 47 | // Create the team 48 | const team = new Team({ 49 | name: 'Repository Analysis Unit', 50 | description: 'Specialized team for GitHub repository issue analysis', 51 | agents: [issueAnalyzer], 52 | tasks: [issueAnalysisTask], 53 | inputs: { 54 | repoUrl: 'https://github.com/facebook/react', 55 | }, 56 | env: { 57 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 58 | }, 59 | }); 60 | 61 | export const withAgent = { 62 | render: (args) => , 63 | args: { 64 | team: team, 65 | }, 66 | }; 67 | -------------------------------------------------------------------------------- /packages/tools/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Export all tools from this package 3 | */ 4 | 5 | export { JinaUrlToMarkdown } from './jina-url-to-markdown'; 6 | export { SimpleRAG } from './simple-rag'; 7 | export { TextFileSearch } from './textfile-search'; 8 | export { WebsiteSearch } from './website-search'; 9 | export { PdfSearch } from './pdf-search'; 10 | export { ZapierWebhook } from './zapier-webhook'; 11 | export { MakeWebhook } from './make-webhook'; 12 | export { Firecrawl } from './firecrawl'; 13 | export { TavilySearchResults } from './tavily'; 14 | export { GithubIssues } from './github-issues'; 15 | export { Serper } from './serper'; 16 | export { WolframAlphaTool } from './wolfram-alpha'; 17 | export { ExaSearch } from './exa'; 18 | -------------------------------------------------------------------------------- /packages/tools/src/jina-url-to-markdown/README.md: -------------------------------------------------------------------------------- 1 | # Jina URL to Markdown 2 | 3 | This tool integrates with Jina (https://jina.ai/), a web scraping and crawling service designed to turn websites into LLM-ready data. It enables the extraction of clean, well-formatted content from websites, making it ideal for AI applications, particularly those using Large Language Models (LLMs). 4 | 5 | ## Components 6 | 7 | The tool uses the following components: 8 | 9 | - A Jina API client instance 10 | - An API Key for authentication 11 | - A custom HTTP client (ky) for making API requests 12 | - Input validation using Zod schema 13 | - Configurable output format 14 | 15 | ## Key Features 16 | 17 | - Scrapes and crawls websites, even those with dynamic content 18 | - Converts web content into clean, LLM-ready markdown 19 | - Handles complex web scraping challenges: 20 | - Rate limits 21 | - JavaScript rendering 22 | - Anti-bot mechanisms 23 | - Multiple output format options 24 | - Clean, structured data extraction 25 | - Support for dynamic content 26 | - Automatic content cleaning and formatting 27 | 28 | ## Input 29 | 30 | The input should be a JSON object with a "url" field containing the URL to scrape and retrieve content from. 31 | 32 | ## Output 33 | 34 | The output is the scraped content from the specified URL, formatted according to the configured format (default: markdown). 35 | 36 | ## Configuration Options 37 | 38 | - `apiKey`: Your Jina API key (optional) 39 | - `options`: Options for the Jina API request (optional) 40 | 41 | ## Example 42 | 43 | ```javascript 44 | const tool = new JinaUrlToMarkdown(); 45 | 46 | const result = await tool._call({ 47 | url: 'https://example.com', 48 | }); 49 | ``` 50 | 51 | ## Advanced Example with Custom Options and Error Handling 52 | 53 | ```javascript 54 | const tool = new JinaUrlToMarkdown({ 55 | apiKey: process.env.JINA_API_KEY, 56 | options: { 57 | targetSelector: ['body', '.class', '#id'], 58 | retainImages: 'none', 59 | }, 60 | }); 61 | 62 | try { 63 | const result = await tool._call({ 64 | url: 'https://example.com/blog/article', 65 | }); 66 | 67 | // Process the scraped content 68 | console.log('Markdown content:', result); 69 | 70 | // Use the content with an LLM or other processing 71 | // ... 72 | } catch (error) { 73 | console.error('Error scraping website:', error); 74 | } 75 | ``` 76 | 77 | For more information about Jina, visit: https://jina.ai/, https://r.jina.ai/docs 78 | 79 | ### Disclaimer 80 | 81 | Ensure you have proper API credentials and respect Jina's usage terms and rate limits. The service offers flexible pricing plans, including a free tier for small-scale use. When scraping websites, make sure to comply with the target website's terms of service and robots.txt directives. 82 | -------------------------------------------------------------------------------- /packages/tools/src/make-webhook/README.md: -------------------------------------------------------------------------------- 1 | # Make Webhook Tool 2 | 3 | The Make Webhook Tool allows AI agents to interact with Make's webhook service, enabling seamless integration with thousands of apps and services supported by Make. 4 | 5 | ## Purpose 6 | 7 | The Make Webhook Tool is designed to extend the capabilities of AI agents by allowing them to trigger workflows and automate tasks across various applications using Make's webhook functionality. This tool is ideal for scenarios where agents need to interact with multiple services and automate complex workflows. 8 | 9 | ## Features 10 | 11 | - Easy integration with Make's webhook service 12 | - Trigger workflows and automate tasks across thousands of apps 13 | - Configurable options for webhook events and payloads 14 | 15 | ## Usage 16 | 17 | To use the Make Webhook Tool, follow these steps: 18 | 19 | **Configure the Tool**: Create an instance of the `MakeWebhook` tool with the required configuration. 20 | 21 | ```javascript 22 | import { z } from 'zod'; 23 | 24 | const MakeTool = new MakeWebhook({ 25 | url: 'https://hooks.Make.com/hooks/catch/4716958/2sdvyu2', // Set your Make webhook URL here 26 | schema: z.object({ 27 | emailSubject: z.string().describe('The subject of the email.'), 28 | issuesSummary: z.string().describe('The summary of the issues.'), 29 | }), 30 | }); 31 | ``` 32 | 33 | **Use the Tool**: Integrate the tool into your workflow or agent. 34 | 35 | ```javascript 36 | const response = await MakeTool._call({ 37 | emailSubject: 'Weekly GitHub Issues Report', 38 | issuesSummary: 'Summary of the issues found in the repository.', 39 | }); 40 | 41 | console.log(response); 42 | ``` 43 | 44 | For questions or discussions, join our [Discord](https://kaibanjs.com/discord). 45 | 46 | ## License 47 | 48 | MIT License 49 | -------------------------------------------------------------------------------- /packages/tools/src/pdf-search/rag/loaders/textInputLoader/index.ts: -------------------------------------------------------------------------------- 1 | import { BaseDocumentLoader } from '@langchain/core/document_loaders/base'; 2 | import { Document as BaseDocument } from 'langchain/document'; 3 | 4 | interface TextInputMetadata { 5 | [key: string]: any; 6 | } 7 | 8 | export class TextInputLoader extends BaseDocumentLoader { 9 | private text: string; 10 | private metadata: TextInputMetadata; 11 | 12 | constructor(text: string, metadata: TextInputMetadata = {}) { 13 | super(); 14 | this.text = text; 15 | this.metadata = metadata; 16 | } 17 | 18 | async load(): Promise { 19 | const document = new BaseDocument({ 20 | pageContent: this.text, 21 | metadata: this.metadata, 22 | }); 23 | return [document]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/tools/src/pdf-search/tool.stories.jsx: -------------------------------------------------------------------------------- 1 | import { ToolPreviewer } from '../_utils/ToolPreviewer.jsx'; 2 | import { AgentWithToolPreviewer } from '../_utils/AgentWithToolPreviewer.jsx'; 3 | import { PdfSearch } from './index.ts'; 4 | import { Agent, Task, Team } from '../../../../'; 5 | import React from 'react'; 6 | 7 | export default { 8 | title: 'Tools/PDFSearch', 9 | component: ToolPreviewer, 10 | parameters: { 11 | layout: 'centered', 12 | }, 13 | tags: ['autodocs'], 14 | }; 15 | 16 | const pdfFileTool = new PdfSearch({ 17 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 18 | file: '../../public/KaibanJS.pdf', 19 | }); 20 | 21 | // Create an agent with the text file tool 22 | const pdfSearcher = new Agent({ 23 | name: 'PDF File Searcher', 24 | role: 'PDF Content Analyzer', 25 | goal: 'Conduct semantic searches within the content of a particular pdf file', 26 | tools: [pdfFileTool], 27 | }); 28 | 29 | // Create a text analysis task 30 | const searchTask = new Task({ 31 | description: 32 | 'Conduct a semantic search on the following PDF: {file} and answer the question: {query}', 33 | expectedOutput: 34 | 'A detailed answer to the question based on the website content.', 35 | agent: pdfSearcher, 36 | }); 37 | 38 | // Create the team 39 | const team = new Team({ 40 | name: 'Pdf Search Team', 41 | agents: [pdfSearcher], 42 | tasks: [searchTask], 43 | inputs: { 44 | file: '../../public/KaibanJS.pdf', 45 | query: 'What is Agents in Kaiban?', 46 | }, 47 | env: { 48 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 49 | }, 50 | }); 51 | 52 | export const Default = { 53 | args: { 54 | toolInstance: pdfFileTool, 55 | callParams: { 56 | query: 'What is Agents in Kaiban?', 57 | }, 58 | }, 59 | }; 60 | 61 | export const withAgent = { 62 | render: (args) => , 63 | args: { 64 | team: team, 65 | }, 66 | }; 67 | -------------------------------------------------------------------------------- /packages/tools/src/serper/tool.stories.jsx: -------------------------------------------------------------------------------- 1 | import { ToolPreviewer } from '../_utils/ToolPreviewer.jsx'; 2 | import { Serper } from './index.ts'; 3 | import { Agent, Task, Team } from '../../../../'; 4 | import React from 'react'; 5 | import { AgentWithToolPreviewer } from '../_utils/AgentWithToolPreviewer.jsx'; 6 | 7 | // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export 8 | export default { 9 | title: 'Tools/Serper', 10 | component: ToolPreviewer, 11 | parameters: { 12 | // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout 13 | layout: 'centered', 14 | }, 15 | // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs 16 | tags: ['autodocs'], 17 | // More on argTypes: https://storybook.js.org/docs/api/argtypes 18 | argTypes: { 19 | // backgroundColor: { control: 'color' }, 20 | }, 21 | }; 22 | 23 | const serperTool = new Serper({ 24 | apiKey: import.meta.env.VITE_SERPER_API_KEY, 25 | type: 'news', 26 | }); 27 | 28 | // Create an agent with the serper tool 29 | const newsGatherer = new Agent({ 30 | name: 'Echo', 31 | role: 'News Gatherer', 32 | goal: 'Collect all recent news articles about a specific event using diverse media sources.', 33 | background: 'Journalism', 34 | tools: [serperTool], 35 | }); 36 | 37 | // Create a gather news task 38 | const gatherNewsTask = new Task({ 39 | description: 40 | 'Gather all relevant news articles about the event: {query}. Please use markdown format for the output.', 41 | expectedOutput: 42 | 'A collection of links and summaries in markdown format of all articles related to the event.', 43 | agent: newsGatherer, 44 | }); 45 | 46 | // Create the team 47 | const team = new Team({ 48 | name: 'Global News Report Team', 49 | agents: [newsGatherer], 50 | tasks: [gatherNewsTask], 51 | inputs: { 52 | query: '2024 US Presidential Election', 53 | }, 54 | env: { 55 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 56 | }, 57 | }); 58 | 59 | // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args 60 | export const Default = { 61 | args: { 62 | toolInstance: serperTool, 63 | callParams: { 64 | query: '2024 US Presidential Election', 65 | }, 66 | }, 67 | }; 68 | 69 | export const withAgent = { 70 | render: (args) => , 71 | args: { 72 | team: team, 73 | }, 74 | }; 75 | -------------------------------------------------------------------------------- /packages/tools/src/simple-rag/rag/loaders/textInputLoader/index.ts: -------------------------------------------------------------------------------- 1 | import { BaseDocumentLoader } from '@langchain/core/document_loaders/base'; 2 | import { Document as BaseDocument } from 'langchain/document'; 3 | 4 | interface TextInputMetadata { 5 | [key: string]: any; 6 | } 7 | 8 | export class TextInputLoader extends BaseDocumentLoader { 9 | private text: string; 10 | private metadata: TextInputMetadata; 11 | 12 | constructor(text: string, metadata: TextInputMetadata = {}) { 13 | super(); 14 | this.text = text; 15 | this.metadata = metadata; 16 | } 17 | 18 | async load(): Promise { 19 | const document = new BaseDocument({ 20 | pageContent: this.text, 21 | metadata: this.metadata, 22 | }); 23 | return [document]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/tools/src/tavily/README.md: -------------------------------------------------------------------------------- 1 | # Tavily Search Results Tool 2 | 3 | This tool integrates with Tavily (https://tavily.com/), an advanced search engine optimized for comprehensive, accurate, and trusted results. It's particularly useful for retrieving current information and answering questions about recent events, making it ideal for AI applications and Large Language Models (LLMs). 4 | 5 | ## Components 6 | 7 | The tool uses the following components: 8 | 9 | - A Tavily API client instance 10 | - An API Key for authentication 11 | - A custom HTTP client (ky) for making API requests 12 | - Input validation using Zod schema 13 | - Configurable maximum results parameter 14 | 15 | ## Key Features 16 | 17 | - Delivers accurate and trusted search results 18 | - Optimized for current events and real-time information 19 | - Returns well-structured JSON data ready for LLM consumption 20 | - Includes content relevance scoring and filtering 21 | - Configurable number of results 22 | - Built-in error handling and validation 23 | - JSON-formatted responses 24 | 25 | ## Input 26 | 27 | The input should be a JSON object with a "searchQuery" field containing the search query to process. 28 | 29 | ## Output 30 | 31 | The output is a JSON-formatted string containing an array of search results from Tavily. Each result includes relevant information about the search query. 32 | 33 | ## Example 34 | 35 | ```javascript 36 | const tool = new TavilySearchResults({ 37 | apiKey: 'your-api-key', 38 | maxResults: 5, // Optional, defaults to 5 39 | }); 40 | 41 | const result = await tool._call({ 42 | searchQuery: 'What are the latest developments in AI?', 43 | }); 44 | ``` 45 | 46 | ## Advanced Example with Error Handling 47 | 48 | ```javascript 49 | const tool = new TavilySearchResults({ 50 | apiKey: process.env.TAVILY_API_KEY, 51 | maxResults: 10, 52 | }); 53 | 54 | try { 55 | const result = await tool._call({ 56 | searchQuery: 'recent breakthroughs in quantum computing', 57 | }); 58 | 59 | // Parse the JSON string back to an object 60 | const searchResults = JSON.parse(result); 61 | 62 | // Process the results 63 | searchResults.forEach((item, index) => { 64 | console.log(`Result ${index + 1}:`, item); 65 | }); 66 | } catch (error) { 67 | console.error('Error processing Tavily search:', error); 68 | } 69 | ``` 70 | 71 | ### Disclaimer 72 | 73 | Ensure you have proper API credentials and respect Tavily's usage terms and rate limits. The search results are optimized for current events and may vary based on the time of the query. 74 | -------------------------------------------------------------------------------- /packages/tools/src/tavily/tool.stories.jsx: -------------------------------------------------------------------------------- 1 | import { ToolPreviewer } from '../_utils/ToolPreviewer.jsx'; 2 | import { TavilySearchResults } from './index.ts'; 3 | import { Agent, Task, Team } from '../../../../'; 4 | import React from 'react'; 5 | import { AgentWithToolPreviewer } from '../_utils/AgentWithToolPreviewer.jsx'; 6 | 7 | // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export 8 | export default { 9 | title: 'Tools/Tavily', 10 | component: ToolPreviewer, 11 | parameters: { 12 | // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout 13 | layout: 'centered', 14 | }, 15 | // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs 16 | tags: ['autodocs'], 17 | // More on argTypes: https://storybook.js.org/docs/api/argtypes 18 | argTypes: { 19 | // backgroundColor: { control: 'color' }, 20 | }, 21 | }; 22 | 23 | const tavilyTool = new TavilySearchResults({ 24 | apiKey: import.meta.env.VITE_TAVILY_API_KEY, 25 | maxResults: 5, 26 | }); 27 | 28 | // Create an agent with the tavily tool 29 | const searchResearcher = new Agent({ 30 | name: 'Search Researcher', 31 | role: 'Web Search Analyzer', 32 | goal: 'Perform web searches and analyze the results', 33 | tools: [tavilyTool], 34 | maxIterations: 5, 35 | llmConfig: { 36 | provider: 'google', 37 | model: 'gemini-1.5-pro', 38 | }, 39 | }); 40 | 41 | // Create a research task 42 | const searchAnalysisTask = new Task({ 43 | description: 44 | 'Performs a web search for: {searchQuery} and provides a structured summary', 45 | agent: searchResearcher, 46 | expectedOutput: 'A well-formatted analysis of the search results', 47 | }); 48 | 49 | // Create the team 50 | const team = new Team({ 51 | name: 'Search Analysis Unit', 52 | description: 'Specialized team for web search and analysis', 53 | agents: [searchResearcher], 54 | tasks: [searchAnalysisTask], 55 | inputs: { 56 | searchQuery: 'What are the latest developments in AI?', 57 | }, 58 | env: { 59 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 60 | GOOGLE_API_KEY: import.meta.env.VITE_GOOGLE_API_KEY, 61 | }, 62 | }); 63 | 64 | // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args 65 | export const Default = { 66 | args: { 67 | toolInstance: tavilyTool, 68 | callParams: { 69 | searchQuery: 'What are the latest developments in AI?', 70 | }, 71 | }, 72 | }; 73 | 74 | export const withAgent = { 75 | render: (args) => , 76 | args: { 77 | team: team, 78 | }, 79 | }; 80 | -------------------------------------------------------------------------------- /packages/tools/src/textfile-search/rag/loaders/textInputLoader/index.ts: -------------------------------------------------------------------------------- 1 | import { BaseDocumentLoader } from '@langchain/core/document_loaders/base'; 2 | import { Document as BaseDocument } from 'langchain/document'; 3 | 4 | interface TextInputMetadata { 5 | [key: string]: any; 6 | } 7 | 8 | export class TextInputLoader extends BaseDocumentLoader { 9 | private text: string; 10 | private metadata: TextInputMetadata; 11 | 12 | constructor(text: string, metadata: TextInputMetadata = {}) { 13 | super(); 14 | this.text = text; 15 | this.metadata = metadata; 16 | } 17 | 18 | async load(): Promise { 19 | const document = new BaseDocument({ 20 | pageContent: this.text, 21 | metadata: this.metadata, 22 | }); 23 | return [document]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/tools/src/textfile-search/tool.stories.jsx: -------------------------------------------------------------------------------- 1 | import { ToolPreviewer } from '../_utils/ToolPreviewer.jsx'; 2 | import { AgentWithToolPreviewer } from '../_utils/AgentWithToolPreviewer.jsx'; 3 | import { TextFileSearch } from './index.ts'; 4 | import { Agent, Task, Team } from '../../../../'; 5 | import React from 'react'; 6 | 7 | export default { 8 | title: 'Tools/TextFileSearch', 9 | component: ToolPreviewer, 10 | parameters: { 11 | layout: 'centered', 12 | }, 13 | tags: ['autodocs'], 14 | }; 15 | 16 | const textFileTool = new TextFileSearch({ 17 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 18 | file: '../../public/kaiban.txt', 19 | }); 20 | 21 | // Create an agent with the text file tool 22 | const textFileAnalyzer = new Agent({ 23 | name: 'Text File Searcher', 24 | role: 'Text Content Analyzer', 25 | goal: 'Conduct semantic searches within the content of a particular text file', 26 | tools: [textFileTool], 27 | }); 28 | 29 | // Create a text analysis task 30 | const textAnalysisTask = new Task({ 31 | description: 32 | 'Conduct a semantic search on the following Text file: {file} and answer the question: {query}', 33 | expectedOutput: 34 | 'A detailed answer to the question based on the website content.', 35 | agent: textFileAnalyzer, 36 | }); 37 | 38 | // Create the team 39 | const team = new Team({ 40 | name: 'Text Search Team', 41 | agents: [textFileAnalyzer], 42 | tasks: [textAnalysisTask], 43 | inputs: { 44 | file: '../../public/kaiban.txt', 45 | query: 'What is the Kaiban Board?', 46 | }, 47 | env: { 48 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 49 | }, 50 | }); 51 | 52 | export const Default = { 53 | args: { 54 | toolInstance: textFileTool, 55 | callParams: { 56 | query: 'What is the Kaiban Board?', 57 | }, 58 | }, 59 | }; 60 | 61 | export const withAgent = { 62 | render: (args) => , 63 | args: { 64 | team: team, 65 | }, 66 | }; 67 | -------------------------------------------------------------------------------- /packages/tools/src/website-search/rag/loaders/textInputLoader/index.ts: -------------------------------------------------------------------------------- 1 | import { BaseDocumentLoader } from '@langchain/core/document_loaders/base'; 2 | import { Document as BaseDocument } from 'langchain/document'; 3 | 4 | interface TextInputMetadata { 5 | [key: string]: any; 6 | } 7 | 8 | export class TextInputLoader extends BaseDocumentLoader { 9 | private text: string; 10 | private metadata: TextInputMetadata; 11 | 12 | constructor(text: string, metadata: TextInputMetadata = {}) { 13 | super(); 14 | this.text = text; 15 | this.metadata = metadata; 16 | } 17 | 18 | async load(): Promise { 19 | const document = new BaseDocument({ 20 | pageContent: this.text, 21 | metadata: this.metadata, 22 | }); 23 | return [document]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/tools/src/website-search/tool.stories.jsx: -------------------------------------------------------------------------------- 1 | import { ToolPreviewer } from '../_utils/ToolPreviewer.jsx'; 2 | import { AgentWithToolPreviewer } from '../_utils/AgentWithToolPreviewer.jsx'; 3 | import { WebsiteSearch } from './index.ts'; 4 | import { Agent, Task, Team } from '../../../../'; 5 | import React from 'react'; 6 | 7 | export default { 8 | title: 'Tools/WebsiteSearch', 9 | component: ToolPreviewer, 10 | parameters: { 11 | layout: 'centered', 12 | }, 13 | tags: ['autodocs'], 14 | }; 15 | 16 | const websiteSearchTool = new WebsiteSearch({ 17 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 18 | url: 'https://docs.kaibanjs.com/get-started/The%20Kaiban%20Board', 19 | }); 20 | 21 | // Create an agent with the website search tool 22 | const webSearcher = new Agent({ 23 | name: 'Web Searcher', 24 | role: 'Web Content Analyzer', 25 | goal: 'Conduct semantic searches within the content of a particular website', 26 | tools: [websiteSearchTool], 27 | }); 28 | 29 | // Create a search task 30 | const searchTask = new Task({ 31 | description: 32 | 'Conduct a semantic search on the following URL: {url} and answer the question: {query}', 33 | expectedOutput: 34 | 'A detailed answer to the question based on the website content.', 35 | agent: webSearcher, 36 | }); 37 | 38 | // Create the team 39 | const team = new Team({ 40 | name: 'Web Search Team', 41 | agents: [webSearcher], 42 | tasks: [searchTask], 43 | inputs: { 44 | url: 'https://docs.kaibanjs.com/get-started/The%20Kaiban%20Board', 45 | query: 'What is the Kaiban Board?', 46 | }, 47 | env: { 48 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 49 | }, 50 | }); 51 | 52 | export const Default = { 53 | args: { 54 | toolInstance: websiteSearchTool, 55 | callParams: { 56 | url: 'https://docs.kaibanjs.com/get-started/The%20Kaiban%20Board', 57 | query: 'What is the Kaiban Board?', 58 | }, 59 | }, 60 | }; 61 | 62 | export const withAgent = { 63 | render: (args) => , 64 | args: { 65 | team: team, 66 | }, 67 | }; 68 | -------------------------------------------------------------------------------- /packages/tools/src/wolfram-alpha/README.md: -------------------------------------------------------------------------------- 1 | # WolframAlpha Tool 2 | 3 | This tool integrates with WolframAlpha (https://www.wolframalpha.com/), a computational intelligence engine that provides robust and detailed answers to complex queries across various domains. It leverages WolframAlpha's powerful computational capabilities to handle advanced calculations, data analysis, and domain-specific queries. 4 | 5 | ## Components 6 | 7 | The tool uses the following components: 8 | 9 | - A WolframAlpha API client instance 10 | - An App ID for authentication 11 | - A custom HTTP client (ky) for making API requests 12 | - Input validation using Zod schema 13 | 14 | ## Key Features 15 | 16 | - Advanced computations and data analysis 17 | - Scientific and mathematical calculations 18 | - Real-time data processing 19 | - Domain-specific knowledge in: 20 | - Mathematics 21 | - Physics 22 | - Chemistry 23 | - Engineering 24 | - Earth Sciences 25 | - Life Sciences 26 | - Units & Measures 27 | - Financial calculations 28 | - And more 29 | 30 | ## Input 31 | 32 | The input should be a JSON object with a "query" field containing the question or computation to process. 33 | 34 | ## Output 35 | 36 | The output is the response from WolframAlpha's computational engine, providing detailed answers and calculations based on the input query. 37 | 38 | ## Example 39 | 40 | ```javascript 41 | const tool = new WolframAlphaTool({ 42 | appId: 'your-app-id', 43 | }); 44 | 45 | const result = await tool._call({ 46 | query: 'solve x^2 + 2x + 1 = 0', 47 | }); 48 | ``` 49 | 50 | ## Prerequisites 51 | 52 | - WolframAlpha API credentials (App ID) 53 | - Sign up for API access at: https://developer.wolframalpha.com/ 54 | 55 | ## Advanced Example with Error Handling 56 | 57 | ```javascript 58 | const tool = new WolframAlphaTool({ 59 | appId: process.env.WOLFRAM_APP_ID, 60 | }); 61 | 62 | try { 63 | const result = await tool._call({ 64 | query: 'calculate the orbital period of Mars', 65 | }); 66 | console.log(result); 67 | } catch (error) { 68 | console.error('Error processing WolframAlpha query:', error); 69 | } 70 | ``` 71 | 72 | ### Disclaimer 73 | 74 | Ensure you have proper API credentials and respect WolframAlpha's usage terms and rate limits. 75 | -------------------------------------------------------------------------------- /packages/tools/src/wolfram-alpha/tool.stories.jsx: -------------------------------------------------------------------------------- 1 | import { ToolPreviewer } from '../_utils/ToolPreviewer.jsx'; 2 | import { WolframAlphaTool } from './index.ts'; 3 | import { Agent, Task, Team } from '../../../../'; 4 | import React from 'react'; 5 | import { AgentWithToolPreviewer } from '../_utils/AgentWithToolPreviewer.jsx'; 6 | 7 | export default { 8 | title: 'Tools/WolframAlpha', 9 | component: ToolPreviewer, 10 | parameters: { 11 | layout: 'centered', 12 | }, 13 | tags: ['autodocs'], 14 | argTypes: {}, 15 | }; 16 | 17 | const wolframTool = new WolframAlphaTool({ 18 | appId: import.meta.env.VITE_WOLFRAM_APP_ID, 19 | }); 20 | 21 | // Create an agent with the wolfram tool 22 | const mathScientist = new Agent({ 23 | name: 'Euler', 24 | role: 'Mathematical and Scientific Analyst', 25 | goal: 'Solve complex mathematical and scientific problems with precise calculations and detailed explanations.', 26 | background: 'Advanced Mathematics and Scientific Computing', 27 | tools: [wolframTool], 28 | }); 29 | 30 | // Create a computation task 31 | const computationTask = new Task({ 32 | description: 33 | 'Analyze and solve the following problem: {query}. Provide detailed steps and explanations in markdown format.', 34 | expectedOutput: 35 | 'A comprehensive solution in markdown format including calculations, visualizations (if applicable), and detailed explanations. Markdown format.', 36 | agent: mathScientist, 37 | }); 38 | 39 | // Create the team 40 | const team = new Team({ 41 | name: 'Scientific Computing Team', 42 | agents: [mathScientist], 43 | tasks: [computationTask], 44 | inputs: { 45 | query: 'Calculate the orbital period of Mars around the Sun', 46 | }, 47 | env: { 48 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 49 | }, 50 | }); 51 | 52 | export const Default = { 53 | args: { 54 | toolInstance: wolframTool, 55 | callParams: { 56 | query: 'Calculate the orbital period of Mars around the Sun', 57 | }, 58 | }, 59 | }; 60 | 61 | export const withAgent = { 62 | render: (args) => , 63 | args: { 64 | team: team, 65 | }, 66 | }; 67 | -------------------------------------------------------------------------------- /packages/tools/src/zapier-webhook/README.md: -------------------------------------------------------------------------------- 1 | # Zapier Webhook Tool 2 | 3 | The Zapier Webhook Tool allows AI agents to interact with Zapier's webhook service, enabling seamless integration with thousands of apps and services supported by Zapier. 4 | 5 | ## Purpose 6 | 7 | The Zapier Webhook Tool is designed to extend the capabilities of AI agents by allowing them to trigger workflows and automate tasks across various applications using Zapier's webhook functionality. This tool is ideal for scenarios where agents need to interact with multiple services and automate complex workflows. 8 | 9 | ## Features 10 | 11 | - Easy integration with Zapier's webhook service 12 | - Trigger workflows and automate tasks across thousands of apps 13 | - Configurable options for webhook events and payloads 14 | 15 | ## Usage 16 | 17 | To use the Zapier Webhook Tool, follow these steps: 18 | 19 | **Configure the Tool**: Create an instance of the `ZapierWebhook` tool with the required configuration. 20 | 21 | ```javascript 22 | import { z } from 'zod'; 23 | 24 | const zapierTool = new ZapierWebhook({ 25 | url: 'https://hooks.zapier.com/hooks/catch/4716958/2sdvyu2', // Set your Zapier webhook URL here 26 | schema: z.object({ 27 | emailSubject: z.string().describe('The subject of the email.'), 28 | issuesSummary: z.string().describe('The summary of the issues.'), 29 | }), 30 | }); 31 | ``` 32 | 33 | **Use the Tool**: Integrate the tool into your workflow or agent. 34 | 35 | ```javascript 36 | const response = await zapierTool._call({ 37 | emailSubject: 'Weekly GitHub Issues Report', 38 | issuesSummary: 'Summary of the issues found in the repository.', 39 | }); 40 | 41 | console.log(response); 42 | ``` 43 | 44 | For questions or discussions, join our [Discord](https://kaibanjs.com/discord). 45 | 46 | ## License 47 | 48 | MIT License 49 | -------------------------------------------------------------------------------- /packages/tools/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "module": "ESNext", 5 | "lib": ["ES2020", "DOM"], 6 | "moduleResolution": "bundler", 7 | "esModuleInterop": true, 8 | "strict": true, 9 | "strictNullChecks": true, 10 | "resolveJsonModule": true, 11 | "skipLibCheck": true, 12 | "skipDefaultLibCheck": true, 13 | "declaration": true, 14 | "declarationDir": "./dist/types", 15 | "outDir": "./dist", 16 | "rootDir": "src", 17 | "baseUrl": ".", 18 | "paths": { 19 | "*": ["node_modules/*"] 20 | } 21 | }, 22 | "include": ["src/**/*", "src/server.ts"], 23 | "exclude": ["node_modules", "dist", "**/*.test.ts"] 24 | } 25 | -------------------------------------------------------------------------------- /playground/nodejs-esm/.env.example: -------------------------------------------------------------------------------- 1 | # OpenAI API Key for KaibanJS 2 | OPENAI_API_KEY=your-api-key-here -------------------------------------------------------------------------------- /playground/nodejs-esm/README.md: -------------------------------------------------------------------------------- 1 | # Node.js ESM Example 2 | 3 | This example demonstrates using KaibanJS in a Node.js environment with ESM (ECMAScript Modules) imports. It includes both ESM and CommonJS versions of the same code to showcase compatibility across different module systems. 4 | 5 | ## Environment Setup 6 | 7 | - Node.js version: >=21.0.0 (tested with Node.js 21) 8 | - KaibanJS version: ^0.14.0 9 | 10 | ## Project Structure 11 | 12 | ``` 13 | nodejs-esm/ 14 | ├── .env # Environment variables configuration 15 | ├── index.js # ESM version using import statements 16 | ├── index.cjs # CommonJS version using require statements 17 | └── package.json # Project configuration with "type": "module" 18 | ``` 19 | 20 | ## Key Features 21 | 22 | - Demonstrates KaibanJS usage in a Node.js environment 23 | - Shows both ESM and CommonJS module system compatibility 24 | - Implements a complete team workflow with multiple agents and tasks 25 | - Includes proper error handling and workflow status monitoring 26 | 27 | ## Getting Started 28 | 29 | 1. Install dependencies: 30 | 31 | ```bash 32 | npm install 33 | ``` 34 | 35 | 2. Configure your environment: 36 | 37 | - Copy `.env.example` to `.env` (if not already done) 38 | - Add your OpenAI API key to `.env`: 39 | ``` 40 | OPENAI_API_KEY=your-api-key-here 41 | ``` 42 | 43 | 3. Run the examples: 44 | 45 | ```bash 46 | # Run ESM version 47 | npm start 48 | 49 | # Run CommonJS version 50 | npm run start:cjs 51 | ``` 52 | 53 | ## Code Examples 54 | 55 | ### ESM Version (index.js) 56 | 57 | ```javascript 58 | import { Agent, Task, Team } from 'kaibanjs'; 59 | ``` 60 | 61 | ### CommonJS Version (index.cjs) 62 | 63 | ```javascript 64 | const { Agent, Task, Team } = require('kaibanjs'); 65 | ``` 66 | 67 | ## Notes 68 | 69 | - This example demonstrates that KaibanJS works in Node.js environments without requiring React as a dependency 70 | - The example uses zustand's core functionality without React-specific features 71 | - Both ESM and CommonJS versions implement the same functionality to showcase module system compatibility 72 | -------------------------------------------------------------------------------- /playground/nodejs-esm/index.cjs: -------------------------------------------------------------------------------- 1 | // CommonJS version 2 | const { Agent, Task, Team } = require('kaibanjs'); 3 | const dotenv = require('dotenv'); 4 | 5 | dotenv.config(); 6 | 7 | // Create multiple agents with different roles 8 | const researcher = new Agent({ 9 | name: 'ResearchBot', 10 | role: 'Research Specialist', 11 | goal: 'Gather and analyze information', 12 | background: 'Expert in data collection and analysis', 13 | }); 14 | 15 | const writer = new Agent({ 16 | name: 'WriterBot', 17 | role: 'Content Writer', 18 | goal: 'Create engaging content from research', 19 | background: 'Professional content creator and editor', 20 | }); 21 | 22 | const reviewer = new Agent({ 23 | name: 'ReviewBot', 24 | role: 'Quality Reviewer', 25 | goal: 'Ensure content meets quality standards', 26 | background: 'Quality assurance specialist', 27 | }); 28 | 29 | // Create tasks for each agent 30 | const researchTask = new Task({ 31 | title: 'Research Topic', 32 | description: 'Research the given topic and extract key information', 33 | expectedOutput: 'Structured research data', 34 | agent: researcher, 35 | }); 36 | 37 | const writingTask = new Task({ 38 | title: 'Create Content', 39 | description: 'Transform research into engaging content', 40 | expectedOutput: 'Draft content', 41 | agent: writer, 42 | }); 43 | 44 | const reviewTask = new Task({ 45 | title: 'Review Content', 46 | description: 'Review and polish the content', 47 | expectedOutput: 'Final polished content', 48 | agent: reviewer, 49 | }); 50 | 51 | // Create and configure the team 52 | const team = new Team({ 53 | name: 'Content Creation Team', 54 | agents: [researcher, writer, reviewer], 55 | tasks: [researchTask, writingTask, reviewTask], 56 | inputs: { 57 | topic: 58 | 'The impact of artificial intelligence on modern software development', 59 | }, 60 | env: { OPENAI_API_KEY: process.env.OPENAI_API_KEY }, 61 | }); 62 | 63 | // Subscribe to team status updates 64 | const unsubscribe = team.subscribeToChanges( 65 | (updatedFields) => { 66 | console.log('Team Status Updated:', updatedFields); 67 | }, 68 | ['teamWorkflowStatus'] 69 | ); 70 | 71 | // Start the team workflow 72 | console.log('Starting team workflow...'); 73 | (async () => { 74 | try { 75 | const result = await team.start(); 76 | console.log('Final Result:', result); 77 | } catch (error) { 78 | console.error('Error during workflow:', error); 79 | } finally { 80 | unsubscribe(); 81 | } 82 | })(); 83 | -------------------------------------------------------------------------------- /playground/nodejs-esm/index.js: -------------------------------------------------------------------------------- 1 | // ESM version 2 | import { Agent, Task, Team } from 'kaibanjs'; 3 | import * as dotenv from 'dotenv'; 4 | 5 | dotenv.config(); 6 | 7 | // Create multiple agents with different roles 8 | const researcher = new Agent({ 9 | name: 'ResearchBot', 10 | role: 'Research Specialist', 11 | goal: 'Gather and analyze information', 12 | background: 'Expert in data collection and analysis', 13 | }); 14 | 15 | const writer = new Agent({ 16 | name: 'WriterBot', 17 | role: 'Content Writer', 18 | goal: 'Create engaging content from research', 19 | background: 'Professional content creator and editor', 20 | }); 21 | 22 | const reviewer = new Agent({ 23 | name: 'ReviewBot', 24 | role: 'Quality Reviewer', 25 | goal: 'Ensure content meets quality standards', 26 | background: 'Quality assurance specialist', 27 | }); 28 | 29 | // Create tasks for each agent 30 | const researchTask = new Task({ 31 | title: 'Research Topic', 32 | description: 'Research the given topic and extract key information', 33 | expectedOutput: 'Structured research data', 34 | agent: researcher, 35 | }); 36 | 37 | const writingTask = new Task({ 38 | title: 'Create Content', 39 | description: 'Transform research into engaging content', 40 | expectedOutput: 'Draft content', 41 | agent: writer, 42 | }); 43 | 44 | const reviewTask = new Task({ 45 | title: 'Review Content', 46 | description: 'Review and polish the content', 47 | expectedOutput: 'Final polished content', 48 | agent: reviewer, 49 | }); 50 | 51 | // Create and configure the team 52 | const team = new Team({ 53 | name: 'Content Creation Team', 54 | agents: [researcher, writer, reviewer], 55 | tasks: [researchTask, writingTask, reviewTask], 56 | inputs: { 57 | topic: 58 | 'The impact of artificial intelligence on modern software development', 59 | }, 60 | env: { OPENAI_API_KEY: process.env.OPENAI_API_KEY }, 61 | }); 62 | 63 | // Subscribe to team status updates 64 | const unsubscribe = team.subscribeToChanges( 65 | (updatedFields) => { 66 | console.log('Team Status Updated:', updatedFields); 67 | }, 68 | ['teamWorkflowStatus'] 69 | ); 70 | 71 | // Start the team workflow 72 | console.log('Starting team workflow...'); 73 | try { 74 | const result = await team.start(); 75 | console.log('Final Result:', result); 76 | } catch (error) { 77 | console.error('Error during workflow:', error); 78 | } finally { 79 | unsubscribe(); 80 | } 81 | -------------------------------------------------------------------------------- /playground/nodejs-esm/mcp-esm.js: -------------------------------------------------------------------------------- 1 | // Assuming kaibanjs is a local module or a placeholder for demonstration purposes 2 | import { Agent, Task, Team } from 'kaibanjs'; 3 | import { MultiServerMCPClient } from '@langchain/mcp-adapters'; 4 | import * as dotenv from 'dotenv'; 5 | 6 | dotenv.config(); 7 | 8 | const mcpClient = new MultiServerMCPClient({ 9 | // Whether to prefix tool names with the server name (optional, default: true) 10 | prefixToolNameWithServerName: false, 11 | // Optional additional prefix for tool names (optional, default: "mcp") 12 | additionalToolNamePrefix: '', 13 | mcpServers: { 14 | tavily: { 15 | command: 'npx', 16 | args: ['-y', 'tavily-mcp@0.2.0'], 17 | env: { 18 | TAVILY_API_KEY: process.env.TAVILY_API_KEY || '', 19 | PATH: process.env.PATH || '', 20 | }, 21 | }, 22 | }, 23 | }); 24 | 25 | const tavilyTools = await mcpClient.getTools('tavily'); 26 | const searchTool = tavilyTools.find((tool) => tool.name === 'tavily-search'); 27 | 28 | // Define agents 29 | const searchAgent = new Agent({ 30 | name: 'Scout', 31 | role: 'Information Gatherer', 32 | goal: 'Find up-to-date information about the given sports query.', 33 | background: 'Research', 34 | tools: [searchTool], 35 | }); 36 | 37 | // Define tasks 38 | const searchTask = new Task({ 39 | description: `Search for detailed information about the sports query: {sportsQuery}.`, 40 | expectedOutput: 41 | 'Detailed information about the sports event. Key players, key moments, final score and other usefull information.', 42 | agent: searchAgent, 43 | }); 44 | 45 | // Team to coordinate the agents 46 | const team = new Team({ 47 | name: 'Sports Content Creation Team', 48 | agents: [searchAgent], 49 | tasks: [searchTask], 50 | inputs: { sportsQuery: 'Who won the Copa America in 2024?' }, // Placeholder for dynamic input 51 | env: { 52 | OPENAI_API_KEY: process.env.OPENAI_API_KEY, 53 | }, 54 | // Results of the latest UEFA Champions League match. 55 | }); 56 | 57 | // Subscribe to team status updates 58 | const unsubscribe = team.subscribeToChanges( 59 | (updatedFields) => { 60 | console.log('Team Status Updated:', updatedFields); 61 | }, 62 | ['teamWorkflowStatus'] 63 | ); 64 | 65 | // Start the team workflow 66 | console.log('Starting team workflow...'); 67 | try { 68 | const result = await team.start(); 69 | console.log('Final Result:', result); 70 | } catch (error) { 71 | console.error('Error during workflow:', error); 72 | } finally { 73 | unsubscribe(); 74 | } 75 | -------------------------------------------------------------------------------- /playground/nodejs-esm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodejs-esm", 3 | "version": "1.0.0", 4 | "description": "Reproduction of ESM import issue with KaibanJS", 5 | "type": "module", 6 | "main": "index.js", 7 | "scripts": { 8 | "start": "node index.js", 9 | "start:cjs": "node index.cjs" 10 | }, 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "@langchain/mcp-adapters": "^0.4.5", 15 | "dotenv": "^16.4.5", 16 | "kaibanjs": "file:../.." 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /playground/nodejs-ts/README.md: -------------------------------------------------------------------------------- 1 | # KaibanJS - NodeJS Typescript Example 2 | 3 | ### Getting started 4 | 5 | To begin using kaibanjs using typescript support. 6 | 7 | 1. Install the kaibanjs library like normal. 8 | 9 | `npm install kaibanjs` 10 | 11 | 2. Install typescript as a dev depedency. 12 | 13 | `npm install typescript --save-dev` 14 | 15 | (Optional) You may create a custom tsconfig.json file if needed. 16 | A basic configuration would look something like this:- 17 | 18 | ```json 19 | { 20 | "compilerOptions": { 21 | "noEmit": true, 22 | "strict": true, 23 | "module": "NodeNext", 24 | "moduleResolution": "NodeNext", 25 | "esModuleInterop": true, 26 | "skipLibCheck": true 27 | }, 28 | "exclude": ["node_modules"] 29 | } 30 | ``` 31 | 32 | 3. And now you can start using kaibanjs with full typescript support. 33 | Main classes are typed and can be called directly from the library - `Agent`, `Task` and `Type`. 34 | 35 | `import { Agent, Task, Team } from "kaibanjs";` 36 | 37 | For any specific types, can call them like below:- 38 | 39 | `import type { IAgentParams, ITaskParams } from "kaibanjs";` 40 | 41 | You can check the index.ts as a good reference to get started. 42 | 43 | ### Development 44 | 45 | > NOTE: Make sure your local typed package is built. (Use `npm run build` in the root folder to build the package if haven't already) 46 | 47 | For testing the playground example, setup as follows:- 48 | 49 | 1. Install all dependencies 50 | 51 | `npm i` 52 | 53 | 2. Run the example! 54 | 55 | `npm run start` 56 | -------------------------------------------------------------------------------- /playground/nodejs-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodejs-ts", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.ts", 6 | "type": "module", 7 | "scripts": { 8 | "start": "tsx index.ts" 9 | }, 10 | "author": "", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "@types/node": "^22.5.1", 14 | "copyfiles": "^2.4.1", 15 | "dotenv": "^16.4.5", 16 | "tslib": "^2.7.0", 17 | "tsx": "^4.19.0", 18 | "typescript": "^4.5.4" 19 | }, 20 | "dependencies": { 21 | "kaibanjs": "file:../.." 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /playground/nodejs-ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./../../", 4 | "noEmit": true, 5 | "strict": true, 6 | "module": "NodeNext", 7 | "moduleResolution": "NodeNext", 8 | "esModuleInterop": true, 9 | "skipLibCheck": true, 10 | "paths": { 11 | "kaibanjs/*": ["./dist/*"] 12 | } 13 | }, 14 | "exclude": ["node_modules"] 15 | } 16 | -------------------------------------------------------------------------------- /playground/nodejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodejs", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "@langchain/mcp-adapters": "^0.4.5", 13 | "dotenv": "^16.4.5", 14 | "kaibanjs": "file:../.." 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /playground/react/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { browser: true, es2020: true }, 4 | extends: [ 5 | 'eslint:recommended', 6 | 'plugin:react/recommended', 7 | 'plugin:react/jsx-runtime', 8 | 'plugin:react-hooks/recommended', 9 | 'plugin:storybook/recommended', 10 | ], 11 | ignorePatterns: ['dist', '.eslintrc.cjs'], 12 | parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, 13 | settings: { react: { version: '18.2' } }, 14 | plugins: ['react-refresh'], 15 | rules: { 16 | 'react/jsx-no-target-blank': 'off', 17 | 'react-refresh/only-export-components': [ 18 | 'warn', 19 | { allowConstantExport: true }, 20 | ], 21 | }, 22 | }; 23 | -------------------------------------------------------------------------------- /playground/react/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | 26 | *storybook.log -------------------------------------------------------------------------------- /playground/react/.storybook/main.js: -------------------------------------------------------------------------------- 1 | /** @type { import('@storybook/react-vite').StorybookConfig } */ 2 | const config = { 3 | stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], 4 | addons: [ 5 | '@storybook/addon-onboarding', 6 | '@storybook/addon-links', 7 | '@storybook/addon-essentials', 8 | '@chromatic-com/storybook', 9 | '@storybook/addon-interactions', 10 | ], 11 | framework: { 12 | name: '@storybook/react-vite', 13 | options: {}, 14 | }, 15 | }; 16 | export default config; 17 | -------------------------------------------------------------------------------- /playground/react/.storybook/preview.js: -------------------------------------------------------------------------------- 1 | /** @type { import('@storybook/react').Preview } */ 2 | const preview = { 3 | parameters: { 4 | controls: { 5 | matchers: { 6 | color: /(background|color)$/i, 7 | date: /Date$/i, 8 | }, 9 | }, 10 | }, 11 | }; 12 | 13 | export default preview; 14 | -------------------------------------------------------------------------------- /playground/react/README.md: -------------------------------------------------------------------------------- 1 | # React + Vite 2 | 3 | This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. 4 | 5 | Currently, two official plugins are available: 6 | 7 | - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh 8 | - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh 9 | -------------------------------------------------------------------------------- /playground/react/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | KaibanJS Playground 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /playground/react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react", 3 | "private": true, 4 | "version": "0.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "vite build", 9 | "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", 10 | "preview": "vite preview", 11 | "storybook": "storybook dev -p 6006", 12 | "build-storybook": "storybook build" 13 | }, 14 | "dependencies": { 15 | "@agentic/stdlib": "^7.6.4", 16 | "@langchain/cloudflare": "^0.1.0", 17 | "@langchain/cohere": "^0.3.3", 18 | "@langchain/community": "^0.3.43", 19 | "@langchain/groq": "^0.2.2", 20 | "@langchain/ollama": "^0.2.0", 21 | "@langchain/tavily": "^0.1.1", 22 | "kaibanjs": "file:../..", 23 | "mathjs": "^13.0.3", 24 | "octokit": "^4.0.2", 25 | "react": "^18.2.0", 26 | "react-dom": "^18.2.0" 27 | }, 28 | "devDependencies": { 29 | "@chromatic-com/storybook": "^1.6.1", 30 | "@storybook/addon-essentials": "^8.2.6", 31 | "@storybook/addon-interactions": "^8.2.6", 32 | "@storybook/addon-links": "^8.2.6", 33 | "@storybook/addon-onboarding": "^8.2.6", 34 | "@storybook/blocks": "^8.2.6", 35 | "@storybook/react": "^8.2.6", 36 | "@storybook/react-vite": "^8.2.6", 37 | "@storybook/test": "^8.2.6", 38 | "@types/react": "^18.2.66", 39 | "@types/react-dom": "^18.2.22", 40 | "@vitejs/plugin-react": "^4.2.1", 41 | "eslint": "^8.57.0", 42 | "eslint-plugin-react": "^7.34.1", 43 | "eslint-plugin-react-hooks": "^4.6.0", 44 | "eslint-plugin-react-refresh": "^0.4.6", 45 | "eslint-plugin-storybook": "^0.8.0", 46 | "prop-types": "^15.8.1", 47 | "storybook": "^8.2.6", 48 | "vite": "^5.2.0" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /playground/react/src/App.jsx: -------------------------------------------------------------------------------- 1 | import AgentsBoardDebugger from './AgentsBoardDebugger'; 2 | import team from './teams/product_specs/openai'; 3 | 4 | function App() { 5 | return ( 6 |
7 |

KaibanJS Playground

8 | 9 |
10 | ); 11 | } 12 | 13 | export default App; 14 | -------------------------------------------------------------------------------- /playground/react/src/components/Spinner.jsx: -------------------------------------------------------------------------------- 1 | import './spinner.css'; 2 | 3 | export default function Spinner() { 4 | return
; 5 | } 6 | -------------------------------------------------------------------------------- /playground/react/src/components/spinner.css: -------------------------------------------------------------------------------- 1 | .spinner { 2 | width: 1.8rem; 3 | height: 1.8rem; 4 | border-radius: 50%; 5 | box-sizing: border-box; 6 | border-top: 4px solid #fff; 7 | border-left: 4px solid #fff; 8 | border-right: 4px solid #ff00; 9 | animation: spinner 0.7s infinite linear; 10 | } 11 | 12 | @keyframes spinner { 13 | to { 14 | transform: rotate(360deg); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /playground/react/src/main.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import App from './App.jsx'; 4 | import './index.css'; 5 | 6 | ReactDOM.createRoot(document.getElementById('root')).render( 7 | 8 | 9 | 10 | ); 11 | -------------------------------------------------------------------------------- /playground/react/src/stories/Insights.stories.js: -------------------------------------------------------------------------------- 1 | import AgentsBoardDebugger from '../AgentsBoardDebugger'; 2 | import teamOpenAIWithInsights from '../teams/resume_creation/openai_with_insights'; 3 | import '../index.css'; 4 | 5 | export default { 6 | title: 'Features/Insights', 7 | component: AgentsBoardDebugger, 8 | }; 9 | 10 | export const ResumeCreation = { 11 | args: { 12 | team: teamOpenAIWithInsights, 13 | title: 'Resume Creation with Historical Placement Data', 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /playground/react/src/stories/LLMs.stories.js: -------------------------------------------------------------------------------- 1 | import AgentsBoardDebugger from '../AgentsBoardDebugger'; 2 | import '../index.css'; 3 | import teamOpenAI from '../teams/llms/openai'; 4 | import teamAnthropic from '../teams/llms/anthropic'; 5 | import teamGemini from '../teams/llms/gemini'; 6 | import teamMistral from '../teams/llms/mistral'; 7 | import teamOllama from '../teams/llms/ollama'; 8 | import teamCohere from '../teams/llms/cohere'; 9 | import teamAzureOpenAI from '../teams/llms/azure_openai'; 10 | import teamGroq from '../teams/llms/groq'; 11 | import teamDeepSeek from '../teams/llms/deepseek'; 12 | export default { 13 | title: 'LLMs/Playground', 14 | component: AgentsBoardDebugger, 15 | }; 16 | 17 | export const withOpenAI = { 18 | args: { 19 | team: teamOpenAI, 20 | title: 'With OpenAI', 21 | }, 22 | }; 23 | 24 | export const withAnthropic = { 25 | args: { 26 | team: teamAnthropic, 27 | title: 'With Anthropic', 28 | }, 29 | }; 30 | 31 | export const withGemini = { 32 | args: { 33 | team: teamGemini, 34 | title: 'With Gemini', 35 | }, 36 | }; 37 | 38 | export const withMistral = { 39 | args: { 40 | team: teamMistral, 41 | title: 'With Mistral', 42 | }, 43 | }; 44 | 45 | export const withOllama = { 46 | args: { 47 | team: teamOllama, 48 | title: 'With Ollama', 49 | }, 50 | }; 51 | 52 | export const withCohere = { 53 | args: { 54 | team: teamCohere, 55 | title: 'With Cohere', 56 | }, 57 | }; 58 | 59 | export const withAzureOpenAI = { 60 | args: { 61 | team: teamAzureOpenAI, 62 | title: 'With Azure OpenAI', 63 | }, 64 | }; 65 | 66 | export const withGroq = { 67 | args: { 68 | team: teamGroq, 69 | title: 'With Groq', 70 | }, 71 | }; 72 | 73 | export const withDeepSeek = { 74 | args: { 75 | team: teamDeepSeek, 76 | title: 'With DeepSeek', 77 | }, 78 | }; 79 | -------------------------------------------------------------------------------- /playground/react/src/stories/ResumeCreationTeam.stories.js: -------------------------------------------------------------------------------- 1 | import AgentsBoardDebugger from '../AgentsBoardDebugger'; 2 | import teamOpenAI from '../teams/resume_creation/openai'; 3 | import teamOpenAICustomPrompts from '../teams/resume_creation/openai_custom_prompts'; 4 | import teamOpenAIHITL from '../teams/resume_creation/openai_with_hitl'; 5 | import teamOpenAIReasoningModels from '../teams/resume_creation/openai_reasoning_models'; 6 | import '../index.css'; 7 | 8 | // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export 9 | export default { 10 | title: 'Teams/Resume Creation Team', 11 | component: AgentsBoardDebugger, 12 | }; 13 | 14 | // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args 15 | export const withOpenAI = { 16 | args: { 17 | team: teamOpenAI, 18 | title: 'With OpenAI Model', 19 | }, 20 | }; 21 | 22 | export const withHITLOpenAI = { 23 | args: { 24 | team: teamOpenAIHITL, 25 | title: 'With HITL and OpenAI Model', 26 | }, 27 | }; 28 | 29 | export const withCustomPromptsOpenAI = { 30 | args: { 31 | team: teamOpenAICustomPrompts, 32 | title: 'With Custom Prompts and OpenAI Model', 33 | }, 34 | }; 35 | 36 | export const withReasoningModelsOpenAI = { 37 | args: { 38 | team: teamOpenAIReasoningModels, 39 | title: 'With OpenAI Reasoning Models', 40 | }, 41 | }; 42 | -------------------------------------------------------------------------------- /playground/react/src/stories/SportNewsTeam.stories.js: -------------------------------------------------------------------------------- 1 | import AgentsBoardDebugger from '../AgentsBoardDebugger'; 2 | import teamOpenAI from '../teams/sport_news/openai'; 3 | import teamAnthropic from '../teams/sport_news/anthropic'; 4 | import teamGemini from '../teams/sport_news/gemini'; 5 | import teamMistral from '../teams/sport_news/mistral'; 6 | import teamDeepSeek from '../teams/sport_news/deepseek'; 7 | 8 | import '../index.css'; 9 | 10 | // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export 11 | export default { 12 | title: 'Teams/Sports News Team', 13 | component: AgentsBoardDebugger, 14 | }; 15 | 16 | // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args 17 | export const withOpenAI = { 18 | args: { 19 | team: teamOpenAI, 20 | title: 'With OpenAI Model', 21 | }, 22 | }; 23 | 24 | export const withAnthropic = { 25 | args: { 26 | team: teamAnthropic, 27 | title: 'With Anthropic Model', 28 | }, 29 | }; 30 | 31 | export const withGeminiAI = { 32 | args: { 33 | team: teamGemini, 34 | title: 'With Gemini Model', 35 | }, 36 | }; 37 | 38 | export const withMistral = { 39 | args: { 40 | team: teamMistral, 41 | title: 'With Mistral Model', 42 | }, 43 | }; 44 | 45 | export const withDeepSeek = { 46 | args: { 47 | team: teamDeepSeek, 48 | title: 'With DeepSeek Model', 49 | }, 50 | }; 51 | -------------------------------------------------------------------------------- /playground/react/src/stories/SummaryOutputSchema.stories.js: -------------------------------------------------------------------------------- 1 | import AgentsBoardDebugger from '../AgentsBoardDebugger'; 2 | import team from '../teams/output_schema/openai'; 3 | import '../index.css'; 4 | 5 | // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export 6 | export default { 7 | title: 'Teams/Summary with output schema', 8 | component: AgentsBoardDebugger, 9 | }; 10 | 11 | // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args 12 | export const withOpenAI = { 13 | args: { 14 | team, 15 | title: 'With OpenAI Model', 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /playground/react/src/stories/TaskBlocking.stories.js: -------------------------------------------------------------------------------- 1 | import AgentsBoardDebugger from '../AgentsBoardDebugger'; 2 | import securityTeam from '../teams/task_blocking/basic_blocking'; 3 | import '../index.css'; 4 | 5 | // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export 6 | export default { 7 | title: 'Features/Task Blocking', 8 | component: AgentsBoardDebugger, 9 | parameters: { 10 | layout: 'fullscreen', 11 | }, 12 | }; 13 | 14 | export const SecurityClearanceBlocking = { 15 | args: { 16 | team: securityTeam, 17 | title: 'Security Clearance Validation', 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /playground/react/src/stories/TaskChaining.stories.js: -------------------------------------------------------------------------------- 1 | import AgentsBoardDebugger from '../AgentsBoardDebugger'; 2 | import teamSequential from '../teams/event_planning/openai'; 3 | import teamParallel from '../teams/event_planning/openai_parallel'; 4 | import teamMixed from '../teams/event_planning/openai_mixed'; 5 | import '../index.css'; 6 | 7 | export default { 8 | title: 'Features/Task Chaining', 9 | component: AgentsBoardDebugger, 10 | }; 11 | 12 | export const SequentialEventPlanning = { 13 | args: { 14 | team: teamSequential, 15 | title: 'Event Planning with Sequential Tasks', 16 | }, 17 | }; 18 | 19 | export const ParallelEventPlanning = { 20 | args: { 21 | team: teamParallel, 22 | title: 'Event Planning with Parallel Tasks', 23 | }, 24 | }; 25 | 26 | export const MixedEventPlanning = { 27 | args: { 28 | team: teamMixed, 29 | title: 'Event Planning with Mixed Task Dependencies', 30 | }, 31 | }; 32 | -------------------------------------------------------------------------------- /playground/react/src/stories/TripPlanningTeam.stories.js: -------------------------------------------------------------------------------- 1 | import AgentsBoardDebugger from '../AgentsBoardDebugger'; 2 | import teamOpenAI from '../teams/trip_planning/openai'; 3 | import teamGemini from '../teams/trip_planning/gemini'; 4 | import '../index.css'; 5 | 6 | // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export 7 | export default { 8 | title: 'Teams/Trip Planning Team', 9 | component: AgentsBoardDebugger, 10 | }; 11 | 12 | // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args 13 | export const withOpenAI = { 14 | args: { 15 | team: teamOpenAI, 16 | title: 'With OpenAI Model', 17 | }, 18 | }; 19 | 20 | export const withGemini = { 21 | args: { 22 | team: teamGemini, 23 | title: 'With Gemini Model', 24 | }, 25 | }; 26 | -------------------------------------------------------------------------------- /playground/react/src/stories/WithProxy.stories.js: -------------------------------------------------------------------------------- 1 | import AgentsBoardDebugger from '../AgentsBoardDebugger'; 2 | import '../index.css'; 3 | import teamOpenAI from '../teams/with_proxy/openai'; 4 | import teamAnthropic from '../teams/with_proxy/anthropic'; 5 | import teamGemini from '../teams/with_proxy/gemini'; 6 | import teamMistral from '../teams/with_proxy/mistral'; 7 | // import teamCohere from "../teams/llms/cohere"; 8 | // import teamAzureOpenAI from "../teams/llms/azure_openai"; 9 | // import teamGroq from "../teams/llms/groq"; 10 | 11 | export default { 12 | title: 'LLMs/Using Proxy', 13 | component: AgentsBoardDebugger, 14 | }; 15 | 16 | export const withOpenAI = { 17 | args: { 18 | team: teamOpenAI, 19 | title: 'With OpenAI', 20 | }, 21 | }; 22 | 23 | export const withAnthropic = { 24 | args: { 25 | team: teamAnthropic, 26 | title: 'With Anthropic', 27 | }, 28 | }; 29 | 30 | export const withGemini = { 31 | args: { 32 | team: teamGemini, 33 | title: 'With Gemini', 34 | }, 35 | }; 36 | 37 | export const withMistral = { 38 | args: { 39 | team: teamMistral, 40 | title: 'With Mistral', 41 | }, 42 | }; 43 | 44 | // export const withCohere = { 45 | // args: { 46 | // team: teamCohere, 47 | // title: "With Cohere", 48 | // }, 49 | // }; 50 | 51 | // export const withAzureOpenAI = { 52 | // args: { 53 | // team: teamAzureOpenAI, 54 | // title: "With Azure OpenAI", 55 | // }, 56 | // }; 57 | 58 | // export const withGroq = { 59 | // args: { 60 | // team: teamGroq, 61 | // title: "With Groq", 62 | // }, 63 | // }; 64 | -------------------------------------------------------------------------------- /playground/react/src/stories/assets/accessibility.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaiban-ai/KaibanJS/100a08e3cd8cbe0dacd11cb36bb175bdb9d4835e/playground/react/src/stories/assets/accessibility.png -------------------------------------------------------------------------------- /playground/react/src/stories/assets/accessibility.svg: -------------------------------------------------------------------------------- 1 | Accessibility -------------------------------------------------------------------------------- /playground/react/src/stories/assets/addon-library.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaiban-ai/KaibanJS/100a08e3cd8cbe0dacd11cb36bb175bdb9d4835e/playground/react/src/stories/assets/addon-library.png -------------------------------------------------------------------------------- /playground/react/src/stories/assets/assets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaiban-ai/KaibanJS/100a08e3cd8cbe0dacd11cb36bb175bdb9d4835e/playground/react/src/stories/assets/assets.png -------------------------------------------------------------------------------- /playground/react/src/stories/assets/avif-test-image.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaiban-ai/KaibanJS/100a08e3cd8cbe0dacd11cb36bb175bdb9d4835e/playground/react/src/stories/assets/avif-test-image.avif -------------------------------------------------------------------------------- /playground/react/src/stories/assets/context.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaiban-ai/KaibanJS/100a08e3cd8cbe0dacd11cb36bb175bdb9d4835e/playground/react/src/stories/assets/context.png -------------------------------------------------------------------------------- /playground/react/src/stories/assets/discord.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /playground/react/src/stories/assets/docs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaiban-ai/KaibanJS/100a08e3cd8cbe0dacd11cb36bb175bdb9d4835e/playground/react/src/stories/assets/docs.png -------------------------------------------------------------------------------- /playground/react/src/stories/assets/figma-plugin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaiban-ai/KaibanJS/100a08e3cd8cbe0dacd11cb36bb175bdb9d4835e/playground/react/src/stories/assets/figma-plugin.png -------------------------------------------------------------------------------- /playground/react/src/stories/assets/github.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /playground/react/src/stories/assets/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaiban-ai/KaibanJS/100a08e3cd8cbe0dacd11cb36bb175bdb9d4835e/playground/react/src/stories/assets/share.png -------------------------------------------------------------------------------- /playground/react/src/stories/assets/styling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaiban-ai/KaibanJS/100a08e3cd8cbe0dacd11cb36bb175bdb9d4835e/playground/react/src/stories/assets/styling.png -------------------------------------------------------------------------------- /playground/react/src/stories/assets/testing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaiban-ai/KaibanJS/100a08e3cd8cbe0dacd11cb36bb175bdb9d4835e/playground/react/src/stories/assets/testing.png -------------------------------------------------------------------------------- /playground/react/src/stories/assets/theming.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaiban-ai/KaibanJS/100a08e3cd8cbe0dacd11cb36bb175bdb9d4835e/playground/react/src/stories/assets/theming.png -------------------------------------------------------------------------------- /playground/react/src/stories/assets/tutorials.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /playground/react/src/stories/assets/youtube.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /playground/react/src/teams/llms/deepseek.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | // Define agents 4 | const profileAnalyst = new Agent({ 5 | name: 'Mary', 6 | role: 'Profile Analyst', 7 | goal: 'Extract structured information from conversational user input.', 8 | background: 'Data Processor', 9 | tools: [], 10 | llmConfig: { 11 | provider: 'deepseek', 12 | model: 'deepseek-reasoner', 13 | }, 14 | }); 15 | 16 | const resumeWriter = new Agent({ 17 | name: 'Alex Mercer', 18 | role: 'Resume Writer', 19 | goal: `Craft compelling, well-structured resumes 20 | that effectively showcase job seekers qualifications and achievements.`, 21 | background: `Extensive experience in recruiting, 22 | copywriting, and human resources, enabling 23 | effective resume design that stands out to employers.`, 24 | tools: [], 25 | llmConfig: { 26 | provider: 'deepseek', 27 | model: 'deepseek-reasoner', 28 | }, 29 | }); 30 | 31 | // Define tasks 32 | const processingTask = new Task({ 33 | description: `Extract relevant details such as name, 34 | experience, skills, and job history from the user's 'aboutMe' input. 35 | aboutMe: {aboutMe}`, 36 | expectedOutput: 'Structured data ready to be used for a resume creation.', 37 | agent: profileAnalyst, 38 | }); 39 | 40 | const resumeCreationTask = new Task({ 41 | description: `Utilize the structured data to create 42 | a detailed and attractive resume. 43 | Enrich the resume content by inferring additional details from the provided information. 44 | Include sections such as a personal summary, detailed work experience, skills, and educational background.`, 45 | expectedOutput: `A professionally formatted resume in markdown format, 46 | ready for submission to potential employers.`, 47 | agent: resumeWriter, 48 | }); 49 | 50 | // Create a team 51 | const team = new Team({ 52 | name: 'Resume Creation Team', 53 | agents: [profileAnalyst, resumeWriter], 54 | tasks: [processingTask, resumeCreationTask], 55 | inputs: { 56 | aboutMe: `My name is David Llaca. 57 | JavaScript Developer for 5 years. 58 | I worked for three years at Disney, 59 | where I developed user interfaces for their primary landing pages 60 | using React, NextJS, and Redux. Before Disney, 61 | I was a Junior Front-End Developer at American Airlines, 62 | where I worked with Vue and Tailwind. 63 | I earned a Bachelor of Science in Computer Science from FIU in 2018, 64 | and I completed a JavaScript bootcamp that same year.`, 65 | }, // Initial input for the first task 66 | env: { DEEPSEEK_API_KEY: import.meta.env.VITE_DEEPSEEK_API_KEY }, 67 | }); 68 | 69 | export default team; 70 | -------------------------------------------------------------------------------- /playground/react/src/teams/llms/gemini.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | // Define agents 4 | const profileAnalyst = new Agent({ 5 | name: 'Mary', 6 | role: 'Profile Analyst', 7 | goal: 'Extract structured information from conversational user input.', 8 | background: 'Data Processor', 9 | tools: [], 10 | llmConfig: { 11 | provider: 'google', 12 | model: 'gemini-1.5-pro', 13 | }, 14 | }); 15 | 16 | const resumeWriter = new Agent({ 17 | name: 'Alex Mercer', 18 | role: 'Resume Writer', 19 | goal: `Craft compelling, well-structured resumes 20 | that effectively showcase job seekers qualifications and achievements.`, 21 | background: `Extensive experience in recruiting, 22 | copywriting, and human resources, enabling 23 | effective resume design that stands out to employers.`, 24 | tools: [], 25 | llmConfig: { 26 | provider: 'google', 27 | model: 'gemini-1.5-pro', 28 | }, 29 | }); 30 | 31 | // Define tasks 32 | const processingTask = new Task({ 33 | description: `Extract relevant details such as name, 34 | experience, skills, and job history from the user's 'aboutMe' input. 35 | aboutMe: {aboutMe}`, 36 | expectedOutput: 'Structured data ready to be used for a resume creation.', 37 | agent: profileAnalyst, 38 | }); 39 | 40 | const resumeCreationTask = new Task({ 41 | description: `Utilize the structured data to create 42 | a detailed and attractive resume. 43 | Enrich the resume content by inferring additional details from the provided information. 44 | Include sections such as a personal summary, detailed work experience, skills, and educational background.`, 45 | expectedOutput: `A professionally formatted resume in markdown format, 46 | ready for submission to potential employers.`, 47 | agent: resumeWriter, 48 | }); 49 | 50 | // Create a team 51 | const team = new Team({ 52 | name: 'Resume Creation Team', 53 | agents: [profileAnalyst, resumeWriter], 54 | tasks: [processingTask, resumeCreationTask], 55 | inputs: { 56 | aboutMe: `My name is David Llaca. 57 | JavaScript Developer for 5 years. 58 | I worked for three years at Disney, 59 | where I developed user interfaces for their primary landing pages 60 | using React, NextJS, and Redux. Before Disney, 61 | I was a Junior Front-End Developer at American Airlines, 62 | where I worked with Vue and Tailwind. 63 | I earned a Bachelor of Science in Computer Science from FIU in 2018, 64 | and I completed a JavaScript bootcamp that same year.`, 65 | }, // Initial input for the first task 66 | env: { GOOGLE_API_KEY: import.meta.env.VITE_GOOGLE_API_KEY }, 67 | }); 68 | 69 | export default team; 70 | -------------------------------------------------------------------------------- /playground/react/src/teams/llms/mistral.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | // Define agents 4 | const profileAnalyst = new Agent({ 5 | name: 'Mary', 6 | role: 'Profile Analyst', 7 | goal: 'Extract structured information from conversational user input.', 8 | background: 'Data Processor', 9 | tools: [], 10 | llmConfig: { 11 | provider: 'mistral', 12 | model: 'mistral-small', 13 | }, 14 | }); 15 | 16 | const resumeWriter = new Agent({ 17 | name: 'Alex Mercer', 18 | role: 'Resume Writer', 19 | goal: `Craft compelling, well-structured resumes 20 | that effectively showcase job seekers qualifications and achievements.`, 21 | background: `Extensive experience in recruiting, 22 | copywriting, and human resources, enabling 23 | effective resume design that stands out to employers.`, 24 | tools: [], 25 | llmConfig: { 26 | provider: 'mistral', 27 | model: 'mistral-small', 28 | }, 29 | }); 30 | 31 | // Define tasks 32 | const processingTask = new Task({ 33 | description: `Extract relevant details such as name, 34 | experience, skills, and job history from the user's 'aboutMe' input. 35 | aboutMe: {aboutMe}`, 36 | expectedOutput: 'Structured data ready to be used for a resume creation.', 37 | agent: profileAnalyst, 38 | }); 39 | 40 | const resumeCreationTask = new Task({ 41 | description: `Utilize the structured data to create 42 | a detailed and attractive resume. 43 | Enrich the resume content by inferring additional details from the provided information. 44 | Include sections such as a personal summary, detailed work experience, skills, and educational background.`, 45 | expectedOutput: `A professionally formatted resume in markdown format, 46 | ready for submission to potential employers.`, 47 | agent: resumeWriter, 48 | }); 49 | 50 | // Create a team 51 | const team = new Team({ 52 | name: 'Resume Creation Team', 53 | agents: [profileAnalyst, resumeWriter], 54 | tasks: [processingTask, resumeCreationTask], 55 | inputs: { 56 | aboutMe: `My name is David Llaca. 57 | JavaScript Developer for 5 years. 58 | I worked for three years at Disney, 59 | where I developed user interfaces for their primary landing pages 60 | using React, NextJS, and Redux. Before Disney, 61 | I was a Junior Front-End Developer at American Airlines, 62 | where I worked with Vue and Tailwind. 63 | I earned a Bachelor of Science in Computer Science from FIU in 2018, 64 | and I completed a JavaScript bootcamp that same year.`, 65 | }, // Initial input for the first task 66 | env: { MISTRAL_API_KEY: import.meta.env.VITE_MISTRAL_API_KEY }, 67 | }); 68 | 69 | export default team; 70 | -------------------------------------------------------------------------------- /playground/react/src/teams/llms/openai.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | // Define agents 4 | const profileAnalyst = new Agent({ 5 | name: 'Mary', 6 | role: 'Profile Analyst', 7 | goal: 'Extract structured information from conversational user input.', 8 | background: 'Data Processor', 9 | tools: [], 10 | }); 11 | 12 | const resumeWriter = new Agent({ 13 | name: 'Alex Mercer', 14 | role: 'Resume Writer', 15 | goal: `Craft compelling, well-structured resumes 16 | that effectively showcase job seekers qualifications and achievements.`, 17 | background: `Extensive experience in recruiting, 18 | copywriting, and human resources, enabling 19 | effective resume design that stands out to employers.`, 20 | tools: [], 21 | }); 22 | 23 | // Define tasks 24 | const processingTask = new Task({ 25 | description: `Extract relevant details such as name, 26 | experience, skills, and job history from the user's 'aboutMe' input. 27 | aboutMe: {aboutMe}`, 28 | expectedOutput: 'Structured data ready to be used for a resume creation.', 29 | agent: profileAnalyst, 30 | }); 31 | 32 | const resumeCreationTask = new Task({ 33 | description: `Utilize the structured data to create 34 | a detailed and attractive resume. 35 | Enrich the resume content by inferring additional details from the provided information. 36 | Include sections such as a personal summary, detailed work experience, skills, and educational background.`, 37 | expectedOutput: `A professionally formatted resume in markdown format, 38 | ready for submission to potential employers.`, 39 | agent: resumeWriter, 40 | }); 41 | 42 | // Create a team 43 | const team = new Team({ 44 | name: 'Resume Creation Team', 45 | agents: [profileAnalyst, resumeWriter], 46 | tasks: [processingTask, resumeCreationTask], 47 | inputs: { 48 | aboutMe: `My name is David Llaca. 49 | JavaScript Developer for 5 years. 50 | I worked for three years at Disney, 51 | where I developed user interfaces for their primary landing pages 52 | using React, NextJS, and Redux. Before Disney, 53 | I was a Junior Front-End Developer at American Airlines, 54 | where I worked with Vue and Tailwind. 55 | I earned a Bachelor of Science in Computer Science from FIU in 2018, 56 | and I completed a JavaScript bootcamp that same year.`, 57 | }, // Initial input for the first task 58 | env: { 59 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 60 | ANTHROPIC_API_KEY: import.meta.env.VITE_ANTHROPIC_API_KEY, 61 | }, 62 | }); 63 | 64 | export default team; 65 | -------------------------------------------------------------------------------- /playground/react/src/teams/output_schema/openai.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | import { z } from 'zod'; 3 | 4 | // Define agents 5 | const writerAgent = new Agent({ 6 | name: 'Clark Kent', 7 | role: 'Write history fact summary', 8 | goal: 'Write a summary about any given historical fact.', 9 | background: 'Writer', 10 | type: 'ReactChampionAgent', 11 | }); 12 | 13 | const schemaSummary = z.object({ 14 | title: z.string().describe('The title for historical fact summary'), 15 | summary: z.string().describe('The historical fact summary'), 16 | time_range: z 17 | .string() 18 | .describe( 19 | 'Range of years in which the historical fact occurs. example: "1815-1816" ' 20 | ), 21 | figures: z 22 | .array(z.string()) 23 | .describe('List of historical figures involved in the historical fact'), 24 | countries: z 25 | .array(z.string()) 26 | .describe('List of countries involved in the historical fact'), 27 | words: z.number().describe('Number of words in the summary'), 28 | }); 29 | 30 | // Define tasks 31 | const writeTask = new Task({ 32 | description: `Write detailed summaries about {fact}, giving dates, historical figures involved, motives, and repercussions of the fact.`, 33 | expectedOutput: 34 | 'A well-structured and detailed summary about historical fact, add metadata like title, epoch of fact, historical figures, countries and number of words', 35 | outputSchema: schemaSummary, 36 | agent: writerAgent, 37 | }); 38 | 39 | // Team to coordinate the agents 40 | const team = new Team({ 41 | name: 'History fact summary Team', 42 | agents: [writerAgent], 43 | tasks: [writeTask], 44 | inputs: { fact: 'Normandy landings' }, // Placeholder for dynamic input 45 | env: { OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY }, // Environment variables for the team, 46 | logLevel: 'error', 47 | }); 48 | export default team; 49 | -------------------------------------------------------------------------------- /playground/react/src/teams/product_specs/gemini.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | // Define agents 4 | const requirementsAnalyst = new Agent({ 5 | name: 'Emma', 6 | role: 'Requirements Analyst', 7 | goal: 'Outline core functionalities and objectives for new features based on the founder’s input.', 8 | background: 'Business Analysis', 9 | tools: [], 10 | llmConfig: { 11 | provider: 'google', 12 | model: 'gemini-1.5-flash', 13 | }, 14 | }); 15 | 16 | const technicalWriter = new Agent({ 17 | name: 'Lucas', 18 | role: 'Technical Writer', 19 | goal: 'Convert functional outlines into detailed technical specifications.', 20 | background: 'Technical Writing', 21 | tools: [], 22 | llmConfig: { 23 | provider: 'google', 24 | model: 'gemini-1.5-flash', 25 | }, 26 | }); 27 | 28 | const validator = new Agent({ 29 | name: 'Mia', 30 | role: 'Validator', 31 | goal: 'Ensure the specifications are accurate and complete.', 32 | background: 'Quality Assurance', 33 | tools: [], 34 | llmConfig: { 35 | provider: 'google', 36 | model: 'gemini-1.5-flash', 37 | }, 38 | }); 39 | 40 | // Define tasks 41 | const analysisTask = new Task({ 42 | description: `Analyze the founder's idea: {founderIdea} and outline the necessary functionalities to implement it.`, 43 | expectedOutput: 'A functional outline of the Founder Idea', 44 | agent: requirementsAnalyst, 45 | }); 46 | 47 | const writingTask = new Task({ 48 | description: `Create detailed technical specifications based on the functional outline provided. Include user stories, system requirements, and acceptance criteria.`, 49 | expectedOutput: 'A detailed technical specifications document.', 50 | isDeliverable: true, 51 | agent: technicalWriter, 52 | }); 53 | 54 | const validationTask = new Task({ 55 | description: `Review the technical specifications to ensure they match the founder's vision and that are technically feasible.`, 56 | expectedOutput: 57 | 'A validated technical specifications document ready for development. Must be in Markdown format.', 58 | agent: validator, 59 | }); 60 | 61 | // Create a team 62 | const team = new Team({ 63 | name: 'Product Specs Team', 64 | agents: [requirementsAnalyst, technicalWriter, validator], 65 | tasks: [analysisTask, writingTask, validationTask], 66 | inputs: { 67 | founderIdea: 'I want to add a Referral program to our SAAS platform.', 68 | }, // Initial input for the first task 69 | }); 70 | 71 | export default team; 72 | -------------------------------------------------------------------------------- /playground/react/src/teams/product_specs/mistral.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | // Define agents 4 | const requirementsAnalyst = new Agent({ 5 | name: 'Emma', 6 | role: 'Requirements Analyst', 7 | goal: 'Outline core functionalities and objectives for new features based on the founder’s input.', 8 | background: 'Business Analysis', 9 | tools: [], 10 | llmConfig: { 11 | provider: 'mistral', 12 | model: 'mistral-small', 13 | }, 14 | }); 15 | 16 | const technicalWriter = new Agent({ 17 | name: 'Lucas', 18 | role: 'Technical Writer', 19 | goal: 'Convert functional outlines into detailed technical specifications.', 20 | background: 'Technical Writing', 21 | tools: [], 22 | llmConfig: { 23 | provider: 'mistral', 24 | model: 'mistral-small', 25 | }, 26 | }); 27 | 28 | const validator = new Agent({ 29 | name: 'Mia', 30 | role: 'Validator', 31 | goal: 'Ensure the specifications are accurate and complete.', 32 | background: 'Quality Assurance', 33 | tools: [], 34 | llmConfig: { 35 | provider: 'mistral', 36 | model: 'mistral-small', 37 | }, 38 | }); 39 | 40 | // Define tasks 41 | const analysisTask = new Task({ 42 | description: `Analyze the founder's idea: {founderIdea} and outline the necessary functionalities to implement it.`, 43 | expectedOutput: 'A functional outline of the Founder Idea', 44 | agent: requirementsAnalyst, 45 | }); 46 | 47 | const writingTask = new Task({ 48 | description: `Create detailed technical specifications based on the functional outline provided. Include user stories, system requirements, and acceptance criteria.`, 49 | expectedOutput: 'A detailed technical specifications document.', 50 | isDeliverable: true, 51 | agent: technicalWriter, 52 | }); 53 | 54 | const validationTask = new Task({ 55 | description: `Review the technical specifications to ensure they match the founder's vision and that are technically feasible.`, 56 | expectedOutput: 57 | 'A validated technical specifications document ready for development. Must be in Markdown format.', 58 | agent: validator, 59 | }); 60 | 61 | // Create a team 62 | const team = new Team({ 63 | name: 'Product Specs Team', 64 | agents: [requirementsAnalyst, technicalWriter, validator], 65 | tasks: [analysisTask, writingTask, validationTask], 66 | inputs: { 67 | founderIdea: 'I want to add a Referral program to our SAAS platform.', 68 | }, // Initial input for the first task 69 | }); 70 | 71 | export default team; 72 | -------------------------------------------------------------------------------- /playground/react/src/teams/product_specs/openai.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | // Define agents 4 | const requirementsAnalyst = new Agent({ 5 | name: 'Emma', 6 | role: 'Requirements Analyst', 7 | goal: 'Outline core functionalities and objectives for new features based on the founder’s input.', 8 | background: 'Business Analysis', 9 | tools: [], 10 | }); 11 | 12 | const technicalWriter = new Agent({ 13 | name: 'Lucas', 14 | role: 'Technical Writer', 15 | goal: 'Convert functional outlines into detailed technical specifications.', 16 | background: 'Technical Writing', 17 | tools: [], 18 | }); 19 | 20 | const validator = new Agent({ 21 | name: 'Mia', 22 | role: 'Validator', 23 | goal: 'Ensure the specifications are accurate and complete.', 24 | background: 'Quality Assurance', 25 | tools: [], 26 | }); 27 | 28 | // Define tasks 29 | const analysisTask = new Task({ 30 | description: `Analyze the founder's idea: {founderIdea} and outline the necessary functionalities to implement it.`, 31 | expectedOutput: 'A functional outline of the Founder Idea', 32 | agent: requirementsAnalyst, 33 | }); 34 | 35 | const writingTask = new Task({ 36 | description: `Create detailed technical specifications based on the functional outline provided. Include user stories, system requirements, and acceptance criteria.`, 37 | expectedOutput: 'A detailed technical specifications document.', 38 | isDeliverable: true, 39 | agent: technicalWriter, 40 | }); 41 | 42 | const validationTask = new Task({ 43 | description: `Review the technical specifications to ensure they match the founder's vision and that are technically feasible.`, 44 | expectedOutput: 45 | 'A validated technical specifications document ready for development. Must be in Markdown format.', 46 | agent: validator, 47 | }); 48 | 49 | // Create a team 50 | const team = new Team({ 51 | name: 'Product Specs Team', 52 | agents: [requirementsAnalyst, technicalWriter, validator], 53 | tasks: [analysisTask, writingTask, validationTask], 54 | inputs: { 55 | founderIdea: 'I want to add a Referral program to our SAAS platform.', 56 | }, // Initial input for the first task 57 | env: { 58 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 59 | ANTHROPIC_API_KEY: import.meta.env.VITE_ANTHROPIC_API_KEY, 60 | }, 61 | }); 62 | 63 | export default team; 64 | -------------------------------------------------------------------------------- /playground/react/src/teams/research_team/openai.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | // Define agents 4 | const researcher = new Agent({ 5 | name: 'Alice', 6 | role: 'Researcher', 7 | goal: 'Analyze AI advancements about {topic}', 8 | background: 'AI researcher', 9 | tools: [], 10 | }); 11 | 12 | const writer = new Agent({ 13 | name: 'Bob', 14 | role: 'Writer', 15 | goal: 'Write an article about {topic}', 16 | background: 'Tech writer', 17 | tools: [], 18 | }); 19 | 20 | // Define tasks 21 | const researchTask = new Task({ 22 | description: ` Identify the next big trend in {topic}. 23 | Focus on identifying pros and cons and the overall narrative. 24 | Your final report should clearly articulate the key points, 25 | its market opportunities, and potential risks. 26 | `, 27 | expectedOutput: 'One sentence with the name of the AI trend', 28 | // expectedOutput: 'A comprehensive 3 paragraphs long report on the latest AI trends.', 29 | agent: researcher, 30 | }); 31 | 32 | const writingTask = new Task({ 33 | description: `Compose an insightful article on {topic}. 34 | Focus on the latest trends and how it's impacting the industry. 35 | This article should be easy to understand, engaging, and positive.`, 36 | // expectedOutput: 'A 1 paragraph article on {topic} advancements formatted as markdown.', 37 | expectedOutput: 38 | 'A 3 paragraph article on {topic} advancements formatted as markdown.', 39 | agent: writer, 40 | }); 41 | 42 | // Create a team 43 | const team = new Team({ 44 | name: 'Research Team', 45 | agents: [researcher, writer], 46 | tasks: [researchTask, writingTask], 47 | inputs: { topic: 'AI Agents' }, // Initial input for the first task 48 | }); 49 | 50 | export default team; 51 | -------------------------------------------------------------------------------- /playground/react/src/teams/resume_creation/openai.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | // Define agents 4 | const profileAnalyst = new Agent({ 5 | name: 'Mary', 6 | role: 'Profile Analyst', 7 | goal: 'Extract structured information from conversational user input.', 8 | background: 'Data Processor', 9 | tools: [], // Tools are omitted for now 10 | }); 11 | 12 | const resumeWriter = new Agent({ 13 | name: 'Alex Mercer', 14 | role: 'Resume Writer', 15 | goal: `Craft compelling, well-structured resumes 16 | that effectively showcase job seekers qualifications and achievements.`, 17 | background: `Extensive experience in recruiting, 18 | copywriting, and human resources, enabling 19 | effective resume design that stands out to employers.`, 20 | tools: [], 21 | }); 22 | 23 | // Define tasks 24 | const processingTask = new Task({ 25 | description: `Extract relevant details such as name, 26 | experience, skills, and job history from the user's 'aboutMe' input. 27 | aboutMe: {aboutMe}`, 28 | expectedOutput: 'Structured data ready to be used for a resume creation.', 29 | agent: profileAnalyst, 30 | }); 31 | 32 | const resumeCreationTask = new Task({ 33 | description: `Utilize the structured data to create 34 | a detailed and attractive resume. 35 | Enrich the resume content by inferring additional details from the provided information. 36 | Include sections such as a personal summary, detailed work experience, skills, and educational background.`, 37 | expectedOutput: `A professionally formatted resume in markdown format, 38 | ready for submission to potential employers.`, 39 | agent: resumeWriter, 40 | }); 41 | 42 | // Create a team 43 | const team = new Team({ 44 | name: 'Resume Creation Team', 45 | agents: [profileAnalyst, resumeWriter], 46 | tasks: [processingTask, resumeCreationTask], 47 | inputs: { 48 | aboutMe: `My name is David Llaca. 49 | JavaScript Developer for 5 years. 50 | I worked for three years at Disney, 51 | where I developed user interfaces for their primary landing pages 52 | using React, NextJS, and Redux. Before Disney, 53 | I was a Junior Front-End Developer at American Airlines, 54 | where I worked with Vue and Tailwind. 55 | I earned a Bachelor of Science in Computer Science from FIU in 2018, 56 | and I completed a JavaScript bootcamp that same year.`, 57 | }, // Initial input for the first task 58 | env: { 59 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 60 | ANTHROPIC_API_KEY: import.meta.env.VITE_ANTHROPIC_API_KEY, 61 | }, 62 | }); 63 | 64 | export default team; 65 | -------------------------------------------------------------------------------- /playground/react/src/teams/resume_creation/openai_reasoning_models.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | // Define agents 4 | const profileAnalyst = new Agent({ 5 | name: 'Mary', 6 | role: 'Profile Analyst', 7 | goal: 'Extract structured information from conversational user input.', 8 | background: 'Data Processor', 9 | tools: [], // Tools are omitted for now, 10 | llmConfig: { 11 | provider: 'openai', // or "openai" 12 | model: 'o1-mini', 13 | apiKey: import.meta.env.VITE_DARIEL_OPENAI_API_KEY, 14 | }, 15 | }); 16 | 17 | const resumeWriter = new Agent({ 18 | name: 'Alex Mercer', 19 | role: 'Resume Writer', 20 | goal: `Craft compelling, well-structured resumes 21 | that effectively showcase job seekers qualifications and achievements.`, 22 | background: `Extensive experience in recruiting, 23 | copywriting, and human resources, enabling 24 | effective resume design that stands out to employers.`, 25 | tools: [], 26 | }); 27 | 28 | // Define tasks 29 | const processingTask = new Task({ 30 | description: `Extract relevant details such as name, 31 | experience, skills, and job history from the user's 'aboutMe' input. 32 | aboutMe: {aboutMe}`, 33 | expectedOutput: 'Structured data ready to be used for a resume creation.', 34 | agent: profileAnalyst, 35 | }); 36 | 37 | const resumeCreationTask = new Task({ 38 | description: `Utilize the structured data to create 39 | a detailed and attractive resume. 40 | Enrich the resume content by inferring additional details from the provided information. 41 | Include sections such as a personal summary, detailed work experience, skills, and educational background.`, 42 | expectedOutput: `A professionally formatted resume in markdown format, 43 | ready for submission to potential employers.`, 44 | agent: resumeWriter, 45 | }); 46 | 47 | // Create a team 48 | const team = new Team({ 49 | name: 'Resume Creation Team', 50 | agents: [profileAnalyst, resumeWriter], 51 | tasks: [processingTask, resumeCreationTask], 52 | inputs: { 53 | aboutMe: `My name is David Llaca. 54 | JavaScript Developer for 5 years. 55 | I worked for three years at Disney, 56 | where I developed user interfaces for their primary landing pages 57 | using React, NextJS, and Redux. Before Disney, 58 | I was a Junior Front-End Developer at American Airlines, 59 | where I worked with Vue and Tailwind. 60 | I earned a Bachelor of Science in Computer Science from FIU in 2018, 61 | and I completed a JavaScript bootcamp that same year.`, 62 | }, // Initial input for the first task 63 | env: { 64 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 65 | ANTHROPIC_API_KEY: import.meta.env.VITE_ANTHROPIC_API_KEY, 66 | }, 67 | }); 68 | 69 | export default team; 70 | -------------------------------------------------------------------------------- /playground/react/src/teams/resume_creation/openai_with_hitl.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | // Define agents 4 | const profileAnalyst = new Agent({ 5 | name: 'Mary', 6 | role: 'Profile Analyst', 7 | goal: 'Extract structured information from conversational user input.', 8 | background: 'Data Processor', 9 | tools: [], // Tools are omitted for now 10 | }); 11 | 12 | const resumeWriter = new Agent({ 13 | name: 'Alex Mercer', 14 | role: 'Resume Writer', 15 | goal: `Craft compelling, well-structured resumes 16 | that effectively showcase job seekers qualifications and achievements.`, 17 | background: `Extensive experience in recruiting, 18 | copywriting, and human resources, enabling 19 | effective resume design that stands out to employers.`, 20 | tools: [], 21 | }); 22 | 23 | // Define tasks 24 | const processingTask = new Task({ 25 | description: `Extract relevant details such as name, 26 | experience, skills, and job history from the user's 'aboutMe' input. 27 | aboutMe: {aboutMe}`, 28 | expectedOutput: 'Structured data ready to be used for a resume creation.', 29 | agent: profileAnalyst, 30 | externalValidationRequired: true, 31 | }); 32 | 33 | const resumeCreationTask = new Task({ 34 | description: `Utilize the structured data to create 35 | a detailed and attractive resume. 36 | Enrich the resume content by inferring additional details from the provided information. 37 | Include sections such as a personal summary, detailed work experience, skills, and educational background.`, 38 | expectedOutput: `A professionally formatted resume in markdown format, 39 | ready for submission to potential employers.`, 40 | agent: resumeWriter, 41 | }); 42 | 43 | // Create a team 44 | const team = new Team({ 45 | name: 'Resume Creation Team', 46 | agents: [profileAnalyst, resumeWriter], 47 | tasks: [processingTask, resumeCreationTask], 48 | inputs: { 49 | aboutMe: `My name is David Llaca. 50 | JavaScript Developer for 5 years. 51 | I worked for three years at Disney, 52 | where I developed user interfaces for their primary landing pages 53 | using React, NextJS, and Redux. Before Disney, 54 | I was a Junior Front-End Developer at American Airlines, 55 | where I worked with Vue and Tailwind. 56 | I earned a Bachelor of Science in Computer Science from FIU in 2018, 57 | and I completed a JavaScript bootcamp that same year.`, 58 | }, // Initial input for the first task 59 | env: { 60 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 61 | ANTHROPIC_API_KEY: import.meta.env.VITE_ANTHROPIC_API_KEY, 62 | }, 63 | }); 64 | 65 | export default team; 66 | -------------------------------------------------------------------------------- /playground/react/src/teams/sport_news/anthropic.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | import { TavilySearchResults } from '@langchain/community/tools/tavily_search'; 3 | 4 | // Define tools 5 | const searchTool = new TavilySearchResults({ 6 | maxResults: 3, 7 | // apiKey: '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', 8 | apiKey: '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', 9 | }); 10 | 11 | // Define agents 12 | const searchAgent = new Agent({ 13 | name: 'Scout', 14 | role: 'Information Gatherer', 15 | goal: 'Find up-to-date information about the given sports query.', 16 | background: 'Research', 17 | type: 'ReactChampionAgent', 18 | tools: [searchTool], 19 | llmConfig: { 20 | provider: 'anthropic', // or "openai" 21 | model: 'claude-3-5-sonnet-20240620', 22 | temperature: 0.9, 23 | maxTokens: 1024, 24 | anthropicApiUrl: 'https://www.kaibanjs.com/proxy/anthropic', 25 | }, 26 | }); 27 | 28 | const contentCreator = new Agent({ 29 | name: 'Writer', 30 | role: 'Content Creator', 31 | goal: 'Generate a comprehensive articles about any sports event.', 32 | background: 'Journalism', 33 | type: 'ReactChampionAgent', 34 | tools: [], 35 | llmConfig: { 36 | provider: 'anthropic', // or "openai" 37 | model: 'claude-3-5-sonnet-20240620', 38 | temperature: 0.9, 39 | maxTokens: 1024, 40 | anthropicApiUrl: 'https://www.kaibanjs.com/proxy/anthropic', 41 | }, 42 | }); 43 | 44 | // Define tasks 45 | const searchTask = new Task({ 46 | description: `Search for detailed information about the sports query: {sportsQuery}.`, 47 | expectedOutput: 48 | 'Detailed information about the sports event. Key players, key moments, final score and other usefull information.', 49 | agent: searchAgent, 50 | }); 51 | 52 | const writeTask = new Task({ 53 | description: `Using the gathered information, write a detailed article about the sport event.`, 54 | expectedOutput: 55 | 'A well-structured and engaging sports article. With a title, introduction, body, and conclusion. Min 4 paragrahps long.', 56 | agent: contentCreator, 57 | }); 58 | 59 | // Team to coordinate the agents 60 | const team = new Team({ 61 | name: 'Sports Content Creation Team', 62 | agents: [searchAgent, contentCreator], 63 | tasks: [searchTask, writeTask], 64 | inputs: { sportsQuery: 'Who won the Copa America in 2024?' }, // Placeholder for dynamic input 65 | env: { 66 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 67 | ANTHROPIC_API_KEY: import.meta.env.VITE_ANTHROPIC_API_KEY, 68 | }, 69 | // Results of the latest UEFA Champions League match. 70 | }); 71 | 72 | export default team; 73 | -------------------------------------------------------------------------------- /playground/react/src/teams/sport_news/deepseek.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | import { TavilySearch as TavilySearchResults } from '@langchain/tavily'; 3 | 4 | // Define tools 5 | const searchTool = new TavilySearchResults({ 6 | maxResults: 3, 7 | tavilyApiKey: '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', 8 | }); 9 | 10 | // Define agents 11 | const searchAgent = new Agent({ 12 | name: 'Scout', 13 | role: 'Information Gatherer', 14 | goal: 'Find up-to-date information about the given sports input.', 15 | background: 'Research', 16 | type: 'ReactChampionAgent', 17 | tools: [searchTool], 18 | llmConfig: { 19 | provider: 'deepseek', 20 | model: 'deepseek-chat', 21 | }, 22 | }); 23 | 24 | const contentCreator = new Agent({ 25 | name: 'Writer', 26 | role: 'Content Creator', 27 | goal: 'Generate a comprehensive articles about any sports event.', 28 | background: 'Journalism', 29 | type: 'ReactChampionAgent', 30 | tools: [], 31 | llmConfig: { 32 | provider: 'deepseek', 33 | model: 'deepseek-chat', 34 | }, 35 | }); 36 | 37 | // Define tasks 38 | const searchTask = new Task({ 39 | description: `Search for detailed information about the sports input: {sportsQuery} using input as params to the search tool.`, 40 | expectedOutput: 41 | 'Detailed information about the sports event. Key players, key moments, final score and other usefull information.', 42 | agent: searchAgent, 43 | }); 44 | 45 | const writeTask = new Task({ 46 | description: `Using the gathered information, write a detailed article about the sport event.`, 47 | expectedOutput: 48 | 'A well-structured and engaging sports article. With a title, introduction, body, and conclusion. Min 4 paragrahps long.', 49 | agent: contentCreator, 50 | }); 51 | 52 | // Team to coordinate the agents 53 | const team = new Team({ 54 | name: 'Sports Content Creation Team', 55 | agents: [searchAgent, contentCreator], 56 | tasks: [searchTask, writeTask], 57 | inputs: { sportsQuery: 'Who won the MLB season in 2024?' }, // Placeholder for dynamic input 58 | env: { 59 | // OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 60 | // ANTHROPIC_API_KEY: import.meta.env.VITE_ANTHROPIC_API_KEY, 61 | // MISTRAL_API_KEY: import.meta.env.VITE_MISTRAL_API_KEY, 62 | DEEPSEEK_API_KEY: import.meta.env.VITE_DEEPSEEK_API_KEY, 63 | }, 64 | logLevel: 'debug', 65 | // Results of the latest UEFA Champions League match. 66 | }); 67 | 68 | export default team; 69 | -------------------------------------------------------------------------------- /playground/react/src/teams/sport_news/gemini.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | import { TavilySearchResults } from '@langchain/community/tools/tavily_search'; 3 | 4 | // Define tools 5 | const searchTool = new TavilySearchResults({ 6 | maxResults: 3, 7 | apiKey: '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', 8 | }); 9 | 10 | // Define agents 11 | const searchAgent = new Agent({ 12 | name: 'Scout', 13 | role: 'Information Gatherer', 14 | goal: 'Find up-to-date information about the given sports query.', 15 | background: 'Research', 16 | type: 'ReactChampionAgent', 17 | tools: [searchTool], 18 | llmConfig: { 19 | provider: 'google', 20 | model: 'gemini-1.5-pro', 21 | }, 22 | }); 23 | 24 | const contentCreator = new Agent({ 25 | name: 'Writer', 26 | role: 'Content Creator', 27 | goal: 'Generate a comprehensive articles about any sports event.', 28 | background: 'Journalism', 29 | type: 'ReactChampionAgent', 30 | tools: [], 31 | llmConfig: { 32 | provider: 'google', 33 | model: 'gemini-1.5-pro', 34 | }, 35 | }); 36 | 37 | // Define tasks 38 | const searchTask = new Task({ 39 | description: `Search for detailed information about the sports query: {sportsQuery}.`, 40 | expectedOutput: 41 | 'Detailed information about the sports event. Key players, key moments, final score and other usefull information.', 42 | agent: searchAgent, 43 | }); 44 | 45 | const writeTask = new Task({ 46 | description: `Using the gathered information, write a detailed article about the sport event.`, 47 | expectedOutput: 48 | 'A well-structured and engaging sports article. With a title, introduction, body, and conclusion. Min 4 paragrahps long.', 49 | agent: contentCreator, 50 | }); 51 | 52 | // Team to coordinate the agents 53 | const team = new Team({ 54 | name: 'Sports Content Creation Team', 55 | agents: [searchAgent, contentCreator], 56 | tasks: [searchTask, writeTask], 57 | inputs: { sportsQuery: 'Who won the Copa America in 2024?' }, // Placeholder for dynamic input 58 | env: { 59 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 60 | ANTHROPIC_API_KEY: import.meta.env.VITE_ANTHROPIC_API_KEY, 61 | MISTRAL_API_KEY: import.meta.env.VITE_MISTRAL_API_KEY, 62 | GOOGLE_API_KEY: import.meta.env.VITE_GOOGLE_API_KEY, 63 | }, 64 | logLevel: 'debug', 65 | // Results of the latest UEFA Champions League match. 66 | }); 67 | 68 | export default team; 69 | -------------------------------------------------------------------------------- /playground/react/src/teams/sport_news/mistral.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | import { TavilySearchResults } from '@langchain/community/tools/tavily_search'; 3 | 4 | // Define tools 5 | const searchTool = new TavilySearchResults({ 6 | maxResults: 3, 7 | apiKey: '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', 8 | }); 9 | 10 | // Define agents 11 | const searchAgent = new Agent({ 12 | name: 'Scout', 13 | role: 'Information Gatherer', 14 | goal: 'Find up-to-date information about the given sports query.', 15 | background: 'Research', 16 | type: 'ReactChampionAgent', 17 | tools: [searchTool], 18 | llmConfig: { 19 | provider: 'mistral', 20 | model: 'mistral-small', 21 | }, 22 | }); 23 | 24 | const contentCreator = new Agent({ 25 | name: 'Writer', 26 | role: 'Content Creator', 27 | goal: 'Generate a comprehensive articles about any sports event.', 28 | background: 'Journalism', 29 | type: 'ReactChampionAgent', 30 | tools: [], 31 | llmConfig: { 32 | provider: 'mistral', 33 | model: 'mistral-small', 34 | }, 35 | }); 36 | 37 | // Define tasks 38 | const searchTask = new Task({ 39 | description: `Search for detailed information about the sports query: {sportsQuery}.`, 40 | expectedOutput: 41 | 'Detailed information about the sports event. Key players, key moments, final score and other usefull information.', 42 | agent: searchAgent, 43 | }); 44 | 45 | const writeTask = new Task({ 46 | description: `Using the gathered information, write a detailed article about the sport event.`, 47 | expectedOutput: 48 | 'A well-structured and engaging sports article. With a title, introduction, body, and conclusion. Min 4 paragrahps long.', 49 | agent: contentCreator, 50 | }); 51 | 52 | // Team to coordinate the agents 53 | const team = new Team({ 54 | name: 'Sports Content Creation Team', 55 | agents: [searchAgent, contentCreator], 56 | tasks: [searchTask, writeTask], 57 | inputs: { sportsQuery: 'Who won the Copa America in 2024?' }, // Placeholder for dynamic input 58 | env: { 59 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 60 | ANTHROPIC_API_KEY: import.meta.env.VITE_ANTHROPIC_API_KEY, 61 | MISTRAL_API_KEY: import.meta.env.VITE_MISTRAL_API_KEY, 62 | GOOGLE_API_KEY: import.meta.env.VITE_GOOGLE_API_KEY, 63 | }, 64 | }); 65 | // Results of the latest UEFA Champions League match. 66 | 67 | export default team; 68 | -------------------------------------------------------------------------------- /playground/react/src/teams/sport_news/openai.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | import { TavilySearchResults } from '@langchain/community/tools/tavily_search'; 3 | 4 | // Define tools 5 | const searchTool = new TavilySearchResults({ 6 | maxResults: 3, 7 | // apiKey: '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', 8 | apiKey: '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', 9 | }); 10 | 11 | // Define agents 12 | const searchAgent = new Agent({ 13 | name: 'Scout', 14 | role: 'Information Gatherer', 15 | goal: 'Find up-to-date information about the given sports query.', 16 | background: 'Research', 17 | type: 'ReactChampionAgent', 18 | tools: [searchTool], 19 | }); 20 | 21 | const contentCreator = new Agent({ 22 | name: 'Writer', 23 | role: 'Content Creator', 24 | goal: 'Generate a comprehensive articles about any sports event.', 25 | background: 'Journalism', 26 | type: 'ReactChampionAgent', 27 | tools: [], 28 | }); 29 | 30 | // Define tasks 31 | const searchTask = new Task({ 32 | description: `Search for detailed information about the sports query: {sportsQuery}.`, 33 | expectedOutput: 34 | 'Detailed information about the sports event. Key players, key moments, final score and other usefull information.', 35 | agent: searchAgent, 36 | }); 37 | 38 | const writeTask = new Task({ 39 | description: `Using the gathered information, write a detailed article about the sport event.`, 40 | expectedOutput: 41 | 'A well-structured and engaging sports article. With a title, introduction, body, and conclusion. Min 4 paragrahps long.', 42 | agent: contentCreator, 43 | }); 44 | 45 | // Team to coordinate the agents 46 | const team = new Team({ 47 | name: 'Sports Content Creation Team', 48 | agents: [searchAgent, contentCreator], 49 | tasks: [searchTask, writeTask], 50 | inputs: { sportsQuery: 'Who won the Copa America in 2024?' }, // Placeholder for dynamic input 51 | env: { 52 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 53 | ANTHROPIC_API_KEY: import.meta.env.VITE_ANTHROPIC_API_KEY, 54 | }, 55 | // Results of the latest UEFA Champions League match. 56 | }); 57 | 58 | export default team; 59 | -------------------------------------------------------------------------------- /playground/react/src/teams/sport_news/openaiWithReActAgents.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | import { TavilySearchResults } from '@langchain/community/tools/tavily_search'; 3 | 4 | // Define tools 5 | const searchTool = new TavilySearchResults({ 6 | maxResults: 3, 7 | apiKey: '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', 8 | }); 9 | 10 | // Define agents 11 | const searchAgent = new Agent({ 12 | name: 'Scout', 13 | role: 'Information Gatherer', 14 | goal: 'Find up-to-date information about the given sports query.', 15 | background: 'Research', 16 | type: 'ReAct', 17 | tools: [searchTool], 18 | }); 19 | 20 | const contentCreator = new Agent({ 21 | name: 'Writer', 22 | role: 'Content Creator', 23 | goal: 'Generate a comprehensive articles about any sports event.', 24 | background: 'Journalism', 25 | type: 'ReAct', 26 | tools: [], 27 | }); 28 | 29 | // Define tasks 30 | const searchTask = new Task({ 31 | description: `Search for detailed information about the sports query: {sportsQuery}.`, 32 | expectedOutput: 33 | 'Detailed information about the sports event. Key players, key moments, final score and other usefull information.', 34 | agent: searchAgent, 35 | }); 36 | 37 | const writeTask = new Task({ 38 | description: `Using the gathered information, write a detailed article about the sport event.`, 39 | expectedOutput: 40 | 'A well-structured and engaging sports article. With a title, introduction, body, and conclusion. Min 4 paragrahps long.', 41 | agent: contentCreator, 42 | }); 43 | 44 | // Team to coordinate the agents 45 | const team = new Team({ 46 | name: 'Sports Content Creation Team', 47 | agents: [searchAgent, contentCreator], 48 | tasks: [searchTask, writeTask], 49 | inputs: { sportsQuery: 'Who won the Copa America in 2024?' }, // Placeholder for dynamic input 50 | env: { 51 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 52 | ANTHROPIC_API_KEY: import.meta.env.VITE_ANTHROPIC_API_KEY, 53 | }, 54 | // Results of the latest UEFA Champions League match. 55 | }); 56 | 57 | export default team; 58 | -------------------------------------------------------------------------------- /playground/react/src/teams/task_blocking/basic_blocking.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | const blockingAgent = new Agent({ 4 | name: 'Security Validator', 5 | role: 'Security Clearance Checker', 6 | goal: 'Validate security requirements and block tasks that lack proper authorization', 7 | background: 'Expert in security protocols and access control management', 8 | tools: [], 9 | kanbanTools: ['block-task-tool'], 10 | }); 11 | 12 | const securityTask = new Task({ 13 | description: `This task after the agent has checked the security clearance, should be blocked because the agent does not have the required clearance.`, 14 | expectedOutput: 15 | 'Use the block_task tool to block the task with a clear explanation of why you cannot proceed.', 16 | agent: blockingAgent, 17 | }); 18 | 19 | const team = new Team({ 20 | name: 'Security Validation Team', 21 | agents: [blockingAgent], 22 | tasks: [securityTask], 23 | env: { 24 | OPENAI_API_KEY: import.meta.env.VITE_OPENAI_API_KEY, 25 | }, 26 | }); 27 | 28 | export default team; 29 | -------------------------------------------------------------------------------- /playground/react/src/teams/with_proxy/gemini.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | // Define agents 4 | const profileAnalyst = new Agent({ 5 | name: 'Mary', 6 | role: 'Profile Analyst', 7 | goal: 'Extract structured information from conversational user input.', 8 | background: 'Data Processor', 9 | tools: [], 10 | llmConfig: { 11 | provider: 'google', 12 | model: 'gemini-1.5-pro', 13 | apiBaseUrl: 'https://proxy.kaibanjs.com/llm/google', 14 | }, 15 | }); 16 | 17 | const resumeWriter = new Agent({ 18 | name: 'Alex Mercer', 19 | role: 'Resume Writer', 20 | goal: `Craft compelling, well-structured resumes 21 | that effectively showcase job seekers qualifications and achievements.`, 22 | background: `Extensive experience in recruiting, 23 | copywriting, and human resources, enabling 24 | effective resume design that stands out to employers.`, 25 | tools: [], 26 | llmConfig: { 27 | provider: 'google', 28 | model: 'gemini-1.5-pro', 29 | apiBaseUrl: 'https://proxy.kaibanjs.com/llm/google', 30 | }, 31 | }); 32 | 33 | // Define tasks 34 | const processingTask = new Task({ 35 | description: `Extract relevant details such as name, 36 | experience, skills, and job history from the user's 'aboutMe' input. 37 | aboutMe: {aboutMe}`, 38 | expectedOutput: 'Structured data ready to be used for a resume creation.', 39 | agent: profileAnalyst, 40 | }); 41 | 42 | const resumeCreationTask = new Task({ 43 | description: `Utilize the structured data to create 44 | a detailed and attractive resume. 45 | Enrich the resume content by inferring additional details from the provided information. 46 | Include sections such as a personal summary, detailed work experience, skills, and educational background.`, 47 | expectedOutput: `A professionally formatted resume in markdown format, 48 | ready for submission to potential employers.`, 49 | agent: resumeWriter, 50 | }); 51 | 52 | // Create a team 53 | const team = new Team({ 54 | name: 'Resume Creation Team', 55 | agents: [profileAnalyst, resumeWriter], 56 | tasks: [processingTask, resumeCreationTask], 57 | inputs: { 58 | aboutMe: `My name is David Llaca. 59 | JavaScript Developer for 5 years. 60 | I worked for three years at Disney, 61 | where I developed user interfaces for their primary landing pages 62 | using React, NextJS, and Redux. Before Disney, 63 | I was a Junior Front-End Developer at American Airlines, 64 | where I worked with Vue and Tailwind. 65 | I earned a Bachelor of Science in Computer Science from FIU in 2018, 66 | and I completed a JavaScript bootcamp that same year.`, 67 | }, // Initial input for the first task 68 | env: { GOOGLE_API_KEY: import.meta.env.VITE_GOOGLE_API_KEY }, 69 | }); 70 | 71 | export default team; 72 | -------------------------------------------------------------------------------- /playground/react/src/teams/with_proxy/mistral.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | // Define agents 4 | const profileAnalyst = new Agent({ 5 | name: 'Mary', 6 | role: 'Profile Analyst', 7 | goal: 'Extract structured information from conversational user input.', 8 | background: 'Data Processor', 9 | tools: [], 10 | llmConfig: { 11 | provider: 'mistral', 12 | model: 'mistral-small', 13 | apiBaseUrl: 'https://proxy.kaibanjs.com/llm/mistral', 14 | }, 15 | }); 16 | 17 | const resumeWriter = new Agent({ 18 | name: 'Alex Mercer', 19 | role: 'Resume Writer', 20 | goal: `Craft compelling, well-structured resumes 21 | that effectively showcase job seekers qualifications and achievements.`, 22 | background: `Extensive experience in recruiting, 23 | copywriting, and human resources, enabling 24 | effective resume design that stands out to employers.`, 25 | tools: [], 26 | llmConfig: { 27 | provider: 'mistral', 28 | model: 'mistral-small', 29 | apiBaseUrl: 'https://proxy.kaibanjs.com/llm/mistral', 30 | }, 31 | }); 32 | 33 | // Define tasks 34 | const processingTask = new Task({ 35 | description: `Extract relevant details such as name, 36 | experience, skills, and job history from the user's 'aboutMe' input. 37 | aboutMe: {aboutMe}`, 38 | expectedOutput: 'Structured data ready to be used for a resume creation.', 39 | agent: profileAnalyst, 40 | }); 41 | 42 | const resumeCreationTask = new Task({ 43 | description: `Utilize the structured data to create 44 | a detailed and attractive resume. 45 | Enrich the resume content by inferring additional details from the provided information. 46 | Include sections such as a personal summary, detailed work experience, skills, and educational background.`, 47 | expectedOutput: `A professionally formatted resume in markdown format, 48 | ready for submission to potential employers.`, 49 | agent: resumeWriter, 50 | }); 51 | 52 | // Create a team 53 | const team = new Team({ 54 | name: 'Resume Creation Team', 55 | agents: [profileAnalyst, resumeWriter], 56 | tasks: [processingTask, resumeCreationTask], 57 | inputs: { 58 | aboutMe: `My name is David Llaca. 59 | JavaScript Developer for 5 years. 60 | I worked for three years at Disney, 61 | where I developed user interfaces for their primary landing pages 62 | using React, NextJS, and Redux. Before Disney, 63 | I was a Junior Front-End Developer at American Airlines, 64 | where I worked with Vue and Tailwind. 65 | I earned a Bachelor of Science in Computer Science from FIU in 2018, 66 | and I completed a JavaScript bootcamp that same year.`, 67 | }, // Initial input for the first task 68 | env: { MISTRAL_API_KEY: import.meta.env.VITE_MISTRAL_API_KEY }, 69 | }); 70 | 71 | export default team; 72 | -------------------------------------------------------------------------------- /playground/react/src/teams/with_proxy/openai.js: -------------------------------------------------------------------------------- 1 | import { Agent, Task, Team } from 'kaibanjs'; 2 | 3 | // Define agents 4 | const profileAnalyst = new Agent({ 5 | name: 'Mary', 6 | role: 'Profile Analyst', 7 | goal: 'Extract structured information from conversational user input.', 8 | background: 'Data Processor', 9 | tools: [], 10 | llmConfig: { 11 | provider: 'openai', 12 | apiBaseUrl: 'https://proxy.kaibanjs.com/llm/openai', 13 | }, 14 | }); 15 | 16 | const resumeWriter = new Agent({ 17 | name: 'Alex Mercer', 18 | role: 'Resume Writer', 19 | goal: `Craft compelling, well-structured resumes 20 | that effectively showcase job seekers qualifications and achievements.`, 21 | background: `Extensive experience in recruiting, 22 | copywriting, and human resources, enabling 23 | effective resume design that stands out to employers.`, 24 | tools: [], 25 | llmConfig: { 26 | provider: 'openai', 27 | apiBaseUrl: 'https://proxy.kaibanjs.com/llm/openai', 28 | }, 29 | }); 30 | 31 | // Define tasks 32 | const processingTask = new Task({ 33 | description: `Extract relevant details such as name, 34 | experience, skills, and job history from the user's 'aboutMe' input. 35 | aboutMe: {aboutMe}`, 36 | expectedOutput: 'Structured data ready to be used for a resume creation.', 37 | agent: profileAnalyst, 38 | }); 39 | 40 | const resumeCreationTask = new Task({ 41 | description: `Utilize the structured data to create 42 | a detailed and attractive resume. 43 | Enrich the resume content by inferring additional details from the provided information. 44 | Include sections such as a personal summary, detailed work experience, skills, and educational background.`, 45 | expectedOutput: `A professionally formatted resume in markdown format, 46 | ready for submission to potential employers.`, 47 | agent: resumeWriter, 48 | }); 49 | 50 | // Create a team 51 | const team = new Team({ 52 | name: 'Resume Creation Team', 53 | agents: [profileAnalyst, resumeWriter], 54 | tasks: [processingTask, resumeCreationTask], 55 | inputs: { 56 | aboutMe: `My name is David Llaca. 57 | JavaScript Developer for 5 years. 58 | I worked for three years at Disney, 59 | where I developed user interfaces for their primary landing pages 60 | using React, NextJS, and Redux. Before Disney, 61 | I was a Junior Front-End Developer at American Airlines, 62 | where I worked with Vue and Tailwind. 63 | I earned a Bachelor of Science in Computer Science from FIU in 2018, 64 | and I completed a JavaScript bootcamp that same year.`, 65 | }, // Initial input for the first task 66 | env: { OPENAI_API_KEY: 'fake-api-key' }, 67 | }); 68 | 69 | export default team; 70 | -------------------------------------------------------------------------------- /playground/react/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import react from '@vitejs/plugin-react'; 3 | import path from 'path'; 4 | 5 | // https://vitejs.dev/config/ 6 | export default defineConfig({ 7 | plugins: [react()], 8 | resolve: { 9 | alias: { 10 | kaibanjs: path.resolve(__dirname, '../../dist/bundle.mjs'), 11 | }, 12 | }, 13 | optimizeDeps: { 14 | exclude: ['package-that-is-not-updating'], 15 | }, 16 | }); 17 | -------------------------------------------------------------------------------- /rollup.config.mjs: -------------------------------------------------------------------------------- 1 | import resolve from '@rollup/plugin-node-resolve'; 2 | import replace from '@rollup/plugin-replace'; 3 | import commonjs from '@rollup/plugin-commonjs'; 4 | import terser from '@rollup/plugin-terser'; 5 | import { dts } from 'rollup-plugin-dts'; 6 | import typescript from '@rollup/plugin-typescript'; 7 | 8 | const isDevelopment = process.env.NODE_ENV === 'development'; 9 | const isTest = process.env.TEST_ENV === 'mocked-llm-apis'; 10 | 11 | function generateConfig(format) { 12 | const isDTS = format === 'dts'; 13 | const isESM = format === 'es'; 14 | const isCJS = format === 'cjs'; 15 | const ext = isESM ? 'mjs' : isCJS ? 'cjs' : 'js'; 16 | const external = isESM 17 | ? [ 18 | 'react', 19 | 'react-dom', 20 | 'uuid', 21 | 'pino', 22 | 'pino-pretty', 23 | 'p-queue', 24 | 'p-timeout', 25 | ] 26 | : ['uuid', 'pino', 'pino-pretty']; 27 | 28 | if (isDTS) { 29 | return { 30 | input: 'dist/types/index.d.ts', 31 | output: [ 32 | { 33 | file: 'dist/bundle.d.ts', 34 | format: 'es', 35 | }, 36 | ], 37 | plugins: [dts()], 38 | }; 39 | } 40 | 41 | return { 42 | input: 'src/index.ts', 43 | output: { 44 | file: `dist/bundle.${ext}`, 45 | format: format, 46 | inlineDynamicImports: true, 47 | sourcemap: isDevelopment, 48 | name: format === 'umd' ? 'KaibanJS' : undefined, 49 | }, 50 | external, 51 | plugins: [ 52 | typescript({ 53 | tsconfig: './tsconfig.json', 54 | sourceMap: isDevelopment, 55 | declaration: true, 56 | declarationDir: 'dist/types', 57 | exclude: ['**/__tests__/**', '**/types/**'], 58 | }), 59 | resolve({ 60 | browser: true, 61 | preferBuiltins: false, 62 | mainFields: ['browser', 'module', 'main'], 63 | }), 64 | commonjs(), 65 | // nodePolyfills(), // Correctly named polyfill plugin for Node.js 66 | ...(isTest 67 | ? [ 68 | replace({ 69 | 'shims.fetch': `(...args) => { return global.fetch(...args); };\n`, 70 | preventAssignment: true, 71 | }), 72 | ] 73 | : []), 74 | ...(!isDevelopment ? [terser()] : []), 75 | ], 76 | onwarn(warning, warn) { 77 | if (warning.code === 'THIS_IS_UNDEFINED') return; 78 | warn(warning); 79 | }, 80 | }; 81 | } 82 | 83 | const configurations = [ 84 | generateConfig('cjs'), // Node.js CommonJS 85 | ]; 86 | 87 | if (!isTest) { 88 | configurations.push(generateConfig('umd')); 89 | configurations.push(generateConfig('dts')); 90 | configurations.push(generateConfig('es')); 91 | } 92 | 93 | export default configurations; 94 | -------------------------------------------------------------------------------- /src/agents/index.ts: -------------------------------------------------------------------------------- 1 | export * from './reactChampionAgent'; 2 | export * from './baseAgent'; 3 | -------------------------------------------------------------------------------- /src/stores/index.ts: -------------------------------------------------------------------------------- 1 | export * from './teamStore'; 2 | export * from './teamStore.types'; 3 | -------------------------------------------------------------------------------- /src/stores/taskStore.types.ts: -------------------------------------------------------------------------------- 1 | import { Agent, Task } from '..'; 2 | import { BaseAgent } from '../agents/baseAgent'; 3 | import { FEEDBACK_STATUS_enum, TASK_STATUS_enum } from '../utils/enums'; 4 | import { WORKFLOW_STATUS_enum } from '../utils/enums'; 5 | import { AGENT_STATUS_enum } from '../utils/enums'; 6 | import { LLMInvocationError, TaskBlockError } from '../utils/errors'; 7 | import { LLMUsageStats } from '../utils/llmCostCalculator'; 8 | import { TaskStatusLog } from '../types/logs'; 9 | export type TaskStats = { 10 | startTime: number; 11 | endTime: number; 12 | duration: number; 13 | llmUsageStats: LLMUsageStats; 14 | iterationCount: number; 15 | }; 16 | 17 | export type TaskFeedback = { 18 | content: string; 19 | status: FEEDBACK_STATUS_enum; 20 | timestamp: number; 21 | }; 22 | 23 | export type TaskResult = string | Record; 24 | 25 | export type NewTaskStatusUpdateLogParams = { 26 | agent: BaseAgent | Agent; 27 | task: Task; 28 | logDescription: string; 29 | workflowStatus?: WORKFLOW_STATUS_enum; 30 | taskStatus?: TASK_STATUS_enum; 31 | agentStatus?: AGENT_STATUS_enum; 32 | metadata: T['metadata']; 33 | logType?: T['logType']; 34 | }; 35 | 36 | type TaskStoreActions = { 37 | getTaskStats: (task: Task) => TaskStats; 38 | handleTaskCompleted: (params: { 39 | agent: BaseAgent | Agent; // TODO: Check this 40 | task: Task; 41 | result: TaskResult | null; 42 | }) => void; 43 | handleTaskError: (params: { 44 | agent: BaseAgent; 45 | task: Task; 46 | error: Error; 47 | }) => void; 48 | handleTaskBlocked: (params: { task: Task; error: TaskBlockError }) => void; 49 | handleTaskAborted: (params: { 50 | task: Task; 51 | error: LLMInvocationError; 52 | }) => void; 53 | handleTaskPaused: (params: { task: Task }) => void; 54 | handleTaskResumed: (params: { task: Task }) => void; 55 | handleTaskRevised: (params: { task: Task; feedback: TaskFeedback }) => void; 56 | handleTaskValidated: (params: { task: Task }) => void; 57 | prepareTaskStatusUpdateLog: ( 58 | params: NewTaskStatusUpdateLogParams 59 | ) => T; 60 | }; 61 | 62 | export type TaskStoreState = TaskStoreActions; 63 | -------------------------------------------------------------------------------- /src/stores/workflowLoopStore.types.ts: -------------------------------------------------------------------------------- 1 | import { WORKFLOW_ACTION_enum } from '../utils/enums'; 2 | import { ToolCallingPromise } from '../utils/llm.types'; 3 | import { ThinkingPromise } from '../utils/llm.types'; 4 | 5 | export interface WorkflowLoopStoreVariables { 6 | activePromises: Map>; 7 | } 8 | 9 | export type PromiseObject = ThinkingPromise | ToolCallingPromise; 10 | 11 | export interface WorkflowLoopStoreVariables { 12 | activePromises: Map>; 13 | } 14 | 15 | export interface WorkflowLoopStoreActions { 16 | trackPromise: (agentId: string, promiseObj: PromiseObject) => void; 17 | removePromise: (agentId: string, promiseObj: PromiseObject) => void; 18 | abortAgentPromises: (agentId: string, action: WORKFLOW_ACTION_enum) => void; 19 | pauseWorkflow: () => Promise; 20 | resumeWorkflow: () => Promise; 21 | stopWorkflow: () => Promise; 22 | } 23 | 24 | export type WorkflowLoopState = WorkflowLoopStoreVariables & 25 | WorkflowLoopStoreActions; 26 | -------------------------------------------------------------------------------- /src/tools/baseTool.ts: -------------------------------------------------------------------------------- 1 | import { StructuredTool } from '@langchain/core/tools'; 2 | 3 | export type ToolResult = string | Record; 4 | 5 | // TODO: Add a BaseTool class that works as an adapter for tool from different libraries 6 | export type BaseTool = StructuredTool; 7 | -------------------------------------------------------------------------------- /src/tools/blockTaskTool.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | import { BaseAgent } from '../agents/baseAgent'; 3 | import { StructuredTool } from '@langchain/core/tools'; 4 | import { ToolResult } from './baseTool'; 5 | 6 | /** 7 | * Tool for blocking tasks when they cannot or should not proceed. 8 | * This tool allows agents to explicitly block tasks for various reasons such as: 9 | * - Insufficient permissions/clearance 10 | * - Missing prerequisites 11 | * - Security concerns 12 | * - Resource constraints 13 | */ 14 | export class BlockTaskTool extends StructuredTool { 15 | name = 'block_task'; 16 | description = 17 | 'Use this tool to block the current task when you cannot or should not proceed. Provide a clear reason for blocking.'; 18 | schema = z.object({ 19 | reason: z.string().describe('The reason for blocking the task'), 20 | }); 21 | protected agent: BaseAgent; 22 | 23 | constructor(agent: BaseAgent) { 24 | super(); 25 | this.agent = agent; 26 | } 27 | 28 | async _call(input: Record): Promise { 29 | const { reason } = input; 30 | return { 31 | action: 'BLOCK_TASK', 32 | reason, 33 | result: `Task blocked: ${reason}`, 34 | }; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/types/logs/common.ts: -------------------------------------------------------------------------------- 1 | import { ZodError, ZodSchema } from 'zod'; 2 | import { FEEDBACK_STATUS_enum, WORKFLOW_STATUS_enum } from '../../utils/enums'; 3 | import { ParsedLLMOutput } from '../../utils/llm.types'; 4 | import { CostResult, LLMUsageStats } from '../../utils/llmCostCalculator'; 5 | 6 | // Common types used across different metadata 7 | export type Feedback = { 8 | content: string; 9 | status: FEEDBACK_STATUS_enum; 10 | timestamp: number; 11 | }; 12 | 13 | export type LLMOutput = { 14 | parsedLLMOutput: ParsedLLMOutput; 15 | llmOutput: string; 16 | outputSchema?: ZodSchema; 17 | outputSchemaErrors?: ZodError; 18 | }; 19 | 20 | // Base metadata type 21 | export type WorkflowBaseMetadata = { 22 | message?: string; 23 | }; 24 | 25 | // Common metadata with cost information 26 | export type CostMetadata = WorkflowBaseMetadata & { 27 | costDetails: CostResult; 28 | llmUsageStats: LLMUsageStats; 29 | }; 30 | 31 | // Common stats interface 32 | export interface WorkflowStats { 33 | startTime: number; 34 | endTime: number; 35 | duration: number; 36 | llmUsageStats: { 37 | inputTokens: number; 38 | outputTokens: number; 39 | callsCount: number; 40 | callsErrorCount: number; 41 | parsingErrors: number; 42 | }; 43 | iterationCount: number; 44 | costDetails: { 45 | costInputTokens: number; 46 | costOutputTokens: number; 47 | totalCost: number; 48 | }; 49 | teamName: string; 50 | taskCount: number; 51 | agentCount: number; 52 | } 53 | 54 | // Common result interface 55 | export interface WorkflowResult { 56 | status: WORKFLOW_STATUS_enum; 57 | result: unknown | null; 58 | stats: WorkflowStats | null; 59 | } 60 | 61 | export interface BaseWorkflowLog { 62 | timestamp: number; 63 | logDescription: string; 64 | logType: 'WorkflowStatusUpdate' | 'AgentStatusUpdate' | 'TaskStatusUpdate'; 65 | } 66 | 67 | export type WorkflowLogMetadata = WorkflowBaseMetadata; 68 | -------------------------------------------------------------------------------- /src/types/logs/index.ts: -------------------------------------------------------------------------------- 1 | import { AgentStatusLog } from './agentLogs.types'; 2 | import { TaskStatusLog } from './taskLogs.types'; 3 | import { WorkflowStatusLog } from './workflowLogs.types'; 4 | 5 | export * from './common'; 6 | export * from './workflowLogs.types'; 7 | export * from './agentLogs.types'; 8 | export * from './taskLogs.types'; 9 | 10 | // Union type for all logs 11 | export type WorkflowLog = WorkflowStatusLog | AgentStatusLog | TaskStatusLog; 12 | -------------------------------------------------------------------------------- /src/utils/llm.types.ts: -------------------------------------------------------------------------------- 1 | import { LLMResult } from '@langchain/core/outputs'; 2 | import { ZodError, ZodSchema } from 'zod'; 3 | import { ToolResult } from '../tools/baseTool'; 4 | /** Supported LLM providers */ 5 | export type LLMProvider = string; 6 | export type ModelCode = string; 7 | 8 | /** 9 | * Parsed output from the LLM 10 | */ 11 | export interface ParsedLLMOutput { 12 | // Action related 13 | action?: string; 14 | actionInput?: Record | string | null; 15 | 16 | // Final answer related 17 | finalAnswer?: Record | string; 18 | isValidOutput?: boolean; 19 | outputSchema?: ZodSchema | null; 20 | outputSchemaErrors?: ZodError; 21 | 22 | // Thinking related 23 | thought?: string; 24 | observation?: string; 25 | } 26 | 27 | export type ThinkingResult = { 28 | parsedLLMOutput: ParsedLLMOutput; 29 | llmOutput: string; 30 | llmUsageStats: { 31 | inputTokens: number; 32 | outputTokens: number; 33 | }; 34 | }; 35 | 36 | export type LLMOutput = LLMResult; 37 | 38 | /** 39 | * Metadata about the agent's execution 40 | */ 41 | type AgentLoopMetadata = { 42 | /** Number of iterations performed */ 43 | iterations: number; 44 | /** Maximum number of iterations allowed */ 45 | maxAgentIterations: number; 46 | }; 47 | 48 | /** 49 | * Result of a successful agent execution 50 | */ 51 | type AgentLoopSuccess = { 52 | result: ParsedLLMOutput | null; 53 | error?: never; 54 | metadata: AgentLoopMetadata; 55 | }; 56 | 57 | /** 58 | * Result of a failed agent execution 59 | */ 60 | type AgentLoopError = { 61 | result?: never; 62 | error: string; 63 | metadata: AgentLoopMetadata; 64 | }; 65 | 66 | /** 67 | * Combined type representing all possible outcomes of an agent's execution loop 68 | */ 69 | export type AgentLoopResult = AgentLoopSuccess | AgentLoopError; 70 | 71 | export type ThinkingPromise = { 72 | promise: Promise; 73 | reject: (error: Error) => void; 74 | }; 75 | 76 | export type ToolCallingPromise = { 77 | promise: Promise; 78 | reject: (error: Error) => void; 79 | }; 80 | -------------------------------------------------------------------------------- /src/utils/logger.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Logging Utility. 3 | * 4 | * This module sets up and configures the logging system used across the KaibanJS library. 5 | * It provides a centralized logger that can be imported and used throughout the library, 6 | * with support for dynamic log level configuration. 7 | * 8 | * @module logger 9 | */ 10 | 11 | import log from 'loglevel'; 12 | 13 | /** Valid log levels for the application */ 14 | export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent'; 15 | 16 | // Set initial log level 17 | log.setLevel(log.levels.INFO); // Default to 'info' level 18 | 19 | /** 20 | * Sets the logging level for the application 21 | * @param level - The desired logging level 22 | */ 23 | export const setLogLevel = (level: LogLevel): void => { 24 | // Convert level to uppercase and explicitly type as keyof typeof log.levels 25 | const upperLevel = level.toUpperCase() as keyof typeof log.levels; 26 | log.setLevel(log.levels[upperLevel]); 27 | }; 28 | 29 | /** The main logger instance */ 30 | export const logger = log; 31 | -------------------------------------------------------------------------------- /src/utils/objectUtils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Gets the value at path of object. If the resolved value is undefined, 3 | * returns the defaultValue. 4 | */ 5 | // export function oget( 6 | // object: unknown, 7 | // path: string | string[], 8 | // defaultValue?: unknown 9 | // ): unknown { 10 | // if (!object) return defaultValue; 11 | 12 | // const keys = Array.isArray(path) ? path : path.split('.'); 13 | // let result = object; 14 | 15 | // for (const key of keys) { 16 | // if (result === null || result === undefined) { 17 | // return defaultValue; 18 | // } 19 | // result = result[key] as unknown; 20 | // } 21 | 22 | // return result === undefined ? defaultValue : result; 23 | // } 24 | 25 | export function oget( 26 | obj: Record, 27 | path: string, 28 | defaultValue?: T 29 | ): T | undefined { 30 | const keys = path.split('.'); 31 | let result: any = obj; 32 | 33 | for (const key of keys) { 34 | if (result && typeof result === 'object' && key in result) { 35 | result = result[key]; 36 | } else { 37 | return defaultValue; 38 | } 39 | } 40 | return result as T; 41 | } 42 | 43 | /** 44 | * Sets the value at path of object. If a portion of path doesn't exist, it's created. 45 | * Arrays are created for missing index properties while objects are created for all 46 | * other missing properties. 47 | */ 48 | export function oset( 49 | obj: Record, 50 | path: string, 51 | value: unknown 52 | ): void { 53 | const keys = path.split('.'); 54 | let current: Record = obj; 55 | 56 | for (let i = 0; i < keys.length - 1; i++) { 57 | const key = keys[i]; 58 | 59 | if (!(key in current) || typeof current[key] !== 'object') { 60 | current[key] = {}; 61 | } 62 | current = current[key] as Record; 63 | } 64 | current[keys[keys.length - 1]] = value; 65 | } 66 | 67 | export function isEmpty(obj: Record | undefined): boolean { 68 | if (!obj) return true; 69 | return Object.keys(obj).length === 0; 70 | } 71 | -------------------------------------------------------------------------------- /src/utils/tasks.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Task Utility Functions. 3 | * 4 | * This module provides utility functions for managing task properties and behaviors. 5 | * It includes functions for interpolating task descriptions with dynamic data and 6 | * retrieving concise titles for logging purposes. 7 | * 8 | * @module tasks 9 | */ 10 | 11 | import { Task } from '../index'; 12 | 13 | /** Generic type for key-value pairs */ 14 | export type KeyValuePairs = Record; 15 | 16 | /** 17 | * Gets a concise title for a task suitable for logging 18 | * @param task - The task object containing title and/or description 19 | * @returns A short title string for the task 20 | */ 21 | export function getTaskTitleForLogs(task: Task): string { 22 | return ( 23 | task.title || 24 | (task.description 25 | ? task.description.split(' ').slice(0, 3).join(' ') + '...' 26 | : 'Untitled') 27 | ); 28 | } 29 | 30 | /** 31 | * Interpolates placeholders in a task description with input values 32 | * @param description - The description template containing placeholders 33 | * @param inputs - Object containing input values to interpolate 34 | * @returns The interpolated description 35 | * @deprecated Use interpolateTaskDescriptionV2 instead 36 | */ 37 | export function interpolateTaskDescription( 38 | description: string, 39 | inputs: KeyValuePairs 40 | ): string { 41 | let result = description; 42 | 43 | for (const key in inputs) { 44 | const placeholder = `{${key}}`; 45 | result = result.replace(placeholder, String(inputs[key])); 46 | } 47 | 48 | return result; 49 | } 50 | 51 | /** 52 | * Enhanced version of interpolateTaskDescription that supports both input values and task results 53 | * @param description - The description template containing placeholders 54 | * @param inputs - Object containing input values to interpolate 55 | * @param taskResults - Object containing task results to interpolate 56 | * @returns The interpolated description 57 | */ 58 | export function interpolateTaskDescriptionV2( 59 | description: string, 60 | inputs: Record = {}, 61 | taskResults: Record = {} 62 | ): string { 63 | let result = description; 64 | 65 | // Replace input placeholders 66 | for (const key in inputs) { 67 | const placeholder = `{${key}}`; 68 | result = result.replace(new RegExp(placeholder, 'g'), String(inputs[key])); 69 | } 70 | 71 | // Replace task result placeholders 72 | for (const key in taskResults) { 73 | const placeholder = `{taskResult:${key}}`; 74 | result = result.replace( 75 | new RegExp(placeholder, 'g'), 76 | String(taskResults[key]) 77 | ); 78 | } 79 | 80 | return result; 81 | } 82 | -------------------------------------------------------------------------------- /tests/e2e/customLLMs.test.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config({ path: './.env.local' }); 2 | const openAITeam = require('./examples/teams/llms/openai'); 3 | 4 | describe('Custom LLMs Instances Workflows', () => { 5 | describe('Using OpenAI Intance', () => { 6 | it('initializes the team successfully', async () => { 7 | const store = openAITeam.useStore(); 8 | expect(store.getState().getCleanedState()).toMatchSnapshot(); 9 | }); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /tests/e2e/examples/teams/by_llm/google/productSpecsTeam.js: -------------------------------------------------------------------------------- 1 | const { Agent, Task, Team } = require('kaibanjs'); 2 | 3 | // Define agents 4 | const requirementsAnalyst = new Agent({ 5 | name: 'Emma', 6 | role: 'Requirements Analyst', 7 | goal: 'Outline core functionalities and objectives for new features based on the founder’s input.', 8 | background: 'Business Analysis', 9 | tools: [], 10 | llmConfig: { 11 | provider: 'google', 12 | model: 'gemini-1.5-flash', 13 | }, 14 | }); 15 | 16 | const technicalWriter = new Agent({ 17 | name: 'Lucas', 18 | role: 'Technical Writer', 19 | goal: 'Convert functional outlines into detailed technical specifications.', 20 | background: 'Technical Writing', 21 | tools: [], 22 | llmConfig: { 23 | provider: 'google', 24 | model: 'gemini-1.5-flash', 25 | }, 26 | }); 27 | 28 | const validator = new Agent({ 29 | name: 'Mia', 30 | role: 'Validator', 31 | goal: 'Ensure the specifications are accurate and complete.', 32 | background: 'Quality Assurance', 33 | tools: [], 34 | llmConfig: { 35 | provider: 'google', 36 | model: 'gemini-1.5-flash', 37 | }, 38 | }); 39 | 40 | // Define tasks 41 | const analysisTask = new Task({ 42 | description: `Analyze the founder's idea: {founderIdea} and outline the necessary functionalities to implement it.`, 43 | expectedOutput: 'A functional outline of the Founder Idea', 44 | agent: requirementsAnalyst, 45 | }); 46 | 47 | const writingTask = new Task({ 48 | description: `Create detailed technical specifications based on the functional outline provided. Include user stories, system requirements, and acceptance criteria.`, 49 | expectedOutput: 'A detailed technical specifications document.', 50 | isDeliverable: true, 51 | agent: technicalWriter, 52 | }); 53 | 54 | const validationTask = new Task({ 55 | description: `Review the technical specifications to ensure they match the founder's vision and that are technically feasible.`, 56 | expectedOutput: 57 | 'A validated technical specifications document ready for development. Must be in Markdown format.', 58 | agent: validator, 59 | }); 60 | 61 | // Create a team 62 | const team = new Team({ 63 | name: 'Product Specs Team', 64 | agents: [requirementsAnalyst, technicalWriter, validator], 65 | tasks: [analysisTask, writingTask, validationTask], 66 | inputs: { 67 | founderIdea: 'I want to add a Referral program to our SAAS platform.', 68 | }, // Initial input for the first task 69 | env: { GOOGLE_API_KEY: process.env.GOOGLE_API_KEY }, // Environment variables for the team 70 | }); 71 | 72 | module.exports = team; 73 | -------------------------------------------------------------------------------- /tests/e2e/examples/teams/by_llm/mistral/productSpecsTeam.js: -------------------------------------------------------------------------------- 1 | const { Agent, Task, Team } = require('kaibanjs'); 2 | 3 | // Define agents 4 | const requirementsAnalyst = new Agent({ 5 | name: 'Emma', 6 | role: 'Requirements Analyst', 7 | goal: 'Outline core functionalities and objectives for new features based on the founder’s input.', 8 | background: 'Business Analysis', 9 | tools: [], 10 | llmConfig: { 11 | provider: 'mistral', 12 | model: 'mistral-small', 13 | }, 14 | }); 15 | 16 | const technicalWriter = new Agent({ 17 | name: 'Lucas', 18 | role: 'Technical Writer', 19 | goal: 'Convert functional outlines into detailed technical specifications.', 20 | background: 'Technical Writing', 21 | tools: [], 22 | llmConfig: { 23 | provider: 'mistral', 24 | model: 'mistral-small', 25 | }, 26 | }); 27 | 28 | const validator = new Agent({ 29 | name: 'Mia', 30 | role: 'Validator', 31 | goal: 'Ensure the specifications are accurate and complete.', 32 | background: 'Quality Assurance', 33 | tools: [], 34 | llmConfig: { 35 | provider: 'mistral', 36 | model: 'mistral-small', 37 | }, 38 | }); 39 | 40 | // Define tasks 41 | const analysisTask = new Task({ 42 | description: `Analyze the founder's idea: {founderIdea} and outline the necessary functionalities to implement it.`, 43 | expectedOutput: 'A functional outline of the Founder Idea', 44 | agent: requirementsAnalyst, 45 | }); 46 | 47 | const writingTask = new Task({ 48 | description: `Create detailed technical specifications based on the functional outline provided. Include user stories, system requirements, and acceptance criteria.`, 49 | expectedOutput: 'A detailed technical specifications document.', 50 | isDeliverable: true, 51 | agent: technicalWriter, 52 | }); 53 | 54 | const validationTask = new Task({ 55 | description: `Review the technical specifications to ensure they match the founder's vision and that are technically feasible.`, 56 | expectedOutput: 57 | 'A validated technical specifications document ready for development. Must be in Markdown format.', 58 | agent: validator, 59 | }); 60 | 61 | // Create a team 62 | const team = new Team({ 63 | name: 'Product Specs Team', 64 | agents: [requirementsAnalyst, technicalWriter, validator], 65 | tasks: [analysisTask, writingTask, validationTask], 66 | inputs: { 67 | founderIdea: 'I want to add a Referral program to our SAAS platform.', 68 | }, // Initial input for the first task 69 | env: { MISTRAL_API_KEY: process.env.MISTRAL_API_KEY }, // Environment variables for the team 70 | }); 71 | 72 | module.exports = team; 73 | -------------------------------------------------------------------------------- /tests/e2e/examples/teams/by_llm/openai/productSpecsTeam.js: -------------------------------------------------------------------------------- 1 | const { Agent, Task, Team } = require('kaibanjs'); 2 | 3 | // Define tools 4 | 5 | // Define agents 6 | const requirementsAnalyst = new Agent({ 7 | name: 'Emma', 8 | role: 'Requirements Analyst', 9 | goal: 'Outline core functionalities and objectives for new features based on the founder’s input.', 10 | background: 'Business Analysis', 11 | tools: [], 12 | }); 13 | 14 | const technicalWriter = new Agent({ 15 | name: 'Lucas', 16 | role: 'Technical Writer', 17 | goal: 'Convert functional outlines into detailed technical specifications.', 18 | background: 'Technical Writing', 19 | tools: [], 20 | }); 21 | 22 | const validator = new Agent({ 23 | name: 'Mia', 24 | role: 'Validator', 25 | goal: 'Ensure the specifications are accurate and complete.', 26 | background: 'Quality Assurance', 27 | tools: [], 28 | }); 29 | 30 | // Define tasks 31 | const analysisTask = new Task({ 32 | description: `Analyze the founder's idea: {founderIdea} and outline the necessary functionalities to implement it.`, 33 | expectedOutput: 'A functional outline of the Founder Idea', 34 | agent: requirementsAnalyst, 35 | }); 36 | 37 | const writingTask = new Task({ 38 | description: `Create detailed technical specifications based on the functional outline provided. Include user stories, system requirements, and acceptance criteria.`, 39 | expectedOutput: 'A detailed technical specifications document.', 40 | isDeliverable: true, 41 | agent: technicalWriter, 42 | }); 43 | 44 | const validationTask = new Task({ 45 | description: `Review the technical specifications to ensure they match the founder's vision and that are technically feasible.`, 46 | expectedOutput: 47 | 'A validated technical specifications document ready for development. Must be in Markdown format.', 48 | agent: validator, 49 | }); 50 | 51 | // Create a team 52 | const team = new Team({ 53 | name: 'Product Specs Team', 54 | agents: [requirementsAnalyst, technicalWriter, validator], 55 | tasks: [analysisTask, writingTask, validationTask], 56 | inputs: { 57 | founderIdea: 'I want to add a Referral program to our SAAS platform.', 58 | }, // Initial input for the first task, 59 | env: { OPENAI_API_KEY: process.env.OPENAI_API_KEY }, // Environment variables for the team 60 | }); 61 | 62 | module.exports = team; 63 | -------------------------------------------------------------------------------- /tests/e2e/examples/teams/insights/openai.js: -------------------------------------------------------------------------------- 1 | const { Agent, Task, Team } = require('kaibanjs'); 2 | 3 | // Define agents 4 | const profileAnalystAgent = new Agent({ 5 | name: 'Alice', 6 | role: 'Passenger Profile Analyst', 7 | goal: 'Analyze passenger history and preferences to identify key patterns and needs.', 8 | background: 'Customer Behavior Analysis and Travel Preferences', 9 | }); 10 | 11 | const recommendationAgent = new Agent({ 12 | name: 'Bob', 13 | role: 'Travel Experience Specialist', 14 | goal: 'Create personalized travel recommendations based on passenger profile analysis.', 15 | background: 'Personalized Travel Planning and Customer Experience', 16 | }); 17 | 18 | // Define tasks 19 | const analysisTask = new Task({ 20 | description: `Analyze passenger profile: {passenger_name} and identify key preferences and patterns. Consider their past travel history and experiences.`, 21 | expectedOutput: 22 | 'A detailed analysis of passenger preferences and behavior patterns.', 23 | agent: profileAnalystAgent, 24 | }); 25 | 26 | const recommendationTask = new Task({ 27 | description: `Based on the passenger analysis, create personalized travel recommendations for their upcoming London-Dubai flight.`, 28 | expectedOutput: 29 | 'Personalized travel recommendations considering passenger history and preferences.', 30 | isDeliverable: true, 31 | agent: recommendationAgent, 32 | }); 33 | 34 | // Create a team with insights 35 | const team = new Team({ 36 | name: 'Passenger Experience Team', 37 | agents: [profileAnalystAgent, recommendationAgent], 38 | tasks: [analysisTask, recommendationTask], 39 | inputs: { 40 | passenger_name: 'Michael Zhang', 41 | }, 42 | insights: ` 43 | Passenger Profile: Michael Zhang (Frequent Flyer ID: FF-789321) 44 | Travel History and Preferences (2023): 45 | 1. Consistently books window seats (87% of flights), particularly on row 11 (Booking History #BK-2023-156) 46 | 2. Experienced significant delays on last Dubai trip (Flight DXB-892), filed complaint about lack of updates 47 | 3. Premium meal selection history shows strong preference for Asian Vegetarian meals (ordered on 9 out of 10 long-haul flights) 48 | 4. Always uses airport lounge at Terminal 4 during layovers (average stay: 2.5 hours, Lounge Access Log #LA-567) 49 | 5. Recent feedback (Survey ID: CS-982) indicated dissatisfaction with in-flight entertainment options on Boeing 787 fleet`, 50 | env: { OPENAI_API_KEY: process.env.OPENAI_API_KEY }, 51 | logLevel: 'error', 52 | }); 53 | 54 | module.exports = team; 55 | -------------------------------------------------------------------------------- /tests/e2e/examples/teams/llm_proxy/openai.js: -------------------------------------------------------------------------------- 1 | const { Agent, Task, Team } = require('kaibanjs'); 2 | 3 | // Define agents 4 | const profileAnalyst = new Agent({ 5 | name: 'Mary', 6 | role: 'Profile Analyst', 7 | goal: 'Extract structured information from conversational user input.', 8 | background: 'Data Processor', 9 | tools: [], // Tools are omitted for now 10 | llmConfig: { 11 | provider: 'openai', 12 | apiBaseUrl: 'https://proxy.kaibanjs.com/llm/openai', 13 | }, 14 | }); 15 | 16 | const resumeWriter = new Agent({ 17 | name: 'Alex Mercer', 18 | role: 'Resume Writer', 19 | goal: `Craft compelling, well-structured resumes 20 | that effectively showcase job seekers qualifications and achievements.`, 21 | background: `Extensive experience in recruiting, 22 | copywriting, and human resources, enabling 23 | effective resume design that stands out to employers.`, 24 | tools: [], 25 | llmConfig: { 26 | provider: 'openai', 27 | apiBaseUrl: 'https://proxy.kaibanjs.com/llm/openai', 28 | }, 29 | }); 30 | 31 | // Define tasks 32 | const processingTask = new Task({ 33 | description: `Extract relevant details such as name, 34 | experience, skills, and job history from the user's 'aboutMe' input. 35 | aboutMe: {aboutMe}`, 36 | expectedOutput: 'Structured data ready to be used for a resume creation.', 37 | agent: profileAnalyst, 38 | }); 39 | 40 | const resumeCreationTask = new Task({ 41 | description: `Utilize the structured data to create 42 | a detailed and attractive resume. 43 | Enrich the resume content by inferring additional details from the provided information. 44 | Include sections such as a personal summary, detailed work experience, skills, and educational background.`, 45 | expectedOutput: `A professionally formatted resume in markdown format, 46 | ready for submission to potential employers.`, 47 | agent: resumeWriter, 48 | }); 49 | 50 | // Create a team 51 | const team = new Team({ 52 | name: 'Resume Creation Team', 53 | agents: [profileAnalyst, resumeWriter], 54 | tasks: [processingTask, resumeCreationTask], 55 | inputs: { 56 | aboutMe: `My name is David Llaca. 57 | JavaScript Developer for 5 years. 58 | I worked for three years at Disney, 59 | where I developed user interfaces for their primary landing pages 60 | using React, NextJS, and Redux. Before Disney, 61 | I was a Junior Front-End Developer at American Airlines, 62 | where I worked with Vue and Tailwind. 63 | I earned a Bachelor of Science in Computer Science from FIU in 2018, 64 | and I completed a JavaScript bootcamp that same year.`, 65 | }, // Initial input for the first task 66 | env: { OPENAI_API_KEY: 'fake-api-key-here' }, // Environment variables for the team 67 | logLevel: 'error', 68 | }); 69 | 70 | module.exports = team; 71 | -------------------------------------------------------------------------------- /tests/e2e/examples/teams/output_schema/openai.js: -------------------------------------------------------------------------------- 1 | const { Agent, Task, Team } = require('kaibanjs'); 2 | const { z } = require('zod'); 3 | 4 | // Define agents 5 | const writerAgent = new Agent({ 6 | name: 'Clark Kent', 7 | role: 'Write history fact summary', 8 | goal: 'Write a summary about any given historical fact.', 9 | background: 'Writer', 10 | type: 'ReactChampionAgent', 11 | }); 12 | 13 | const schemaSummary = z.object({ 14 | title: z.string().describe('The title for historical fact summary'), 15 | summary: z.string().describe('The historical fact summary'), 16 | time_range: z 17 | .string() 18 | .describe( 19 | 'Range of years in which the historical fact occurs. example: "1815-1816" ' 20 | ), 21 | figures: z 22 | .array(z.string()) 23 | .describe('List of historical figures involved in the historical fact'), 24 | countries: z 25 | .array(z.string()) 26 | .describe('List of countries involved in the historical fact'), 27 | words: z.number().describe('Number of words in the summary'), 28 | }); 29 | 30 | // Define tasks 31 | const writeTask = new Task({ 32 | description: `Write detailed summaries about {fact}, giving dates, historical figures involved, motives, and repercussions of the fact.`, 33 | expectedOutput: 34 | 'A well-structured and detailed summary about historical fact, add metadata like title, epoch of fact, historical figures, countries and number of words', 35 | outputSchema: schemaSummary, 36 | agent: writerAgent, 37 | }); 38 | 39 | // Team to coordinate the agents 40 | const team = new Team({ 41 | name: 'History fact summary Team', 42 | agents: [writerAgent], 43 | tasks: [writeTask], 44 | inputs: { fact: 'Normandy landings' }, // Placeholder for dynamic input 45 | env: { OPENAI_API_KEY: process.env.OPENAI_API_KEY }, // Environment variables for the team, 46 | logLevel: 'error', 47 | }); 48 | 49 | module.exports = team; 50 | -------------------------------------------------------------------------------- /tests/e2e/examples/teams/product_specs/openai.js: -------------------------------------------------------------------------------- 1 | const { Agent, Task, Team } = require('kaibanjs'); 2 | 3 | // Define tools 4 | 5 | // Define agents 6 | const requirementsAnalyst = new Agent({ 7 | name: 'Emma', 8 | role: 'Requirements Analyst', 9 | goal: 'Outline core functionalities and objectives for new features based on the founder’s input.', 10 | background: 'Business Analysis', 11 | // tools: [] 12 | }); 13 | 14 | const technicalWriter = new Agent({ 15 | name: 'Lucas', 16 | role: 'Technical Writer', 17 | goal: 'Convert functional outlines into detailed technical specifications.', 18 | background: 'Technical Writing', 19 | tools: [], 20 | }); 21 | 22 | const validator = new Agent({ 23 | name: 'Mia', 24 | role: 'Validator', 25 | goal: 'Ensure the specifications are accurate and complete.', 26 | background: 'Quality Assurance', 27 | tools: [], 28 | }); 29 | 30 | // Define tasks 31 | const analysisTask = new Task({ 32 | description: `Analyze the founder's idea: {founderIdea} and outline the necessary functionalities to implement it.`, 33 | expectedOutput: 'A functional outline of the Founder Idea', 34 | agent: requirementsAnalyst, 35 | }); 36 | 37 | const writingTask = new Task({ 38 | description: `Create detailed technical specifications based on the functional outline provided. Include user stories, system requirements, and acceptance criteria.`, 39 | expectedOutput: 40 | 'A detailed technical specifications document. Must be in Markdown format.', 41 | isDeliverable: true, 42 | agent: technicalWriter, 43 | }); 44 | 45 | const validationTask = new Task({ 46 | description: `Review the technical specifications to ensure they match the founder's vision and that are technically feasible.`, 47 | expectedOutput: 48 | 'A validated technical specifications document ready for development. Must be in Markdown format.', 49 | agent: validator, 50 | }); 51 | 52 | // Create a team 53 | const team = new Team({ 54 | name: 'Product Specs Team', 55 | agents: [requirementsAnalyst, technicalWriter, validator], 56 | tasks: [analysisTask, writingTask, validationTask], 57 | inputs: { 58 | founderIdea: 'I want to add a Referral program to our SAAS platform.', 59 | }, // Initial input for the first task, 60 | env: { OPENAI_API_KEY: process.env.OPENAI_API_KEY }, // Environment variables for the team 61 | logLevel: 'error', 62 | }); 63 | 64 | module.exports = team; 65 | -------------------------------------------------------------------------------- /tests/e2e/examples/teams/product_specs/openai_hitl.js: -------------------------------------------------------------------------------- 1 | const { Agent, Task, Team } = require('kaibanjs'); 2 | 3 | // Define agents 4 | const requirementsAnalyst = new Agent({ 5 | name: 'Emma', 6 | role: 'Requirements Analyst', 7 | goal: 'Outline core functionalities and objectives for new features based on the founder’s input.', 8 | background: 'Business Analysis', 9 | tools: [], 10 | }); 11 | 12 | const technicalWriter = new Agent({ 13 | name: 'Lucas', 14 | role: 'Technical Writer', 15 | goal: 'Convert functional outlines into detailed technical specifications.', 16 | background: 'Technical Writing', 17 | tools: [], 18 | }); 19 | 20 | const validator = new Agent({ 21 | name: 'Mia', 22 | role: 'Validator', 23 | goal: 'Ensure the specifications are accurate and complete.', 24 | background: 'Quality Assurance', 25 | tools: [], 26 | }); 27 | 28 | // Define tasks 29 | const analysisTask = new Task({ 30 | description: `Analyze the founder's idea: {founderIdea} and outline the necessary functionalities to implement it.`, 31 | expectedOutput: 'A functional outline of the Founder Idea', 32 | agent: requirementsAnalyst, 33 | externalValidationRequired: true, // This task will require external validation 34 | }); 35 | 36 | const writingTask = new Task({ 37 | description: `Create detailed technical specifications based on the functional outline provided. Include user stories, system requirements, and acceptance criteria.`, 38 | expectedOutput: 39 | 'A detailed technical specifications document. Must be in Markdown format.', 40 | isDeliverable: true, 41 | agent: technicalWriter, 42 | }); 43 | 44 | const validationTask = new Task({ 45 | description: `Review the technical specifications to ensure they match the founder's vision and that are technically feasible.`, 46 | expectedOutput: 47 | 'A validated technical specifications document ready for development. Must be in Markdown format.', 48 | agent: validator, 49 | }); 50 | 51 | // Create a team 52 | const team = new Team({ 53 | name: 'Product Specs Team', 54 | agents: [requirementsAnalyst, technicalWriter, validator], 55 | tasks: [analysisTask, writingTask, validationTask], 56 | inputs: { 57 | founderIdea: 'I want to add a Referral program to our SAAS platform.', 58 | }, // Initial input for the first task, 59 | env: { OPENAI_API_KEY: process.env.OPENAI_API_KEY }, // Environment variables for the team 60 | logLevel: 'error', 61 | }); 62 | 63 | module.exports = team; 64 | -------------------------------------------------------------------------------- /tests/e2e/examples/teams/product_specs/openai_hitl_2.js: -------------------------------------------------------------------------------- 1 | const { Agent, Task, Team } = require('kaibanjs'); 2 | 3 | // Define agents 4 | const requirementsAnalyst = new Agent({ 5 | name: 'Emma', 6 | role: 'Requirements Analyst', 7 | goal: 'Outline core functionalities and objectives for new features based on the founder’s input.', 8 | background: 'Business Analysis', 9 | tools: [], 10 | }); 11 | 12 | const technicalWriter = new Agent({ 13 | name: 'Lucas', 14 | role: 'Technical Writer', 15 | goal: 'Convert functional outlines into detailed technical specifications.', 16 | background: 'Technical Writing', 17 | tools: [], 18 | }); 19 | 20 | const validator = new Agent({ 21 | name: 'Mia', 22 | role: 'Validator', 23 | goal: 'Ensure the specifications are accurate and complete.', 24 | background: 'Quality Assurance', 25 | tools: [], 26 | }); 27 | 28 | // Define tasks 29 | const analysisTask = new Task({ 30 | description: `Analyze the founder's idea: {founderIdea} and outline the necessary functionalities to implement it.`, 31 | expectedOutput: 'A functional outline of the Founder Idea', 32 | agent: requirementsAnalyst, 33 | externalValidationRequired: true, // This task will require external validation 34 | }); 35 | 36 | const writingTask = new Task({ 37 | description: `Create detailed technical specifications based on the functional outline provided. Include user stories, system requirements, and acceptance criteria.`, 38 | expectedOutput: 39 | 'A detailed technical specifications document. Must be in Markdown format.', 40 | isDeliverable: true, 41 | agent: technicalWriter, 42 | }); 43 | 44 | const validationTask = new Task({ 45 | description: `Review the technical specifications to ensure they match the founder's vision and that are technically feasible.`, 46 | expectedOutput: 47 | 'A validated technical specifications document ready for development. Must be in Markdown format.', 48 | agent: validator, 49 | }); 50 | 51 | // Create a team 52 | const team = new Team({ 53 | name: 'Product Specs Team', 54 | agents: [requirementsAnalyst, technicalWriter, validator], 55 | tasks: [analysisTask, writingTask, validationTask], 56 | inputs: { 57 | founderIdea: 'I want to add a Referral program to our SAAS platform.', 58 | }, // Initial input for the first task, 59 | env: { OPENAI_API_KEY: process.env.OPENAI_API_KEY }, // Environment variables for the team 60 | logLevel: 'error', 61 | }); 62 | 63 | module.exports = team; 64 | -------------------------------------------------------------------------------- /tests/e2e/examples/teams/resume_creation/openai.js: -------------------------------------------------------------------------------- 1 | const { Agent, Task, Team } = require('kaibanjs'); 2 | 3 | // Define agents 4 | const profileAnalyst = new Agent({ 5 | name: 'Mary', 6 | role: 'Profile Analyst', 7 | goal: 'Extract structured information from conversational user input.', 8 | background: 'Data Processor', 9 | tools: [], // Tools are omitted for now 10 | }); 11 | 12 | const resumeWriter = new Agent({ 13 | name: 'Alex Mercer', 14 | role: 'Resume Writer', 15 | goal: `Craft compelling, well-structured resumes 16 | that effectively showcase job seekers qualifications and achievements.`, 17 | background: `Extensive experience in recruiting, 18 | copywriting, and human resources, enabling 19 | effective resume design that stands out to employers.`, 20 | tools: [], 21 | }); 22 | 23 | // Define tasks 24 | const processingTask = new Task({ 25 | description: `Extract relevant details such as name, 26 | experience, skills, and job history from the user's 'aboutMe' input. 27 | aboutMe: {aboutMe}`, 28 | expectedOutput: 'Structured data ready to be used for a resume creation.', 29 | agent: profileAnalyst, 30 | }); 31 | 32 | const resumeCreationTask = new Task({ 33 | description: `Utilize the structured data to create 34 | a detailed and attractive resume. 35 | Enrich the resume content by inferring additional details from the provided information. 36 | Include sections such as a personal summary, detailed work experience, skills, and educational background.`, 37 | expectedOutput: `A professionally formatted resume in markdown format, 38 | ready for submission to potential employers.`, 39 | agent: resumeWriter, 40 | }); 41 | 42 | // Create a team 43 | const team = new Team({ 44 | name: 'Resume Creation Team', 45 | agents: [profileAnalyst, resumeWriter], 46 | tasks: [processingTask, resumeCreationTask], 47 | inputs: { 48 | aboutMe: `My name is David Llaca. 49 | JavaScript Developer for 5 years. 50 | I worked for three years at Disney, 51 | where I developed user interfaces for their primary landing pages 52 | using React, NextJS, and Redux. Before Disney, 53 | I was a Junior Front-End Developer at American Airlines, 54 | where I worked with Vue and Tailwind. 55 | I earned a Bachelor of Science in Computer Science from FIU in 2018, 56 | and I completed a JavaScript bootcamp that same year.`, 57 | }, // Initial input for the first task 58 | env: { OPENAI_API_KEY: process.env.OPENAI_API_KEY }, // Environment variables for the team 59 | logLevel: 'error', 60 | }); 61 | 62 | module.exports = team; 63 | -------------------------------------------------------------------------------- /tests/e2e/examples/teams/sport_news/deepseek.js: -------------------------------------------------------------------------------- 1 | const { Agent, Task, Team } = require('kaibanjs'); 2 | const { TavilySearch: TavilySearchResults } = require('@langchain/tavily'); 3 | 4 | // Define tools 5 | const searchTool = new TavilySearchResults({ 6 | maxResults: 3, 7 | // apiKey: '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', 8 | tavilyApiKey: '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', 9 | }); 10 | 11 | // Define agents 12 | const searchAgent = new Agent({ 13 | name: 'Scout', 14 | role: 'Information Gatherer', 15 | goal: 'Find up-to-date information about the given sports query.', 16 | background: 'Research', 17 | type: 'ReactChampionAgent', 18 | tools: [searchTool], 19 | llmConfig: { 20 | provider: 'deepseek', 21 | model: 'deepseek-chat', 22 | }, 23 | maxIterations: 15, 24 | }); 25 | 26 | const contentCreator = new Agent({ 27 | name: 'Writer', 28 | role: 'Content Creator', 29 | goal: 'Generate a comprehensive articles about any sports event.', 30 | background: 'Journalism', 31 | type: 'ReactChampionAgent', 32 | tools: [], 33 | llmConfig: { 34 | provider: 'deepseek', 35 | model: 'deepseek-chat', 36 | }, 37 | maxIterations: 15, 38 | }); 39 | 40 | // Define tasks 41 | const searchTask = new Task({ 42 | description: `Search for detailed information about the sports query: {sportsQuery}`, 43 | expectedOutput: 44 | 'Detailed information about the sports event. Key players, key moments, final score and other usefull information.', 45 | agent: searchAgent, 46 | }); 47 | 48 | const writeTask = new Task({ 49 | description: `Using the gathered information, write a detailed article about the sport event.`, 50 | expectedOutput: 51 | 'A well-structured and engaging sports article. With a title, introduction, body, and conclusion. Min 4 paragrahps long.', 52 | agent: contentCreator, 53 | }); 54 | 55 | // Team to coordinate the agents 56 | const team = new Team({ 57 | name: 'Sports Content Creation Team', 58 | agents: [searchAgent, contentCreator], 59 | tasks: [searchTask, writeTask], 60 | inputs: { sportsQuery: 'Who won the Copa America in 2024?' }, // Placeholder for dynamic input 61 | env: { DEEPSEEK_API_KEY: process.env.DEEPSEEK_API_KEY }, // Environment variables for the team, 62 | logLevel: 'error', 63 | }); 64 | 65 | module.exports = team; 66 | -------------------------------------------------------------------------------- /tests/e2e/examples/teams/sport_news/gemini.js: -------------------------------------------------------------------------------- 1 | const { Agent, Task, Team } = require('kaibanjs'); 2 | const { 3 | TavilySearchResults, 4 | } = require('@langchain/community/tools/tavily_search'); 5 | 6 | // Define tools 7 | const searchTool = new TavilySearchResults({ 8 | maxResults: 3, 9 | // apiKey: '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', 10 | apiKey: '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', 11 | }); 12 | 13 | // Define agents 14 | const searchAgent = new Agent({ 15 | name: 'Scout', 16 | role: 'Information Gatherer', 17 | goal: 'Find up-to-date information about the given sports query.', 18 | background: 'Research', 19 | type: 'ReactChampionAgent', 20 | tools: [searchTool], 21 | llmConfig: { 22 | provider: 'google', 23 | model: 'gemini-1.5-flash', 24 | }, 25 | maxIterations: 15, 26 | }); 27 | 28 | const contentCreator = new Agent({ 29 | name: 'Writer', 30 | role: 'Content Creator', 31 | goal: 'Generate a comprehensive articles about any sports event.', 32 | background: 'Journalism', 33 | type: 'ReactChampionAgent', 34 | tools: [], 35 | llmConfig: { 36 | provider: 'google', 37 | model: 'gemini-1.5-flash', 38 | }, 39 | maxIterations: 15, 40 | }); 41 | 42 | // Define tasks 43 | const searchTask = new Task({ 44 | description: `Search for detailed information about the sports query: {sportsQuery}.`, 45 | expectedOutput: 46 | 'Detailed information about the sports event. Key players, key moments, final score and other usefull information.', 47 | agent: searchAgent, 48 | }); 49 | 50 | const writeTask = new Task({ 51 | description: `Using the gathered information, write a detailed article about the sport event.`, 52 | expectedOutput: 53 | 'A well-structured and engaging sports article. With a title, introduction, body, and conclusion. Min 4 paragrahps long.', 54 | agent: contentCreator, 55 | }); 56 | 57 | // Team to coordinate the agents 58 | const team = new Team({ 59 | name: 'Sports Content Creation Team', 60 | agents: [searchAgent, contentCreator], 61 | tasks: [searchTask, writeTask], 62 | inputs: { sportsQuery: 'Who won the Copa America in 2024?' }, // Placeholder for dynamic input 63 | env: { GOOGLE_API_KEY: process.env.GOOGLE_API_KEY }, // Environment variables for the team, 64 | logLevel: 'error', 65 | }); 66 | 67 | module.exports = team; 68 | -------------------------------------------------------------------------------- /tests/e2e/examples/teams/sport_news/openai.js: -------------------------------------------------------------------------------- 1 | const { Agent, Task, Team } = require('kaibanjs'); 2 | const { 3 | TavilySearchResults, 4 | } = require('@langchain/community/tools/tavily_search'); 5 | 6 | // Define tools 7 | const searchTool = new TavilySearchResults({ 8 | maxResults: 3, 9 | // apiKey: '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', 10 | apiKey: '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', 11 | }); 12 | 13 | // Define agents 14 | const searchAgent = new Agent({ 15 | name: 'Scout', 16 | role: 'Information Gatherer', 17 | goal: 'Find up-to-date information about the given sports query.', 18 | background: 'Research', 19 | type: 'ReactChampionAgent', 20 | tools: [searchTool], 21 | }); 22 | 23 | const contentCreator = new Agent({ 24 | name: 'Writer', 25 | role: 'Content Creator', 26 | goal: 'Generate a comprehensive articles about any sports event.', 27 | background: 'Journalism', 28 | type: 'ReactChampionAgent', 29 | tools: [], 30 | }); 31 | 32 | // Define tasks 33 | const searchTask = new Task({ 34 | description: `Search for detailed information about the sports query: {sportsQuery}.`, 35 | expectedOutput: 36 | 'Detailed information about the sports event. Key players, key moments, final score and other usefull information.', 37 | agent: searchAgent, 38 | }); 39 | 40 | const writeTask = new Task({ 41 | description: `Using the gathered information, write a detailed article about the sport event.`, 42 | expectedOutput: 43 | 'A well-structured and engaging sports article. With a title, introduction, body, and conclusion. Min 4 paragrahps long.', 44 | agent: contentCreator, 45 | }); 46 | 47 | // Team to coordinate the agents 48 | const team = new Team({ 49 | name: 'Sports Content Creation Team', 50 | agents: [searchAgent, contentCreator], 51 | tasks: [searchTask, writeTask], 52 | inputs: { sportsQuery: 'Who won the Copa America in 2024?' }, // Placeholder for dynamic input 53 | env: { OPENAI_API_KEY: process.env.OPENAI_API_KEY }, // Environment variables for the team, 54 | logLevel: 'error', 55 | // Results of the latest UEFA Champions League match. 56 | }); 57 | 58 | module.exports = team; 59 | -------------------------------------------------------------------------------- /tests/e2e/examples/teams/task_blocking/security.js: -------------------------------------------------------------------------------- 1 | const { Agent, Task, Team } = require('kaibanjs'); 2 | 3 | const securityAgent = new Agent({ 4 | name: 'Security Validator', 5 | role: 'Security Clearance Checker', 6 | goal: 'Validate security requirements and block tasks that lack proper authorization', 7 | background: 'Expert in security protocols and access control management', 8 | tools: [], 9 | kanbanTools: ['block-task-tool'], 10 | }); 11 | 12 | const securityTask = new Task({ 13 | description: `You are tasked with reviewing a request to access highly sensitive data. 14 | The request lacks proper authorization credentials and security clearance documentation. 15 | As a security validator, you must assess this situation and take appropriate action. 16 | 17 | Given the missing security credentials, you should block this task using the block_task tool 18 | and provide a clear explanation of why access cannot be granted.`, 19 | agent: securityAgent, 20 | }); 21 | 22 | const team = new Team({ 23 | name: 'Security Validation Team', 24 | agents: [securityAgent], 25 | tasks: [securityTask], 26 | env: { 27 | OPENAI_API_KEY: process.env.OPENAI_API_KEY, 28 | }, 29 | }); 30 | 31 | module.exports = team; 32 | -------------------------------------------------------------------------------- /tests/e2e/insightsTeam.test.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config({ path: './.env.local' }); 2 | // Setup mock 3 | const { mock, restoreAll } = require('../utils/moscaFetch')(); 4 | // For recording mode: 5 | // const { record, getRecords, saveRecords } = require('../utils/moscaFetch')(); 6 | 7 | const openAIInsightsTeam = require('./examples/teams/insights/openai'); 8 | const openAITeamRecordedRequests = require('./examples/teams/insights/openai.requests.json'); 9 | 10 | // Determine if mocks should be applied based on the environment 11 | const withMockedApis = 12 | process.env.TEST_ENV === 'mocked-llm-apis' ? true : false; 13 | 14 | // Enable recording when not using mocks 15 | // record({ 16 | // url: '*', 17 | // method: '*', 18 | // body: '*' 19 | // }); 20 | 21 | describe('Insights-Driven Team Workflows', () => { 22 | describe('Using OpenAI Agents with Team Insights', () => { 23 | beforeEach(() => { 24 | if (withMockedApis) { 25 | mock(openAITeamRecordedRequests); 26 | } 27 | }); 28 | 29 | afterEach(() => { 30 | if (withMockedApis) { 31 | restoreAll(); 32 | } 33 | }); 34 | 35 | it('completes workflow successfully using team insights', async () => { 36 | await openAIInsightsTeam.start(); 37 | const store = openAIInsightsTeam.useStore(); 38 | 39 | expect(store.getState().getCleanedState()).toMatchSnapshot(); 40 | // Save recorded responses 41 | // const recordedData = getRecords(); 42 | // console.log('Recorded data:', recordedData); 43 | // saveRecords(); 44 | }); 45 | }); 46 | }); 47 | -------------------------------------------------------------------------------- /tests/e2e/outputSchemaTeam.test.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config({ path: './.env.local' }); 2 | // Setup mock 3 | const { mock, restoreAll } = require('../utils/moscaFetch')(); 4 | 5 | const historyFactSummaryTeam = require('./examples/teams/output_schema/openai'); 6 | const historyFactSummaryTeamRecordedRequests = require('./examples/teams/output_schema/openai.requests.json'); 7 | 8 | // Determine if mocks should be applied based on the environment 9 | const withMockedApis = 10 | process.env.TEST_ENV === 'mocked-llm-apis' ? true : false; 11 | 12 | describe('History Fact Summary Team Workflows', () => { 13 | describe('Using OpenAI Agents', () => { 14 | beforeEach(() => { 15 | // Mocking all POST requests with a callback 16 | if (withMockedApis) { 17 | mock(historyFactSummaryTeamRecordedRequests); 18 | } 19 | }); 20 | afterEach(() => { 21 | if (withMockedApis) { 22 | restoreAll(); 23 | } 24 | }); 25 | it('completes the entire workflow successfully', async () => { 26 | await historyFactSummaryTeam.start(); 27 | const store = historyFactSummaryTeam.useStore(); 28 | expect(store.getState().getCleanedState()).toMatchSnapshot(); 29 | }); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /tests/e2e/resumeCreationTeam.test.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config({ path: './.env.local' }); 2 | // Setup mock 3 | const { mock, restoreAll } = require('../utils/moscaFetch')(); 4 | // const { record, getRecords, saveRecords } = require('../utils/moscaFetch')(); 5 | 6 | const openAITeam = require('./examples/teams/resume_creation/openai'); 7 | const openAITeamRecordedRequests = require('./examples/teams/resume_creation/openai.requests.json'); 8 | 9 | // Determine if mocks should be applied based on the environment 10 | const withMockedApis = 11 | process.env.TEST_ENV === 'mocked-llm-apis' ? true : false; 12 | 13 | // record({ 14 | // url: '*', 15 | // method: '*', 16 | // body: '*' // Record any POST request to this URL 17 | // }); 18 | 19 | describe('Resume Creation Team Workflows', () => { 20 | describe('Using OpenAI Agents', () => { 21 | beforeEach(() => { 22 | // Mocking all POST requests with a callback 23 | if (withMockedApis) { 24 | mock(openAITeamRecordedRequests); 25 | } 26 | }); 27 | afterEach(() => { 28 | if (withMockedApis) { 29 | restoreAll(); 30 | } 31 | }); 32 | it('completes the entire workflow successfully', async () => { 33 | await openAITeam.start(); 34 | const store = openAITeam.useStore(); 35 | expect(store.getState().getCleanedState()).toMatchSnapshot(); 36 | 37 | // const recordedData = getRecords(); 38 | // console.log(recordedData); 39 | // saveRecords(); 40 | }); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /tests/e2e/taskBlocking.test.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config({ path: './.env.local' }); 2 | // Setup mock 3 | const { mock, restoreAll } = require('../utils/moscaFetch')(); 4 | // Uncomment these lines to record new API interactions 5 | // const { record, getRecords, saveRecords } = require('../utils/moscaFetch')(); 6 | 7 | const securityTeam = require('./examples/teams/task_blocking/security'); 8 | const securityTeamRecordedRequests = require('./examples/teams/task_blocking/security.requests.json'); 9 | 10 | // Determine if mocks should be applied based on the environment 11 | const withMockedApis = 12 | process.env.TEST_ENV === 'mocked-llm-apis' ? true : false; 13 | 14 | // Uncomment to record API interactions 15 | // record({ 16 | // url: '*', 17 | // method: '*', 18 | // body: '*' // Record any POST request to this URL 19 | // }); 20 | 21 | describe('Task Blocking Team Workflows', () => { 22 | describe('Using Security Validation Agent', () => { 23 | beforeEach(() => { 24 | // Mocking all POST requests with a callback 25 | if (withMockedApis) { 26 | mock(securityTeamRecordedRequests); 27 | } 28 | }); 29 | 30 | afterEach(() => { 31 | if (withMockedApis) { 32 | restoreAll(); 33 | } 34 | }); 35 | 36 | it('blocks the task due to security requirements', async () => { 37 | await securityTeam.start(); 38 | const store = securityTeam.useStore(); 39 | const state = store.getState().getCleanedState(); 40 | 41 | // Verify the workflow was blocked 42 | expect(state.teamWorkflowStatus).toBe('BLOCKED'); 43 | 44 | // Verify task status 45 | const task = state.tasks[0]; 46 | expect(task.status).toBe('BLOCKED'); 47 | 48 | // Match the entire state snapshot 49 | expect(state).toMatchSnapshot(); 50 | 51 | // Uncomment to save recorded API interactions 52 | // const recordedData = getRecords(); 53 | // console.log(recordedData); 54 | // saveRecords(); 55 | }); 56 | }); 57 | }); 58 | -------------------------------------------------------------------------------- /tests/utils/moscaFetch/Readme.md: -------------------------------------------------------------------------------- 1 | # MoscaFetch Utility 2 | 3 | ## Introduction 4 | 5 | `moscaFetch` is a testing utility designed to simplify the process of mocking and recording HTTP requests in Node.js environments. It provides an easy-to-use API for setting up mocks and capturing actual request-response cycles for use in tests. 6 | 7 | ## Features 8 | 9 | - **Mock HTTP Requests**: Simulate HTTP responses without making actual network calls. 10 | - **Record Requests**: Capture and log HTTP requests and responses to refine tests or mock setups. 11 | - **Callbacks**: Execute custom logic after a mocked request is handled. 12 | - **Restore**: Cleanly revert any modifications to the global fetch, maintaining test isolation. 13 | 14 | ### Usage 15 | 16 | #### Importing 17 | 18 | ```js 19 | const { mock, record, restoreAll, getRecords } = require('moscaFetch'); 20 | ``` 21 | 22 | #### Mocking Requests 23 | 24 | To mock HTTP requests: 25 | 26 | ```js 27 | mock({ 28 | url: 'https://api.example.com/data', 29 | method: 'POST', 30 | body: '*', 31 | response: { key: 'value' }, 32 | callback: (info) => console.log('Request completed', info), 33 | }); 34 | ``` 35 | 36 | Or use wildcard \* to mock all Request 37 | 38 | ```js 39 | mock({ 40 | url: '*', 41 | method: '*', 42 | response: '*', 43 | callback: (info) => console.log('Request completed', info), 44 | }); 45 | ``` 46 | 47 | Configuration Options 48 | 49 | - `url`: URL to match the request (string or wildcard `*`). 50 | - `method`: HTTP method to match (string or wildcard `*`). 51 | - `expectedBody`: Expected body to match for incoming requests (object or wildcard `*`). 52 | - `response`: Response to return when a request is matched. 53 | - `callback`: Function to execute after a request is handled. 54 | 55 | #### Recording Requests 56 | 57 | To record requests for later analysis or setup: 58 | 59 | ```js 60 | // Setting up recording 61 | record({ 62 | url: '*', 63 | method: '*', 64 | body: '*', // Record any POST request to this URL 65 | }); 66 | 67 | // After your requests 68 | const recordedData = getRecords(); 69 | debugger; 70 | console.log(recordedData); 71 | // Then Copy/Paste the object from the console 72 | ``` 73 | 74 | #### Retrieving Records 75 | 76 | To retrieve and log the recorded requests: 77 | 78 | ```js 79 | const records = getRecords(); 80 | console.log(records); 81 | ``` 82 | 83 | #### Restoring Fetch 84 | 85 | To restore the original fetch after tests: 86 | 87 | ```js 88 | restoreAll(); 89 | ``` 90 | 91 | ### Contributing 92 | 93 | Contributions are welcome! Please read our contributing guidelines to get started. 94 | 95 | ### License 96 | 97 | moscaFetch is MIT licensed. 98 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "noEmit": true, 4 | "strict": true, 5 | "checkJs": false, 6 | "module": "ESNext", 7 | "moduleResolution": "Bundler", 8 | // "allowImportingTsExtensions": true, 9 | "esModuleInterop": true, 10 | "skipLibCheck": true, 11 | "target": "ES2020", 12 | "declaration": true, 13 | "declarationDir": "dist/types", 14 | "outDir": "dist" 15 | }, 16 | "include": ["src/**/*.ts"], 17 | "exclude": ["node_modules", "dist", "**/*.spec.ts", "**/*.test.ts"] 18 | } 19 | --------------------------------------------------------------------------------