Stateful and stateless issues.
` async def async_desc_transform(self, context: Context) -> None: """Transform of descriptions of supported tools, agents, and MCP servers in the framework to support function calls of LLM."""
# Stateless tool
try:
self.tools = tool_desc_transform(get_tool_desc(),
tools=self.tool_names if self.tool_names else [],
black_tool_actions=self.black_tool_actions)`
The comment is not correct or accurate.
You may think the Tools are simple function calls without states . But I can give you a conterexample: aworld/tools/mcp_tool/async_mcp_tool.py.
From the codebase, The tools are more like enviroments, which are largely stateful . So here are some inconsistences in desgin.
Actually, the MCP_servers are most probably stateless since the external services won't maintain states for clients or at lesss you can't assume that.
I am not sure if my understanding is correct but hope it helps.
The instances of the local tool are dynamically created at runtime, so they are stateless. This also means that the developed local tool needs to be stateless in its management.
MCPTool is just a proxy and cannot determine its status. The MCP server may indeed have states, such as playwright, but these are maintained separately by the sandbox module and decoupled by session ID, so from my perspective, it can also be considered stateless.
The state of AWorld is managed by Context.
-
my concern mainly comes from :
self._finished = Falsein the code which lets me think it is stateful. -
one more cognitive burden is i have to find out all tool types in AWorld with a help of LLM. Here is grok code fast's output:
Tool types and trade-offs
Function Tools (direct Python calls, via function_tools.py) Latency: very low Best for: validations, computations, data transforms Pros: minimal overhead, simple, auto-generates schemas Cons: runs in-process (no isolation)
MCP Servers (via mcp_servers): Transports: stdio, sse, api, streamable-http Pros: process isolation, multi-language, streaming support Cons: moderate overhead; uses sandbox for execution
Framework Tools (via tool_names): Stateful, implement Gym-like reset/step/close For long-lived sessions (browser, file system contexts, RL) Registered with @ToolFactory.register()
Agent Delegation (via agent_names): Treat other agents as tools for task delegation Agents maintain their own state (memory, etc.)
Because I am still managing to understand AWorld, please correct me if errors there. But if there will be a unified interface , that can make lifer eaiser.
- One more more thing: have you considered to construct a new explict entity for Env? And the tools' owner is Env ? For agent, they just issue actions (Actually Aworld is well following this idea). I know SkyRL takes this design (Seperating Env out) . Of course, maybe a matter of taste sometimes. :)
my concern mainly comes from : self._finished = False in the code which lets me think it is stateful.
Yeah, you are right! At the beginning of the design, I did hope to achieve both tool and environment capabilities, which is why it is divided into two layers (Tool, Action), so I provided the finished attribute. However, the actual complexity makes it necessary to provide Env's capabilities specifically. These capabilities have been mentioned before, so I made the Tool and its Action stateless within the framework. However, it is entirely possible to derive tools with states and resource management based on the current design, which would be very similar to Env, and can be considered as a simplified environment now.
But if there will be a unified interface , that can make lifer eaiser.
This is a great proposal! But there are some differences in the protocols and mechanisms of these, and I will think about them first, or someone interested can help to complete them.
have you considered to construct a new explict entity for Env? And the tools' owner is Env ?
There is a dedicated Env.
Env is currently mainly used for MCP tools, but is expected to serve as the operating environment for all tools.
I will find time to specifically study SkyRL, and believe that other frameworks have similar designs.
Excellence in design follows similar principles, while implementations can vary infinitely.
I am delighted to communicate with you. This industry is developing rapidly and requires continuous discussion, research, and evolution. I hope that, based on AWorld, it can help you and many others.
In my mind( just personally), AWorld may look like this :
- A dedicated and explict enviroment system as SkyRL's , which may or may not own tools .
- Event Driven / Message bus .
- Trajectory managment/ Context managment/Sandbox
- A highly abstract agent definition.
- I can easily implement grdient based policy agent ( may or may not be LLM)
- I aslo can easily implement agents which use evolutionary algorithm as alphaEvovle, MCTC, Baysian optimazation algo as DeepScientist (from West Lake University ?) and other non-RL algorithms. I think the most exciting part is the self-improvment.
- Actually current AWolrd can do all the things above. I would like to wait for a while until the version is stable somehow.
- Hope the 1.0 can be released as soon as possible
Hi~
Thanks for the very insightful suggestions. We will be releasing the easy-to-use capabilities 1, 5 (you mentioned above) in the coming week. 2, 3, and 4 are already stable versions in the API, with the AWorld implemented by default and customizable extensions also available.