modelscope / agentscope

Start building LLM-empowered multi-agent applications in an easier way.

Home Page:https://modelscope.github.io/agentscope/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature]: Hope for customizable ReAct module

LAD021 opened this issue · comments

A customizable ReAct or other agent module may simplify the code we deal with each request.
I want to use third party module, but LangChain's agent is not customizable, and MetaGPT is too heavy to be a third party module (but it's design is suitable).
Maybe you can consider about this.

Thanks for your suggestion! Can you provide an example?

AgentScope is a highly flexible platform. You can customize your own agent by implementing reply function with any third party modules. All you need to do is to return a agentscope.message.Msg object in the end of reply function.
If needed, the memory (dialogue history) management, prompt engineering, CoT, tools usages can all be customized by developers.

from agentscope.agents import AgentBase

class MyAgent(AgentBase):
    def reply(x):
        # [BEGIN] Do sth here. 
	# calling third party modules
        # ...
	# [END]  

        # Wrap information into a `Msg` object
        msg = Msg(self.name, "{Your message content}")
        return msg

Besides, in AgentScope the customized agent can be converted to distributed mode by simply calling its to_dist function. Please refer to our Tutorial for more information.

Thank you for your reply.
I think the reply function really should be flexible, and this framework is friendly for third party modules. But how an agent deal with problems is an important part for an agent framework.
I'm seeking for a programming module to deal with it. I wonder that do you have some plan about this?
Here are some of my opinions of current frameworks.

Most of the ReAct modules are not flexible enough

Considering ReAct, it's useful and many agents will integrate this method. But nowadays third party modules failed to provide costomized ReAct module as a plugin for others. Like LangChain and AutoGen, they tend to provide a reproduction of the article, and like LangChain ReAct Agent, we can only infuence it by providing tools.
By the way, LangChain itself (and LCEL, langgraph) provides a too low level of abstraction that they seems to only be a syntactic sugar and tool lib.
MetaGPT is good, they allow you to rewrite think and act method. But sometimes I just copied their code and change one or two lines, they are still not modular enough. And their framework is too heavy to serve as a plugin.

Why we need a flexible ReAct module

I think the picture of Agent Programming is to merge Human SOP and AI desicions. You can use structurized LLM outputs to indicate problem solving situation, and then add CoT, costumize tools AI can choose, costumize history strategy, and at least, unify log model and memory model. In fact, a nested ReAct agent call may work(Tool Provided to Agent content's an Agent too), but it's too weird.

Conclusion

Above is my opinion of current Agent Programming frameworks. I really think it's the most important part of developing an agent. As you said, it may be a plugin, but I really hope you can consider it within you future plan. And thank you for your work, I think your framework about multiagent collaboration is the best one until now.

Thanks! That's a really good idea. We will try to implement a ReAct Agent first, and then abstract it into different components/modules.

Any ideas and contribution are welcome!

@LAD021 , thanks for your suggestions again! The progress so far is as follows.

To be merged

  1. Act-only agent and its example will be added in #99
  2. ReAct agent and its example will be added in this PR #104

TODO

  • decouple into reasoning modules (under consideration)

Any ideas or suggestions are welcome in this PRs.