-
Notifications
You must be signed in to change notification settings - Fork 8k
Introduce workbench #6340
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
Introduce workbench #6340
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6340 +/- ##
==========================================
+ Coverage 78.32% 78.37% +0.05%
==========================================
Files 217 221 +4
Lines 15684 16010 +326
==========================================
+ Hits 12284 12548 +264
- Misses 3400 3462 +62
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
🎉 I really appreciate the direction of this PR — enabling Workbench for AssistantAgent is something I’ve personally been looking forward to. It’s great to see it taking shape here. Just wanted to share a small concern: in a quick dummy test where I injected McpWorkbench into AssistantAgent and called only start() and close(), I hit this error: Not sure if my test was solid — it’s likely too naive. (Of course, this may totally depend on how Workbench is managed internally. Ha ha 😄) |
|
Here’s a minimal repro (no AssistantAgent involved): def test24():
import asyncio
from autogen_ext.tools.mcp import StdioServerParams, McpWorkBench
async def main() -> None:
server_params = StdioServerParams(
command="npx",
args=["@playwright/mcp@latest", "--headless", "--executable-path", "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"],
)
server_params.read_timeout_seconds = 120
# tools = await mcp_server_tools(server_params)
workbench = McpWorkBench(server_params)
await workbench.start()
print(await workbench.list_tools())
await workbench.stop()
asyncio.run(main())
if __name__ == "__main__":
test24()This hits the same RuntimeError: Attempted to exit cancel scope in a different task than it was entered in, even without involving any agent or nested structure. If this is just a matter of the lifecycle not being fully wired up yet, feel free to disregard — I might’ve been a bit too eager since I’ve been really looking forward to this one 😄 |
|
Thanks @SongChiYoung . AI generated the implementation of |
|
@ekzhu Even though it was a 1-on-1 execution model, I deliberately used a queue to avoid message loss or race conditions during async transitions. If helpful, you’re welcome to reuse that actor pattern here — or I’d be happy to adapt it into this PR’s context. That said, I don’t believe I currently have access to push commits to this PR. |
|
Can you create a separate PR from your forked repo targeting this branch |
Cool I will do that soon. |
|
@lspinheiro could you take a look and see if this can be used as a base abstraction for canvas memory? |
I'm trying to better understand the proposal. The canvas is design as a simple form of version control over data generated by the LLM. Right now, primarily text, either code or documents. I think we can easily make the workbench read and write from the canvas if we want to tools to change the state of existing data through patching, but I'm not sure it would fit in as a base abstraction and replace an existing component, is that what you meant? |
I am thinking of the following:
So, what I meant is that we can have canvas subclass |
|
I just saw the discussion about integrating Canvas with Workbench in my inbox. 😊 @lspinheiro, I also agree with @ekzhu’s idea. The concept of Workbench supporting serialization and lifecycle management makes a lot of sense, and as ekzhu mentioned, having multiple agents share the same Canvas also sounds reasonable. I tested it — Canvas works well with agents, even across multiple calls (with memory). However, it’s not serializable yet. Since Canvas is still marked as experimental, I think it might make sense to continue using it as a lightweight tool for agent use cases for now. We could then handle the Workbench integration in a separate Issue, after we see how Workbench will actually work with Agents. At the moment, it’s still unclear how Workbench is intended to interact with Agents, so @lspinheiro might find it difficult to know exactly how to proceed with integrating Canvas into Workbench. BTW, I fully support @ekzhu’s direction. If expanding this PR won’t make future maintenance harder (and I understand ekzhu will be managing this), I’m totally fine with continuing the discussion here. If it’s helpful, I’m happy to stay involved in this discussion — feel free to reach out! |
## Why are these changes needed? - Add return_value_as_string for formating result from MCP tool ## Related issue number - Opened Issue on #6368 ## Checks - [x] I've included any doc changes needed for <https://microsoft.github.io/autogen/>. See <https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to build and test documentation locally. - [x] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [x] I've made sure all auto checks have passed. --------- Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
lspinheiro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be missing api reference but otherwise looks fine. Only major coment would be on tool output types. It felt a bit limited.
I think I got the idea, but currently I'm using the canvas more as a space to share objects between agents so it being serialized with an agent was something that I didnt think about. But the canvas memory holds a reference to the canvas, if we make it a component config I think it would be serialised as part of the agent. Wouldnt that solve the problem? Going through the PR the workbench concept seemed much closer to tools while the canvas is closer to memory. The tools in the canvas are there primarily because we dont have a clear abstraction to updating memories. I can have look to see if we can combine the concepts but I'm not 100% sure they fit together. |
You’re right - that’s the key issue what I raised:
And @ekzhu mentioned Workbench as a tool for sharing across agents - I think this gives us a direction. example, workbench = McpWorkbench( ...)It looks simple, but internally something like: class McpWorkbench(...):
def __new__(cls, id:str|None=None, ...):
if id is None:
id = uuid.....
workbench = WorkbenchManager.get_workbench(id)
if workbench is None:
# build workbench
WorkbenchManager.set_workbench(id, workbench)
return workbench
def _to_config(self,):
return McpWorkbenchConfig(
id = self._id,
....
)
@classmethod
def _from_config(cls, config: McpWorkbenchConfig):
cls(config.id, ...)Using this approach, agents could share Workbench instances naturally, and serialization/deserialization would follow a consistent global reference pattern. This pattern would also simplify @lspinheiro’s effort to integrate Canvas with Workbench, The global manager pattern is safely scoped using UUIDs. |
|
Thanks @lspinheiro for the feedback. We can improve those in the future. |
…e0424 * upstream/main: Remove `name` field from OpenAI Assistant Message (microsoft#6388) Introduce workbench (microsoft#6340) TEST/change gpt4, gpt4o serise to gpt4.1nano (microsoft#6375) update website version (microsoft#6364) Add self-debugging loop to `CodeExecutionAgent` (microsoft#6306) Fix: deserialize model_context in AssistantAgent and SocietyOfMindAgent and CodeExecutorAgent (microsoft#6337) Add azure ai agent (microsoft#6191) Avoid re-registering a message type already registered (microsoft#6354) Added support for exposing GPUs to docker code executor (microsoft#6339) fix: ollama fails when tools use optional args (microsoft#6343) Add an example using autogen-core and FastAPI to create streaming responses (microsoft#6335) FEAT: SelectorGroupChat could using stream inner select_prompt (microsoft#6286) Add experimental notice to canvas (microsoft#6349) DOC: add extentions - autogen-oaiapi and autogen-contextplus (microsoft#6338) fix: ensure serialized messages are passed to LLMStreamStartEvent (microsoft#6344) Generalize Continuous SystemMessage merging via model_info[“multiple_system_messages”] instead of `startswith("gemini-")` (microsoft#6345) Agentchat canvas (microsoft#6215) Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
This PR introduces
WorkBench.A workbench provides a group of tools that share the same resource and state. For example,
McpWorkbenchprovides the underlying tools on the MCP server. A workbench allows tools to be managed together and abstract away the lifecycle of individual tools under a single entity. This makes it possible to create agents with stateful tools from serializable configuration (component configs), and it also supports dynamic tools: tools change after each execution.Here is how a workbench may be used with AssistantAgent (not included in this PR):
TODOs:
AssistantAgentto use workbench as an alternative in thetoolsparameter. UseStaticWorkbenchto manage individual tools.