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

feat(tools): add HumanTool for human intervention during workflows #203

Closed
wants to merge 49 commits into from

Conversation

matiasmolinas
Copy link

Human intervention abstraction - Step 1

Description:
Step 1: Define the 'HumanTool' as a tool which can be equipped to any Bee and be invoked by it when it deems there is some missing information required for the following steps and hence must call out to the user to collect it. So I agree with you on the following:

Tool Name: 'HumanTool'
Tool Input: For a Bee to use this tool, it should generate a NL message asking the user for some specific information.
Tool Output: NL response from the end user
BeeAgentRunner 'HumanTool' Execution: The Runner should then execute the HumanTool by sending the NL message to the end user and wait for a response. Once the user has responded, the tool output (message from the user) is appended to the Agent memory and the loop for Action and ActionInput can continue

Closes: #121

Description

This Pull Request introduces the HumanTool to the Bee Agent Framework as part of Step 1 of the issue: Human intervention abstraction - enhancement. The tool enables Bees to interact with users during workflows to gather additional information.

Changes

  1. Added HumanTool (src/tools/human.ts):

    • Implements a tool to handle user input during workflows.
    • Provides natural language (NL) input and output support.
  2. Extended Bee Prompts (src/agents/bee/prompts.ts):

    • Includes prompts for the HumanTool to integrate seamlessly with Bees.
  3. Added Helper for Console Interaction (src/helpers/io.ts):

    • Provides shared console reading functionality for tools like HumanTool.
  4. Created an Experimental Agent (examples/agents/experimental/humantool_agent.ts):

    • Demonstrates the usage of HumanTool in a real-world workflow scenario.

Checklist

  • I have read the contributor guide
  • Linting passes: yarn lint or yarn lint:fix
  • Formatting is applied: yarn format or yarn format:fix
  • Unit tests pass: yarn test:unit
  • E2E tests pass: yarn test:e2e
  • Tests are included
  • Documentation is changed or added
  • Commit messages and PR title follow conventional commits

@matiasmolinas matiasmolinas requested a review from a team as a code owner November 29, 2024 21:41
@matiasmolinas
Copy link
Author

Fixing code formatting issues for consistency and readability

matiasmolinas and others added 25 commits December 7, 2024 05:30
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Jan Pokorný <jenompokorny@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
…iles

Ref: i-am-bee#121
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Emitter now must be defined manually for all new tools.

Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Ref: i-am-bee#121
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Ref: i-am-bee#121
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Ref: i-am-bee#121
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
…ty object

The "options" parameter in Tool's run method now fallbacks to an empty object to allow overrides.

Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
The "options" parameter in stream/run method now fallbacks to an empty object to allow overrides.

Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Graham White <gwhite@uk.ibm.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: MICHAEL DESMOND <mdesmond@us.ibm.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: MICHAEL DESMOND <mdesmond@us.ibm.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Tomas2D and others added 17 commits December 7, 2024 05:30
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: MICHAEL DESMOND <mdesmond@us.ibm.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Matous Havlena <havlenma@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
…orking example

Ref: i-am-bee#121
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
… and optimize testing

Refactored \humantool_agent.ts\ based on PR feedback:
- Retained the original system prompt to prevent unnecessary changes.
- Adjusted testing to use LLaMA instead of GPT-4 as per optimization requirements.
- Addressed issues where the model occasionally skipped tool calling.

Ref: i-am-bee#121

Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Removed the extended prompt for the human tool, enhanced the tool description, and updated the example to use the default system prompt.

Ref: i-am-bee#121
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Ref: i-am-bee#219

Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
Signed-off-by: Matias Molinas <matias.molinas@gmail.com>
@matiasmolinas
Copy link
Author

There is a complex merge and an issue in one commit message that is difficult to fix. I will take the latest files, create a new branch called fresh-human-tool-new, and open a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Human intervention abstraction
8 participants