Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Cannot read properties of null (reading 'digest') while running in Node.js #161

Open
darielnoel opened this issue Nov 26, 2024 · 1 comment
Labels
bug Something isn't working core Fundamental operations and essential features of AgenticJS library Issues and enhancements directly related to the codebase of the library component of the project. pending-validation

Comments

@darielnoel
Copy link
Contributor

darielnoel commented Nov 26, 2024

Describe the Bug

When following the documentation example Node.js + AI Agents, the example fails to work starting from KaibanJS version 0.4.0. The error Cannot read properties of null (reading 'digest') is thrown.

Attached is the error screenshot for reference.

image

KaibanJS Team Config

Here is the link to the playground showcasing the issue: Example Playground

Steps to Reproduce

  1. Clone the repository or create a new Node.js project.
  2. Follow the tutorial steps as outlined in the documentation.
  3. Use KaibanJS version > 0.4.0.
  4. Run the example project in Node.js.
  5. Observe the error mentioned above.

Current vs. Expected Behavior

  • Current behavior: The application throws the error Cannot read properties of null (reading 'digest') and fails to proceed.
  • Expected behavior: The example should run successfully as documented.

Environment

  • Framework/Library: [Node.js]
  • KaibanJS Version: [>0.4.0]
  • JavaScript Runtime: [e.g., Node.js v18.20.0]
@darielnoel darielnoel added bug Something isn't working critical Issues or PRs that must be addressed immediately to resolve a severe impact on the project. library Issues and enhancements directly related to the codebase of the library component of the project. core Fundamental operations and essential features of AgenticJS labels Nov 26, 2024
@darielnoel
Copy link
Contributor Author

I tested this example locally using Node.js v18.20.4, and it worked fine on my setup. I'll leave this open for further testing to ensure it isn't related to specific configurations or environments. Please share any additional findings!

Here my blogTeam.js

require('dotenv').config();
const { Agent, Task, Team } = require('kaibanjs');
const { TavilySearchResults } = require('@langchain/community/tools/tavily_search');

// Define the search tool used by the Research Agent
const searchTool = new TavilySearchResults({
  maxResults: 5,
  apiKey: process.env.TAVILY_API_KEY
});

// Define the Research Agent
const researchAgent = new Agent({
  name: 'Ava',
  role: 'News Researcher',
  goal: 'Find and summarize the latest news on a given topic',
  background: 'Experienced in data analysis and information gathering',
  tools: [searchTool]
});

// Define the Writer Agent
const writerAgent = new Agent({
  name: 'Kai',
  role: 'Content Creator',
  goal: 'Create engaging blog posts based on provided information',
  background: 'Skilled in writing and content creation',
  tools: []
});

// Define Tasks
const researchTask = new Task({
  title: 'Latest news research',
  description: 'Research the latest news on the topic: {topic}',
  expectedOutput: 'A summary of the latest news and key points on the given topic',
  agent: researchAgent
});

const writingTask = new Task({
  title: 'Blog post writing',
  description: 'Write a blog post about {topic} based on the provided research',
  expectedOutput: 'An engaging blog post summarizing the latest news on the topic in Markdown format',
  agent: writerAgent
});

// Create the Team
const blogTeam = new Team({
  name: 'AI News Blogging Team',
  agents: [researchAgent, writerAgent],
  tasks: [researchTask, writingTask],
  env: { OPENAI_API_KEY: process.env.OPENAI_API_KEY }
});

module.exports = { blogTeam };

@darielnoel darielnoel added pending-validation and removed critical Issues or PRs that must be addressed immediately to resolve a severe impact on the project. labels Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core Fundamental operations and essential features of AgenticJS library Issues and enhancements directly related to the codebase of the library component of the project. pending-validation
Projects
None yet
Development

No branches or pull requests

1 participant