kaiban-ai / KaibanJS

KaibanJS is a JavaScript-native framework for building and managing multi-agent systems with a Kanban-inspired approach.
https://www.kaibanjs.com/
MIT License
453 stars 24 forks source link

How to add contextual information to the Agent #100

Closed zhaopengme closed 3 days ago

zhaopengme commented 4 days ago

I would like to add some additional information to the Agent, such as user profiles, but I couldn't find any relevant instructions in the documentation

darielnoel commented 4 days ago

What do you mean by user profiles?

zhaopengme commented 4 days ago

For example, if I need to handle the task "Help me handle today's tasks," I would need some personal information from me, such as the nature of the work and working hours.

darielnoel commented 4 days ago

Thanks for the clarification... Would something like this work?

Here an example on the playground.

https://www.kaibanjs.com/share/MJuoYQ1DPDTOwZNgc3Qn


import { Agent, Task, Team } from 'kaibanjs';

// Step 3: Define the Task Manager Agent
const taskManager = new Agent({
    name: 'TaskManager', 
    role: 'Daily Task Manager', 
    goal: 'Prioritize today’s tasks based on urgency and importance.', 
    background: 'Organized and efficient with task management',
    tools: []  // Add tools if needed
});

// Step 4: Define a Single Task for the Agent
const taskReview = new Task({ 
    description: 'Review and prioritize today’s tasks based on urgency and importance. Here is the list: {tasks}',
    expectedOutput: 'A prioritized list of tasks to be completed today.', 
    agent: taskManager
});

// Step 5: Initialize the Team with Today's Task List
const team = new Team({
  name: 'Daily Task Management Team',
  agents: [taskManager],
  tasks: [taskReview],
  inputs: {
    tasks: [
      "Respond to emails",
      "Finish writing project report",
      "Attend team meeting at 3 PM",
      "Review pull requests on GitHub",
      "Plan tasks for tomorrow"
    ]
  },
  env: { OPENAI_API_KEY: 'ENV_OPENAI_API_KEY' }  // Replace with your actual API key if needed
});

team.start();
zhaopengme commented 3 days ago

Alright, I get it, thank you very much