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 user interaction during agent workflows #255

Merged
merged 21 commits into from
Jan 7, 2025

Conversation

matiasmolinas
Copy link
Contributor

Added human.ts to experimental tools and human.ts to agents. Updated io.ts in helpers to support the new tool. This PR solves step one of issue #121, which defines the HumanTool as a tool that can be invoked by a Bee agent when additional user input is required during its workflow.

This replaces a previous PR that I closed after incorporating the suggested changes. The previous PR had a complex merge conflict, and instead of resolving it, I decided to create a fresh branch and open this new PR for a cleaner submission.

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

Closes: #121

Description

This PR introduces the following changes to implement the first step of the HumanTool feature:

Tool Definition (human.ts in experimental/tools):

Implements the HumanTool as a tool equipped to Bee agents.
Allows agents to generate natural language (NL) messages to request specific information from the user.
Captures the user's NL response as tool output, appends it to the agent's memory, and resumes the workflow.
Agent Integration (human.ts in agents):

Integrates the HumanTool into the Bee agent workflow, enabling it to pause, call for human input, and continue based on the provided data.
Helper Update (io.ts):

Updated input/output handling in helpers/io.ts to support the HumanTool integration.

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

Added human.ts to experimental tools and human.ts to agents. Updated io.ts in helpers to support the new tool.
Ref: i-am-bee#121

Signed-off-by: Matias Molinas <[email protected]>
@matiasmolinas matiasmolinas requested a review from a team as a code owner December 13, 2024 23:39
Copy link
Contributor

@Tomas2D Tomas2D left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank @matiasmolinas, for the significant effort that you put in 💪🏻 .
I appreciate it, however it would need architecture changes.

examples/agents/experimental/human.ts Outdated Show resolved Hide resolved
examples/helpers/io.ts Outdated Show resolved Hide resolved
examples/helpers/io.ts Outdated Show resolved Hide resolved
examples/helpers/io.ts Outdated Show resolved Hide resolved
examples/helpers/io.ts Outdated Show resolved Hide resolved
examples/tools/experimental/human.ts Outdated Show resolved Hide resolved
examples/tools/experimental/human.ts Outdated Show resolved Hide resolved
examples/tools/experimental/human.ts Outdated Show resolved Hide resolved
examples/tools/experimental/human.ts Outdated Show resolved Hide resolved
examples/tools/experimental/human.ts Outdated Show resolved Hide resolved
@matiasmolinas
Copy link
Contributor Author

Thank @matiasmolinas, for the significant effort that you put in 💪🏻 . I appreciate it, however it would need architecture changes.

Thanks, @Tomas2D, for your amazing review. I am working on all your suggestions to improve the proposal. I will let you know when it is ready.

…t in human.ts is not required for the current functionality. Removing it helps simplify the code and reduce unnecessary complexity. Ref: i-am-bee#121

Signed-off-by: Matias Molinas <[email protected]>
This commit removes all comments from the \prompt\ method in \examples/helpers/io.ts\ as requested in the PR review. The comments were deemed unnecessary and have been removed to improve code clarity and maintainability.

Ref: i-am-bee#121
Signed-off-by: Matias Molinas <[email protected]>
Reverted the previous modification. The original approach is reinstated to prevent breaking other examples, as highlighted in the PR review.

Ref: i-am-bee#121
Signed-off-by: Matias Molinas <[email protected]>
These changes improve the tool's ability to handle interruptions and follow the framework's standard implementation pattern.

Ref: i-am-bee#121
Signed-off-by: Matias Molinas <[email protected]>
…ction

These changes improve the modularity and usability of HumanTool by adhering to framework best practices.

Ref: i-am-bee#121
Signed-off-by: Matias Molinas <[email protected]>
@matiasmolinas
Copy link
Contributor Author

Thank @matiasmolinas, for the significant effort that you put in 💪🏻 . I appreciate it, however it would need architecture changes.

Hi @Tomas2D, I believe I’ve addressed all the requested changes. Please let me know if there’s anything else that needs adjustment. I really appreciate your time and effort—thank you!

examples/helpers/io.ts Outdated Show resolved Hide resolved
@matiasmolinas matiasmolinas requested a review from Tomas2D January 6, 2025 17:05
@Tomas2D
Copy link
Contributor

Tomas2D commented Jan 7, 2025

@matiasmolinas could you please fix the formatting so I can then merge it? Thank you

@matiasmolinas
Copy link
Contributor Author

@matiasmolinas could you please fix the formatting so I can then merge it? Thank you

Hi @Tomas2D, I’ve fixed the formatting as requested. Please let me know if there’s anything else needed. Thanks!

@Tomas2D Tomas2D enabled auto-merge (squash) January 7, 2025 14:01
@Tomas2D Tomas2D disabled auto-merge January 7, 2025 14:01
@Tomas2D Tomas2D merged commit a4cca54 into i-am-bee:main Jan 7, 2025
1 of 2 checks passed
@Tomas2D
Copy link
Contributor

Tomas2D commented Jan 7, 2025

Great work. Thank you for the contribution 🙏🏻

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
2 participants