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 agent workflows - Step 1 #202

Closed
wants to merge 14 commits into from

Conversation

matiasmolinas
Copy link
Contributor

Which issue(s) does this pull-request address?

Issue #121

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 - Step 1

Description

1. Implementation of HumanTool

  • Location: /src/tools/human.ts
  • A new tool, HumanTool, allows human intervention by:
    • Displaying a natural language (NL) message generated by the Bee to the user.
    • Accepting the user’s NL response as input.
    • Returning the response as output to the Bee.

2. Helper for Console Interaction

  • Location: /src/helpers/io.ts
  • Introduced a shared console reader (sharedConsoleReader) to handle user prompts and display messages cleanly.

3. Example Agent

  • Location: /examples/agents/experimental/humantool_agent.ts
  • Demonstrates how to equip a Bee with the HumanTool and use it in a workflow:
    • Added support for toggling the HumanTool with an environment variable (USE_HUMAN_TOOL).
    • Configured templates and tools for the Bee, including conditional integration of the HumanTool.

Testing

  • Verified that yarn lint runs without errors or warnings.
  • Fixed existing linting issues in the affected files.

Notes

  1. The failing unit tests are unrelated to this change and were verified to exist on the main branch.
  2. The HumanTool is designed for natural language interaction and can be further extended in subsequent steps.

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 19:16
@matiasmolinas
Copy link
Contributor Author

I am cleaning up the branch and addressing an issue in the implementation. I will open a new PR with a clean and updated branch once the fixes are complete. Thank you for your patience!

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
1 participant