i-am-bee / bee-agent-framework

The framework for building scalable agentic applications.
https://i-am-bee.github.io/bee-agent-framework/
Apache License 2.0
91 stars 22 forks source link

Custom agent interaction #70

Open michael-desmond opened 1 week ago

michael-desmond commented 1 week ago

Is your feature request related to a problem? Please describe. At the moment it is not straight forward to customize:

  1. The format of the reAct loop (the line constructs that the agent is guided to produce)
  2. The agents interaction with the environment (outside of tool framework)
  3. The contents of the agents message history.

Working with a smaller model, I developed a bee-agent that uses a simpler react loop (thought/action/final answer), and wrote some code that processes simple agent actions and executes some code (reading/writing to memory in this case). I also customized the agents history. In response to an action, a new message containing the result of the action is introduced to the agents history, and these message remain in agent memory (outside of the reAct iterations). I also introduced a set of custom message types.

Describe the solution you'd like I would like to be able to easily customize the reAct loop (CD + LineParser) and attach arbitrary code to certain parsed constructs (ie. actions). This does overlap significantly with tool calling, but may be useful to allow users to experiment with alternate paradigms. I would also like to have greater control of the agents message history, for instance I want to put the output of a tool (or action) into a new message rather than inserting it into the working reAct message, I also want to customize the system prompt into a set of messages, rather than one monolithic message.

Describe alternatives you've considered I was able to implement the above using the framework but my code was spread across various files and the abstractions were not intuitive. I subclassed BeeAgent and overrode the _run method, I also implemented a custom BeeAgentRunner.

Additional context FW version 0.0.20

Tomas2D commented 5 days ago

I see your point, but making Bee Agent completely customizable does not make sense because if you do so, it will no longer be the Bee Agent - every abstraction comes with a cost.

That's why the framework provides you with modules like Memory, Caching, Tools, Parsers, and LLM Drivers so you can easily build your own agent from scratch. Currently, we have one example that showcases that—it's just one file, and it's up to everyone to design their own agents.

But let me think about it.