autobyteus 1.0.5__py3-none-any.whl → 1.0.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: autobyteus
3
- Version: 1.0.5
3
+ Version: 1.0.6
4
4
  Summary: Multi-Agent framework
5
5
  Home-page: https://github.com/AutoByteus/autobyteus
6
6
  Author: Ryan Zheng
@@ -28,7 +28,7 @@ Requires-Dist: Jinja2
28
28
  Requires-Dist: ollama==0.4.5
29
29
  Requires-Dist: mistral_common
30
30
  Requires-Dist: aiohttp
31
- Requires-Dist: autobyteus-llm-client==1.0.9
31
+ Requires-Dist: autobyteus-llm-client==1.1.0
32
32
  Requires-Dist: brui-core==1.0.8
33
33
  Provides-Extra: dev
34
34
  Requires-Dist: coverage; extra == "dev"
@@ -5,11 +5,9 @@ autobyteus/agent/agent.py,sha256=T8ccpNz4j89oBnxdMkDhEZaBkI7yFNX_DZRbNyUCarE,102
5
5
  autobyteus/agent/async_agent.py,sha256=rltz-Q2vT85RRIVO5Fcz15colqtc0jhZEUzxQHxMIB0,6664
6
6
  autobyteus/agent/async_group_aware_agent.py,sha256=eySdlxy4qMXeGClpXZ9zFTPI19ZZeWQDAdNCxcScl-w,6274
7
7
  autobyteus/agent/exceptions.py,sha256=tfXvey5SkT70X6kcu29o8YO91KB0hI9_uLrba91_G2s,237
8
- autobyteus/agent/remote_agent.py,sha256=v6oOViXxOVtEleRkfBhZlrOiqfKfUE_iEIIYV763t2M,300
9
8
  autobyteus/agent/status.py,sha256=xvsGydjiPls7FjdEDhSBrqt9otgkPEyRVyVOlmdALq4,240
10
9
  autobyteus/agent/tool_invocation.py,sha256=HVNUmQcQCNKw4HaCIcB2HWYVVFk7hYA-8QHVkleBHR8,225
11
10
  autobyteus/agent/factory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- autobyteus/agent/factory/agent_factory.py,sha256=KQBXzTgR6E5rXpeKu556RuvM4oGZe9JEh0lIXJM76zQ,4009
13
11
  autobyteus/agent/group/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
12
  autobyteus/agent/group/async_group_aware_agent.py,sha256=tg_r1qehTg9Z7TJ1ZWwy413K_ZhwPRhIAs4GnJJjDX0,5658
15
13
  autobyteus/agent/group/coordinator_agent.py,sha256=F3fTE3c_aL5YtU-UdHzBOqUeBoOLdkYNR-IO-OKTsbk,1397
@@ -22,9 +20,6 @@ autobyteus/agent/orchestrator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
22
20
  autobyteus/agent/orchestrator/base_agent_orchestrator.py,sha256=nwQeBNwWjttq_zRnQPd7hbCwOOuf9pb2QxYpMZRjhi8,2998
23
21
  autobyteus/agent/orchestrator/multi_replica_agent_orchestrator.py,sha256=AtWpX2n5ZcTkyrV89JwYlixQ4YpKoiydERY_QGOf90s,3269
24
22
  autobyteus/agent/orchestrator/single_replica_agent_orchestrator.py,sha256=0IN3trXvMvCvhALI4cTPZwhaBZavJVQ-Dmi5p4Bc920,1932
25
- autobyteus/agent/registry/__init__.py,sha256=4isjV2jNONeZaWoNHL_5bVJ0dZ3pzPJCww_vzQQwLgI,341
26
- autobyteus/agent/registry/agent_definition.py,sha256=nqBgcX7OMovS7dUIqmbLCSSO4WEFt2HzbTAYIEuweO8,4014
27
- autobyteus/agent/registry/agent_registry.py,sha256=vAfVuEKWY0r9tPeConwmBekuz6MTvpHfO-LUN8a8M44,4141
28
23
  autobyteus/agent/response_parser/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
24
  autobyteus/agent/response_parser/tool_usage_command_parser.py,sha256=T4grKoDzrZQHJIN9bL6jgYjFS9jWDWwvntolV1xfgxM,4020
30
25
  autobyteus/conversation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -91,7 +86,6 @@ autobyteus/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
91
86
  autobyteus/tools/ask_user_input.py,sha256=XiyHwsGpnLj8PexHQEmr0Rc9pCPzfaluo2-q0Ctfq58,2681
92
87
  autobyteus/tools/base_tool.py,sha256=5qv-ILTdDN4lgVlC52wdfl7pFypq3iI4P32q1sxOc7w,2703
93
88
  autobyteus/tools/image_downloader.py,sha256=DAFXY_lwXe2cDrNrUC2cU4J43TcP7cmC-sF_ORFj6WQ,4818
94
- autobyteus/tools/mcp_remote_tool.py,sha256=tcGHIfP2Tb0868CCl1Nuz-rckY930kUMKa8H1dFb4cg,3658
95
89
  autobyteus/tools/pdf_downloader.py,sha256=oIuEqoIHCpR0xZbA_9n8-Grc6f_V_8Pre4ucKcleTCw,3317
96
90
  autobyteus/tools/timer.py,sha256=2z_R1aaHxf3sE_bIgND_VTbGmk3-caIfkCBMUToNKZU,4381
97
91
  autobyteus/tools/tool_meta.py,sha256=AyvX5v9YKvyze1YpnA011VDVAktwt5DXVy59pFbC8Qk,2425
@@ -156,8 +150,8 @@ autobyteus/workflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
156
150
  autobyteus/workflow/simple_task.py,sha256=CcEEfamaZk1pjkPG9TVmlvzMAeTznHvQncRIwgp48tI,3378
157
151
  autobyteus/workflow/task.py,sha256=CYyPs8YvEwpWXcF4swJukPNuv6RRs3X-9UOnN6vG2Ko,5746
158
152
  autobyteus/workflow/workflow.py,sha256=3PXZVtgnajGUAbZR22xht_2pU2WjYNmA1j0f5TkM3G0,1453
159
- autobyteus-1.0.5.dist-info/licenses/LICENSE,sha256=Ompok_c8HRsXRwmax-pGR9OZRRxZC9RPp4JB6eTJd0M,1360
160
- autobyteus-1.0.5.dist-info/METADATA,sha256=ZJkFqUzP61Q_RAxllsqksTKy-HRMK0gyJQlEis4WXaI,4399
161
- autobyteus-1.0.5.dist-info/WHEEL,sha256=ooBFpIzZCPdw3uqIQsOo4qqbA4ZRPxHnOH7peeONza0,91
162
- autobyteus-1.0.5.dist-info/top_level.txt,sha256=OeVeFlKcnysp6uMGe8TDaoFeuh4NUK4wZIfNjXCWKTE,11
163
- autobyteus-1.0.5.dist-info/RECORD,,
153
+ autobyteus-1.0.6.dist-info/licenses/LICENSE,sha256=Ompok_c8HRsXRwmax-pGR9OZRRxZC9RPp4JB6eTJd0M,1360
154
+ autobyteus-1.0.6.dist-info/METADATA,sha256=jgzw1VJB9NjTVmyImefRq5i0sIMkN-x-_1EJUaJKrTc,4399
155
+ autobyteus-1.0.6.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
156
+ autobyteus-1.0.6.dist-info/top_level.txt,sha256=OeVeFlKcnysp6uMGe8TDaoFeuh4NUK4wZIfNjXCWKTE,11
157
+ autobyteus-1.0.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.0.1)
2
+ Generator: setuptools (80.4.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,94 +0,0 @@
1
- # file: autobyteus/agent/factory/agent_factory.py
2
- import logging
3
- from autobyteus.agent.agent import Agent
4
- from autobyteus.agent.group.group_aware_agent import GroupAwareAgent
5
- from autobyteus.llm.llm_factory import LLMFactory
6
- from autobyteus.tools.factory.tool_factory import ToolFactory
7
- from autobyteus.prompt.prompt_builder import PromptBuilder
8
- from autobyteus.llm.models import LLMModel
9
- from typing import List, Union
10
-
11
- logger = logging.getLogger(__name__)
12
-
13
- class AgentFactory:
14
- """
15
- Factory class for creating different types of agents.
16
-
17
- This factory simplifies the creation of Agent instances by encapsulating
18
- the necessary dependencies and configurations.
19
- """
20
- def __init__(self,
21
- role: str,
22
- agent_type: str,
23
- tool_factory: ToolFactory,
24
- llm_factory: LLMFactory,
25
- prompt_builder: PromptBuilder, # Agent requires prompt_builder or initial_user_message
26
- llm_model: LLMModel,
27
- tool_names: List[str]):
28
- """
29
- Initializes the AgentFactory.
30
-
31
- Args:
32
- role: The role the created agents will fulfill.
33
- agent_type: The type of agent to create ("standalone" or "group_aware").
34
- tool_factory: A factory to create tool instances.
35
- llm_factory: A factory to create LLM instances.
36
- prompt_builder: The PromptBuilder instance to configure the agent's system prompt.
37
- llm_model: The specific LLM model configuration to use.
38
- tool_names: A list of tool names the agent should be equipped with.
39
- """
40
- self.role = role
41
- self.agent_type = agent_type
42
- self.tool_factory = tool_factory
43
- self.llm_factory = llm_factory
44
- self.prompt_builder = prompt_builder
45
- self.llm_model = llm_model
46
- self.tool_names = tool_names
47
- logger.info(f"AgentFactory initialized for role '{role}' and type '{agent_type}'")
48
-
49
- def create_agent(self, agent_id: str) -> Union[Agent, GroupAwareAgent]:
50
- """
51
- Creates an agent instance based on the factory's configuration.
52
-
53
- Args:
54
- agent_id: The unique identifier for the agent being created.
55
-
56
- Returns:
57
- An instance of Agent or GroupAwareAgent.
58
-
59
- Raises:
60
- ValueError: If the configured agent_type is unsupported.
61
- """
62
- logger.info(f"Creating agent with id '{agent_id}' for role '{self.role}' and type '{self.agent_type}'")
63
- try:
64
- tools = [self.tool_factory.create_tool(name) for name in self.tool_names]
65
- logger.debug(f"Tools created for agent '{agent_id}': {[tool.get_name() for tool in tools]}")
66
- except Exception as e:
67
- logger.error(f"Error creating tools for agent '{agent_id}': {e}")
68
- raise ValueError(f"Failed to create tools for agent {agent_id}: {e}") from e
69
-
70
- try:
71
- llm = self.llm_factory.create_llm(self.llm_model)
72
- logger.debug(f"LLM instance created for agent '{agent_id}' using model '{self.llm_model.model_name}'")
73
- except Exception as e:
74
- logger.error(f"Error creating LLM for agent '{agent_id}': {e}")
75
- raise ValueError(f"Failed to create LLM for agent {agent_id}: {e}") from e
76
-
77
- agent_args = {
78
- "agent_id": agent_id,
79
- "role": self.role,
80
- "prompt_builder": self.prompt_builder,
81
- "llm": llm,
82
- "tools": tools
83
- }
84
-
85
- if self.agent_type == "standalone":
86
- logger.debug(f"Instantiating Agent with args: {agent_args}")
87
- return Agent(**agent_args)
88
- elif self.agent_type == "group_aware":
89
- logger.debug(f"Instantiating GroupAwareAgent with args: {agent_args}")
90
- return GroupAwareAgent(**agent_args)
91
- else:
92
- logger.error(f"Unsupported agent type specified in factory: {self.agent_type}")
93
- raise ValueError(f"Unsupported agent type: {self.agent_type}")
94
-
@@ -1,11 +0,0 @@
1
- # file: autobyteus/autobyteus/agent/registry/__init__.py
2
- from .agent_definition import AgentDefinition
3
- from .agent_registry import AgentRegistry, default_agent_registry
4
- from autobyteus.agent.factory.agent_factory import AgentFactory
5
-
6
- __all__ = [
7
- "AgentDefinition",
8
- "AgentRegistry",
9
- "default_agent_registry",
10
- "AgentFactory"
11
- ]
@@ -1,94 +0,0 @@
1
- import logging
2
- from typing import Dict, List, Any, Optional
3
-
4
- logger = logging.getLogger(__name__)
5
-
6
- class AgentDefinition:
7
- """
8
- Represents the static definition of an agent, containing its role, description,
9
- tools, optional system prompt, and optional initial user message.
10
- """
11
- def __init__(self,
12
- role: str,
13
- description: str,
14
- tools: List[str],
15
- system_prompt: Optional[str] = None,
16
- initial_user_message: Optional[str] = None):
17
- """
18
- Initializes the AgentDefinition.
19
-
20
- Args:
21
- role: The unique role identifier of the agent (e.g., 'coordinator', 'worker').
22
- description: A human-readable description of the agent's purpose.
23
- tools: A list of tool names the agent can use.
24
- system_prompt: An optional system prompt to configure the LLM's behavior.
25
- initial_user_message: An optional initial user message to start the agent's conversation.
26
-
27
- Raises:
28
- ValueError: If role, description, or tools are invalid, or if system_prompt or
29
- initial_user_message are not strings when provided.
30
- """
31
- if not role or not isinstance(role, str):
32
- raise ValueError("AgentDefinition requires a non-empty string 'role'.")
33
- if not description or not isinstance(description, str):
34
- raise ValueError(f"AgentDefinition '{role}' requires a non-empty string 'description'.")
35
- if not isinstance(tools, list) or not all(isinstance(t, str) and t for t in tools):
36
- raise ValueError(f"AgentDefinition '{role}' requires a non-empty list of tool name strings.")
37
- if system_prompt is not None and not isinstance(system_prompt, str):
38
- raise ValueError(f"AgentDefinition '{role}' system_prompt must be a string or None.")
39
- if initial_user_message is not None and not isinstance(initial_user_message, str):
40
- raise ValueError(f"AgentDefinition '{role}' initial_user_message must be a string or None.")
41
-
42
- self._role = role
43
- self._description = description
44
- self._tools = tools
45
- self._system_prompt = system_prompt
46
- self._initial_user_message = initial_user_message
47
-
48
- logger.debug(f"AgentDefinition created for role '{self.role}'.")
49
-
50
- @property
51
- def role(self) -> str:
52
- """The unique role identifier of the agent."""
53
- return self._role
54
-
55
- @property
56
- def description(self) -> str:
57
- """The human-readable description of the agent's purpose."""
58
- return self._description
59
-
60
- @property
61
- def tools(self) -> List[str]:
62
- """The list of tool names the agent can use."""
63
- return self._tools
64
-
65
- @property
66
- def system_prompt(self) -> Optional[str]:
67
- """The optional system prompt for the agent."""
68
- return self._system_prompt
69
-
70
- @property
71
- def initial_user_message(self) -> Optional[str]:
72
- """The optional initial user message for the agent."""
73
- return self._initial_user_message
74
-
75
- def __repr__(self) -> str:
76
- """Provides a developer-friendly string representation."""
77
- desc_repr = self.description
78
- if len(desc_repr) > 70:
79
- desc_repr = desc_repr[:67] + "..."
80
- # Remove newlines/tabs for cleaner logging
81
- desc_repr = desc_repr.replace('\n', '\\n').replace('\t', '\\t')
82
- return (f"AgentDefinition(role='{self.role}', description='{desc_repr}', "
83
- f"tools={self.tools}, system_prompt='{self.system_prompt}', "
84
- f"initial_user_message='{self.initial_user_message}')")
85
-
86
- def to_dict(self) -> Dict[str, Any]:
87
- """Returns a dictionary representation of the agent definition."""
88
- return {
89
- "role": self.role,
90
- "description": self.description,
91
- "tools": self.tools,
92
- "system_prompt": self.system_prompt,
93
- "initial_user_message": self.initial_user_message
94
- }
@@ -1,114 +0,0 @@
1
- # file: autobyteus/autobyteus/agent/registry/agent_registry.py
2
- import logging
3
- from typing import Dict, List, Optional
4
-
5
- from autobyteus.utils.singleton import SingletonMeta
6
- from autobyteus.agent.factory.agent_factory import AgentFactory
7
- from .agent_definition import AgentDefinition
8
-
9
- logger = logging.getLogger(__name__)
10
-
11
- class AgentRegistry(metaclass=SingletonMeta):
12
- """
13
- Manages AgentDefinitions (role, description, tools, initial_user_message, agent_class),
14
- populated exclusively via programmatic registration. Uses AgentFactory to create agent instances.
15
- """
16
- _definitions: Dict[str, AgentDefinition] = {}
17
-
18
- def __init__(self, agent_factory: AgentFactory):
19
- """
20
- Initializes the AgentRegistry with an AgentFactory.
21
-
22
- Args:
23
- agent_factory: The AgentFactory instance used to create agent instances.
24
- """
25
- self.agent_factory = agent_factory
26
- logger.info("AgentRegistry initialized with AgentFactory.")
27
-
28
- def register_agent(self, definition: AgentDefinition):
29
- """
30
- Registers an agent definition (role, description, tools, initial_user_message, agent_class) programmatically.
31
-
32
- Args:
33
- definition: The AgentDefinition object to register.
34
-
35
- Raises:
36
- ValueError: If the definition is invalid. Overwrites existing definitions with the same role.
37
- """
38
- if not isinstance(definition, AgentDefinition):
39
- raise ValueError("Attempted to register an object that is not an AgentDefinition.")
40
-
41
- role = definition.role
42
- if role in self._definitions:
43
- logger.warning(f"Overwriting existing agent definition for role: '{role}'")
44
- AgentRegistry._definitions[role] = definition
45
- logger.info(f"Successfully registered agent definition: '{role}'")
46
-
47
- def get_agent_definition(self, role: str) -> Optional[AgentDefinition]:
48
- """
49
- Retrieves the definition for a specific agent role.
50
-
51
- Args:
52
- role: The unique role of the agent definition to retrieve.
53
-
54
- Returns:
55
- The AgentDefinition object if found, otherwise None.
56
- """
57
- definition = self._definitions.get(role)
58
- if not definition:
59
- logger.debug(f"Agent definition not found for role: '{role}'")
60
- return definition
61
-
62
- def create_agent(self, role: str, agent_id: str):
63
- """
64
- Creates an agent instance using the AgentFactory based on the agent definition.
65
-
66
- Args:
67
- role: The role of the agent to create.
68
- agent_id: The unique identifier for the agent instance.
69
-
70
- Returns:
71
- The agent instance if the definition exists, otherwise None.
72
-
73
- Raises:
74
- ValueError: If the agent definition is not found.
75
- """
76
- definition = self.get_agent_definition(role)
77
- if not definition:
78
- logger.error(f"Cannot create agent: No definition found for role '{role}'")
79
- raise ValueError(f"No agent definition found for role '{role}'")
80
-
81
- logger.info(f"Creating agent instance for role '{role}' with id '{agent_id}' using AgentFactory")
82
- return self.agent_factory.create_agent(agent_id)
83
-
84
- def list_agents(self) -> List[AgentDefinition]:
85
- """
86
- Returns a list of all registered agent definitions.
87
-
88
- Returns:
89
- A list of AgentDefinition objects.
90
- """
91
- return list(self._definitions.values())
92
-
93
- def list_agent_roles(self) -> List[str]:
94
- """
95
- Returns a list of the roles of all registered agents.
96
-
97
- Returns:
98
- A list of agent role strings.
99
- """
100
- return list(self._definitions.keys())
101
-
102
- def get_all_definitions(self) -> Dict[str, AgentDefinition]:
103
- """Returns the internal dictionary of definitions."""
104
- return dict(AgentRegistry._definitions)
105
-
106
- default_agent_registry = AgentRegistry(agent_factory=AgentFactory(
107
- role="default",
108
- agent_type="group_aware",
109
- tool_factory=ToolFactory(),
110
- llm_factory=LLMFactory(),
111
- prompt_builder=PromptBuilder(),
112
- llm_model=LLMModel(),
113
- tool_names=[]
114
- ))
@@ -1,9 +0,0 @@
1
- # file: autobyteus/autobyteus/agent/remote_agent.py
2
- from autobyteus.agent.agent import Agent
3
-
4
- class RemoteAgent(Agent):
5
- """
6
- A placeholder class for remote agents that will interact with external systems
7
- (e.g., via MCP or HTTP protocols). To be implemented in the future.
8
- """
9
- pass
@@ -1,82 +0,0 @@
1
- # file: autobyteus/autobyteus/tools/mcp_remote_tool.py
2
- import logging
3
- from typing import Any, Dict
4
-
5
- from autobyteus.tools.base_tool import BaseTool
6
- import mcp
7
-
8
- logger = logging.getLogger(__name__)
9
-
10
- class McpRemoteTool(BaseTool):
11
- """
12
- A tool that executes remote tool calls on an MCP (Model Context Protocol) server.
13
- """
14
- def __init__(self, name: str, description: str, connection_params: Dict[str, Any]):
15
- """
16
- Initializes the McpRemoteTool.
17
-
18
- Args:
19
- name: The unique name/identifier of the tool (e.g., 'McpRemoteTool').
20
- description: A human-readable description of the tool's purpose.
21
- connection_params: A dictionary containing MCP server connection details
22
- (e.g., {'host': 'localhost', 'port': 5000}).
23
-
24
- Raises:
25
- ValueError: If name, description, or connection_params are invalid.
26
- """
27
- if not name or not isinstance(name, str):
28
- raise ValueError("McpRemoteTool requires a non-empty string 'name'.")
29
- if not description or not isinstance(description, str):
30
- raise ValueError(f"McpRemoteTool '{name}' requires a non-empty string 'description'.")
31
- if not isinstance(connection_params, dict) or not connection_params:
32
- raise ValueError(f"McpRemoteTool '{name}' requires a non-empty dictionary for 'connection_params'.")
33
-
34
- super().__init__(name, description)
35
- self.connection_params = connection_params
36
- logger.debug(f"McpRemoteTool initialized with name '{self.name}' and connection_params: {self.connection_params}")
37
-
38
- def execute(self, args: Dict[str, Any]) -> Any:
39
- """
40
- Executes the remote tool call on the MCP server.
41
-
42
- Args:
43
- args: A dictionary containing the tool name and parameters to pass to the MCP server
44
- (e.g., {'tool_name': 'do_mcp_analysis', 'params': {...}}).
45
-
46
- Returns:
47
- The result of the tool execution, typically a dictionary or string.
48
-
49
- Raises:
50
- ValueError: If args is invalid or missing required fields.
51
- RuntimeError: If the MCP server connection or tool execution fails.
52
- """
53
- if not isinstance(args, dict) or 'tool_name' not in args:
54
- logger.error(f"Invalid arguments for McpRemoteTool '{self.name}': 'tool_name' is required.")
55
- raise ValueError("McpRemoteTool requires a dictionary with a 'tool_name' key.")
56
-
57
- tool_name = args['tool_name']
58
- params = args.get('params', {})
59
- logger.info(f"Executing McpRemoteTool '{self.name}' with tool_name '{tool_name}' and params: {params}")
60
-
61
- try:
62
- # Step 17: Establish connection to MCP server
63
- client = mcp.stdio_client(self.connection_params)
64
- logger.debug(f"Connected to MCP server with connection_params: {self.connection_params}")
65
-
66
- # Step 19: Create client session
67
- session = client.ClientSession()
68
- logger.debug(f"Created MCP client session for tool '{tool_name}'")
69
-
70
- # Step 20: Initialize session
71
- session.initialize()
72
- logger.debug(f"Initialized MCP session for tool '{tool_name}'")
73
-
74
- # Step 21: Call the remote tool
75
- result = session.call_tool(tool_name, params)
76
- logger.info(f"Successfully executed MCP tool '{tool_name}' with result: {result}")
77
-
78
- return result
79
-
80
- except Exception as e:
81
- logger.error(f"Failed to execute McpRemoteTool '{self.name}' for tool '{tool_name}': {str(e)}")
82
- raise RuntimeError(f"McpRemoteTool execution failed: {str(e)}")