-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Toolsets live again! Phoenix of #110
Rough working:
from abc import abstractmethod, ABC
from contextlib import asynccontextmanager
mcp_thing = MCPThing()
agent = Agent(
mcp_servers=[mcp_thing],
)
# ---
#
class Toolset(ABC):
async def __aenter__(self, run_context, sampling_callback, agent_name: str):
pass
async def __aexit__(self, exc_type, exc_val, exc_tb):
pass
@abstractmethod
async def list_tools(self):
return []
async def call_tools(self, tools) -> list[Part]:
...
agent = Agent(
toolset=mcp_thing,
)
agent = Agent(
toolset=[
FilterToolsToolset(MCPToolset(mcp_thing1), exclude='foo'),
MCPToolset(mcp_thing2),
],
)
@agent.tool
def foo():
pass
agent.run_sync()
async def main():
async with agent.run_toolsets():sirianni and bodenburg
Metadata
Metadata
Assignees
Labels
No labels