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(agents): extend bee start event #224

Merged
merged 3 commits into from
Dec 13, 2024
Merged

Conversation

Tomas2D
Copy link
Contributor

@Tomas2D Tomas2D commented Dec 4, 2024

Extends the Bee 'start' event to allow on-fly modifications.

Usage:

const agent = new BeeAgent(...)

agent.emitter.on("start", async ({ memory, tools, meta }) => {
  console.log(`Iteration: ${meta.iteration}`);
  const lastMessage = memory.messages.at(-1);
  if (lastMessage?.text.includes("weather")) {
    tools.splice(0, Infinity, ...tools.filter((tool) => tool.name.includes("weather")));
  }
});

Ref: #184

Ref: #184
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
@Tomas2D Tomas2D force-pushed the feat/agents-bee-events-extend branch from 2e4bee6 to 2fd82ef Compare December 13, 2024 08:15
@Tomas2D Tomas2D enabled auto-merge (squash) December 13, 2024 08:17
@Tomas2D Tomas2D merged commit 368aa2a into main Dec 13, 2024
4 checks passed
@Tomas2D Tomas2D deleted the feat/agents-bee-events-extend branch December 13, 2024 13:03
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.

2 participants