agent-mcp 0.1.3__py3-none-any.whl → 0.1.4__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.
Files changed (44) hide show
  1. agent_mcp/__init__.py +2 -2
  2. agent_mcp/camel_mcp_adapter.py +521 -0
  3. agent_mcp/cli.py +47 -0
  4. agent_mcp/heterogeneous_group_chat.py +412 -38
  5. agent_mcp/langchain_mcp_adapter.py +176 -43
  6. agent_mcp/mcp_agent.py +26 -0
  7. agent_mcp/mcp_transport.py +11 -5
  8. {agent_mcp-0.1.3.dist-info → agent_mcp-0.1.4.dist-info}/METADATA +6 -4
  9. agent_mcp-0.1.4.dist-info/RECORD +49 -0
  10. {agent_mcp-0.1.3.dist-info → agent_mcp-0.1.4.dist-info}/WHEEL +1 -1
  11. agent_mcp-0.1.4.dist-info/entry_points.txt +2 -0
  12. agent_mcp-0.1.4.dist-info/top_level.txt +3 -0
  13. demos/__init__.py +1 -0
  14. demos/basic/__init__.py +1 -0
  15. demos/basic/framework_examples.py +108 -0
  16. demos/basic/langchain_camel_demo.py +272 -0
  17. demos/basic/simple_chat.py +355 -0
  18. demos/basic/simple_integration_example.py +51 -0
  19. demos/collaboration/collaborative_task_example.py +437 -0
  20. demos/collaboration/group_chat_example.py +130 -0
  21. demos/collaboration/simplified_crewai_example.py +39 -0
  22. demos/langgraph/autonomous_langgraph_network.py +808 -0
  23. demos/langgraph/langgraph_agent_network.py +415 -0
  24. demos/langgraph/langgraph_collaborative_task.py +619 -0
  25. demos/langgraph/langgraph_example.py +227 -0
  26. demos/langgraph/run_langgraph_examples.py +213 -0
  27. demos/network/agent_network_example.py +381 -0
  28. demos/network/email_agent.py +130 -0
  29. demos/network/email_agent_demo.py +46 -0
  30. demos/network/heterogeneous_network_example.py +216 -0
  31. demos/network/multi_framework_example.py +199 -0
  32. demos/utils/check_imports.py +49 -0
  33. demos/workflows/autonomous_agent_workflow.py +248 -0
  34. demos/workflows/mcp_features_demo.py +353 -0
  35. demos/workflows/run_agent_collaboration_demo.py +63 -0
  36. demos/workflows/run_agent_collaboration_with_logs.py +396 -0
  37. demos/workflows/show_agent_interactions.py +107 -0
  38. demos/workflows/simplified_autonomous_demo.py +74 -0
  39. functions/main.py +144 -0
  40. functions/mcp_network_server.py +513 -0
  41. functions/utils.py +47 -0
  42. agent_mcp-0.1.3.dist-info/RECORD +0 -18
  43. agent_mcp-0.1.3.dist-info/entry_points.txt +0 -2
  44. agent_mcp-0.1.3.dist-info/top_level.txt +0 -1
@@ -0,0 +1,437 @@
1
+ """
2
+ Collaborative Task Example using MCPAgent.
3
+
4
+ This example demonstrates a team of agents working together on a shared task,
5
+ with a user interacting with them throughout the process. Agents will collaborate
6
+ by sharing research, analysis, and planning information.
7
+ """
8
+
9
+ import os
10
+ import json
11
+ import time
12
+ from typing import Dict, List, Any, Optional
13
+
14
+ # Import AutoGen components and MCPAgent
15
+ from autogen import UserProxyAgent
16
+ from agent_mcp.mcp_agent import MCPAgent
17
+
18
+ # Check for API key
19
+ api_key = os.environ.get("OPENAI_API_KEY")
20
+ if not api_key:
21
+ raise ValueError("Please set the OPENAI_API_KEY environment variable")
22
+
23
+ # LLM configuration
24
+ config = {
25
+ "config_list": [{"model": "gpt-3.5-turbo", "api_key": api_key}],
26
+ "temperature": 0.7,
27
+ }
28
+
29
+ class CollaborativeProject:
30
+ """A collaborative project where agents work together on a task."""
31
+
32
+ def __init__(self, project_name="Research Project"):
33
+ """Initialize a new collaborative project."""
34
+ self.project_name = project_name
35
+ self.agents = {}
36
+ self.user = None
37
+ self.project_context = {
38
+ "title": project_name,
39
+ "status": "initialized",
40
+ "created_at": time.time(),
41
+ "tasks": {},
42
+ "research": {},
43
+ "analysis": {},
44
+ "plan": {},
45
+ "messages": []
46
+ }
47
+
48
+ # Initialize the shared workspace
49
+ self.workspace = {
50
+ "project": self.project_context,
51
+ "last_updated": time.time()
52
+ }
53
+
54
+ def create_team(self):
55
+ """Create a team of specialized agents for the project."""
56
+ # Create project manager
57
+ self.agents["manager"] = MCPAgent(
58
+ name="ProjectManager", # Removed whitespace from the name
59
+ system_message="""You are the Project Manager agent.
60
+ You coordinate the work of the research team, assign tasks, track progress,
61
+ and ensure everyone is working effectively. You have a clear view of the big picture
62
+ and help keep the project on track. When interacting with the user, be concise,
63
+ professional, and always focus on making project-related decisions.
64
+
65
+ When communicating with other agents, reference relevant context from the shared workspace,
66
+ and continually update the project plan as information evolves.""",
67
+ llm_config=config
68
+ )
69
+
70
+ # Create researcher
71
+ self.agents["researcher"] = MCPAgent(
72
+ name="Researcher",
73
+ system_message="""You are the Researcher agent.
74
+ Your role is to gather information, find facts, and provide well-researched content
75
+ for the project. Be thorough, detail-oriented, and always cite your sources when possible.
76
+ Focus on collecting accurate, relevant information on topics assigned by the Project Manager.
77
+
78
+ When you discover new information, add it to the shared workspace so other team members
79
+ can use it in their work. Ask specific questions to clarify research requirements.""",
80
+ llm_config=config
81
+ )
82
+
83
+ # Create analyst
84
+ self.agents["analyst"] = MCPAgent(
85
+ name="Analyst",
86
+ system_message="""You are the Analyst agent.
87
+ Your job is to evaluate the research, identify patterns, derive insights, and make
88
+ recommendations based on data. Be logical, critical, and balanced in your analysis.
89
+ Use quantitative and qualitative approaches as appropriate.
90
+
91
+ Review findings from the Researcher, provide meaningful interpretations, and update
92
+ the shared workspace with your analysis. Focus on what the information means for the project goals.""",
93
+ llm_config=config
94
+ )
95
+
96
+ # Create content specialist
97
+ self.agents["content"] = MCPAgent(
98
+ name="ContentSpecialist", # Removed whitespace from the name
99
+ system_message="""You are the Content Specialist agent.
100
+ You excel at crafting clear, compelling content based on research and analysis.
101
+ Your role is to take the project's information and create well-structured deliverables
102
+ that effectively communicate the key points.
103
+
104
+ Review research and analysis from other team members, organize information in a logical way,
105
+ and create drafts in the shared workspace. Focus on clarity, accuracy, and engagement.""",
106
+ llm_config=config
107
+ )
108
+
109
+ # Create user proxy for human interaction
110
+ self.user = UserProxyAgent(
111
+ name="User",
112
+ human_input_mode="ALWAYS",
113
+ max_consecutive_auto_reply=0
114
+ )
115
+
116
+ # Connect agents to each other as tools
117
+ self._connect_agents()
118
+
119
+ # Share the workspace with all agents
120
+ self._share_workspace()
121
+
122
+ print(f"Team created for project: {self.project_name}")
123
+
124
+ def _connect_agents(self):
125
+ """Register each agent as a tool for the other agents."""
126
+ agent_ids = list(self.agents.keys())
127
+
128
+ for agent_id in agent_ids:
129
+ for other_id in agent_ids:
130
+ if agent_id != other_id:
131
+ self.agents[agent_id].register_agent_as_tool(self.agents[other_id])
132
+
133
+ print("Agents connected for collaboration")
134
+
135
+ def _share_workspace(self):
136
+ """Share the workspace with all agents."""
137
+ for agent_id, agent in self.agents.items():
138
+ agent.update_context("workspace", self.workspace)
139
+
140
+ # Add agent specific info
141
+ agent.update_context("role", {
142
+ "id": agent_id,
143
+ "name": agent.name,
144
+ "primary_responsibility": agent_id
145
+ })
146
+
147
+ print("Shared workspace initialized")
148
+
149
+ def update_workspace(self, section, key, value):
150
+ """Update a section of the workspace and share with all agents."""
151
+ if section in self.project_context:
152
+ if isinstance(self.project_context[section], dict):
153
+ self.project_context[section][key] = value
154
+ else:
155
+ print(f"Section {section} is not a dictionary and cannot be updated with a key.")
156
+ return
157
+ else:
158
+ print(f"Section {section} not found in project context.")
159
+ return
160
+
161
+ # Update timestamp
162
+ self.workspace["last_updated"] = time.time()
163
+
164
+ # Share updated workspace with all agents
165
+ for agent in self.agents.values():
166
+ agent.update_context("workspace", self.workspace)
167
+
168
+ print(f"Workspace updated: Added {key} to {section}")
169
+
170
+ def add_message(self, from_agent, message):
171
+ """Add a message to the project communication log."""
172
+ msg = {
173
+ "from": from_agent,
174
+ "timestamp": time.time(),
175
+ "content": message
176
+ }
177
+
178
+ self.project_context["messages"].append(msg)
179
+ self.workspace["last_updated"] = time.time()
180
+
181
+ # Share updated workspace with all agents
182
+ for agent in self.agents.values():
183
+ agent.update_context("workspace", self.workspace)
184
+
185
+ print(f"Message added from {from_agent}")
186
+
187
+ def set_project_topic(self, topic, description):
188
+ """Set the project topic and description."""
189
+ self.project_context["title"] = topic
190
+ self.project_context["description"] = description
191
+ self.project_context["status"] = "topic_set"
192
+ self.workspace["last_updated"] = time.time()
193
+
194
+ # Share with all agents
195
+ for agent in self.agents.values():
196
+ agent.update_context("workspace", self.workspace)
197
+
198
+ print(f"Project topic set: {topic}")
199
+
200
+ def assign_task(self, agent_id, task_name, description):
201
+ """Assign a task to a specific agent."""
202
+ if agent_id not in self.agents:
203
+ print(f"Agent {agent_id} not found.")
204
+ return
205
+
206
+ task_id = f"task_{int(time.time())}"
207
+
208
+ task = {
209
+ "id": task_id,
210
+ "name": task_name,
211
+ "description": description,
212
+ "assigned_to": agent_id,
213
+ "status": "assigned",
214
+ "created_at": time.time()
215
+ }
216
+
217
+ # Add to tasks
218
+ self.project_context["tasks"][task_id] = task
219
+ self.workspace["last_updated"] = time.time()
220
+
221
+ # Share with all agents
222
+ for agent in self.agents.values():
223
+ agent.update_context("workspace", self.workspace)
224
+
225
+ # Notify the assigned agent specifically
226
+ self.agents[agent_id].update_context("new_task", task)
227
+
228
+ print(f"Task '{task_name}' assigned to {self.agents[agent_id].name}")
229
+ return task_id
230
+
231
+ def update_task_status(self, task_id, status, result=None):
232
+ """Update the status of a task."""
233
+ if task_id not in self.project_context["tasks"]:
234
+ print(f"Task {task_id} not found.")
235
+ return
236
+
237
+ self.project_context["tasks"][task_id]["status"] = status
238
+ self.project_context["tasks"][task_id]["updated_at"] = time.time()
239
+
240
+ if result:
241
+ self.project_context["tasks"][task_id]["result"] = result
242
+
243
+ self.workspace["last_updated"] = time.time()
244
+
245
+ # Share with all agents
246
+ for agent in self.agents.values():
247
+ agent.update_context("workspace", self.workspace)
248
+
249
+ print(f"Task {task_id} status updated to {status}")
250
+
251
+ def interact_with_agent(self, agent_id):
252
+ """Allow the user to interact with a specific agent."""
253
+ if agent_id not in self.agents:
254
+ print(f"Agent '{agent_id}' not found. Available agents: {', '.join(self.agents.keys())}")
255
+ return
256
+
257
+ agent = self.agents[agent_id]
258
+ print(f"\n--- Starting interaction with {agent.name} ({agent_id}) ---")
259
+
260
+ # Get initial message from user
261
+ initial_message = input(f"\nYour message to {agent.name}: ")
262
+
263
+ # Create a conversation chain that includes the agent's context
264
+ messages = [{"role": "user", "content": initial_message}]
265
+
266
+ # Get agent response
267
+ response = agent.generate_reply(messages=messages, sender=self.user)
268
+ print(f"\n{agent.name}: {response}")
269
+
270
+ # Add to project messages
271
+ self.add_message(agent.name, response)
272
+
273
+ # Continue the conversation until user exits
274
+ while True:
275
+ # Check if user wants to exit
276
+ next_message = input("\nYour response (or type 'exit' to end, 'switch:agent_id' to change agents): ")
277
+
278
+ if next_message.lower() == 'exit':
279
+ print(f"--- Ending interaction with {agent.name} ---")
280
+ break
281
+
282
+ if next_message.lower().startswith('switch:'):
283
+ new_agent_id = next_message.split(':', 1)[1].strip()
284
+ print(f"--- Switching from {agent.name} to {new_agent_id} ---")
285
+ self.interact_with_agent(new_agent_id)
286
+ break
287
+
288
+ # Add message from user to project
289
+ self.add_message("User", next_message)
290
+
291
+ # Add to messages and get response
292
+ messages.append({"role": "user", "content": next_message})
293
+ response = agent.generate_reply(messages=messages, sender=self.user)
294
+ print(f"\n{agent.name}: {response}")
295
+
296
+ # Add agent response to project and message history
297
+ self.add_message(agent.name, response)
298
+ messages.append({"role": "assistant", "content": response})
299
+
300
+ def list_agents(self):
301
+ """List all agents in the team."""
302
+ print("\n--- Project Team Directory ---")
303
+ for agent_id, agent in self.agents.items():
304
+ role = agent.get_context("role")
305
+ print(f"- {agent.name} ({agent_id})")
306
+
307
+ def show_workspace(self):
308
+ """Display the current state of the workspace."""
309
+ print("\n--- Project Workspace ---")
310
+ print(f"Project: {self.project_context['title']}")
311
+ print(f"Status: {self.project_context['status']}")
312
+
313
+ if "description" in self.project_context:
314
+ print(f"Description: {self.project_context['description']}")
315
+
316
+ print("\nTasks:")
317
+ if self.project_context["tasks"]:
318
+ for task_id, task in self.project_context["tasks"].items():
319
+ print(f"- [{task['status']}] {task['name']} (Assigned to: {task['assigned_to']})")
320
+ else:
321
+ print("No tasks yet")
322
+
323
+ print("\nResearch Items:")
324
+ if self.project_context["research"]:
325
+ for key, value in self.project_context["research"].items():
326
+ if isinstance(value, dict) and "title" in value:
327
+ print(f"- {value['title']}")
328
+ else:
329
+ print(f"- {key}")
330
+ else:
331
+ print("No research items yet")
332
+
333
+ print("\nAnalysis Items:")
334
+ if self.project_context["analysis"]:
335
+ for key, value in self.project_context["analysis"].items():
336
+ if isinstance(value, dict) and "title" in value:
337
+ print(f"- {value['title']}")
338
+ else:
339
+ print(f"- {key}")
340
+ else:
341
+ print("No analysis items yet")
342
+
343
+ print("\nRecent Messages:")
344
+ messages = self.project_context["messages"][-5:] if self.project_context["messages"] else []
345
+ if messages:
346
+ for msg in messages:
347
+ print(f"- {msg['from']}: {msg['content'][:50]}..." if len(msg['content']) > 50 else f"- {msg['from']}: {msg['content']}")
348
+ else:
349
+ print("No messages yet")
350
+
351
+ def main():
352
+ """Run the collaborative project example."""
353
+ print("=== Collaborative Project Example ===")
354
+ print("This example demonstrates agents working together on a shared project.")
355
+
356
+ # Create a new project
357
+ project_name = input("Enter a name for your project: ")
358
+ project = CollaborativeProject(project_name)
359
+ project.create_team()
360
+
361
+ # Main interaction loop
362
+ while True:
363
+ print("\n=== Project Menu ===")
364
+ print("1. List team members")
365
+ print("2. Set project topic and description")
366
+ print("3. Show workspace")
367
+ print("4. Assign a task")
368
+ print("5. Talk to a team member")
369
+ print("6. Add research item")
370
+ print("7. Add analysis")
371
+ print("8. Exit")
372
+
373
+ choice = input("\nSelect an option (1-8): ")
374
+
375
+ if choice == "1":
376
+ project.list_agents()
377
+
378
+ elif choice == "2":
379
+ topic = input("Enter the project topic: ")
380
+ description = input("Enter a brief description: ")
381
+ project.set_project_topic(topic, description)
382
+
383
+ elif choice == "3":
384
+ project.show_workspace()
385
+
386
+ elif choice == "4":
387
+ project.list_agents()
388
+ agent_id = input("\nAssign to which team member? ")
389
+ if agent_id in project.agents:
390
+ task_name = input("Task name: ")
391
+ description = input("Task description: ")
392
+ project.assign_task(agent_id, task_name, description)
393
+ else:
394
+ print(f"Agent '{agent_id}' not found.")
395
+
396
+ elif choice == "5":
397
+ project.list_agents()
398
+ agent_id = input("\nWhich team member do you want to talk to? ")
399
+ project.interact_with_agent(agent_id)
400
+
401
+ elif choice == "6":
402
+ title = input("Research item title: ")
403
+ content = input("Research content: ")
404
+ source = input("Source (optional): ")
405
+
406
+ research_item = {
407
+ "title": title,
408
+ "content": content,
409
+ "source": source,
410
+ "added_at": time.time()
411
+ }
412
+
413
+ key = title.lower().replace(" ", "_")
414
+ project.update_workspace("research", key, research_item)
415
+
416
+ elif choice == "7":
417
+ title = input("Analysis title: ")
418
+ content = input("Analysis content: ")
419
+
420
+ analysis_item = {
421
+ "title": title,
422
+ "content": content,
423
+ "added_at": time.time()
424
+ }
425
+
426
+ key = title.lower().replace(" ", "_")
427
+ project.update_workspace("analysis", key, analysis_item)
428
+
429
+ elif choice == "8":
430
+ print("Exiting the Collaborative Project Example. Goodbye!")
431
+ break
432
+
433
+ else:
434
+ print("Invalid option. Please try again.")
435
+
436
+ if __name__ == "__main__":
437
+ main()
@@ -0,0 +1,130 @@
1
+ """
2
+ Example of using HeterogeneousGroupChat with different agent frameworks.
3
+ """
4
+
5
+ import os
6
+ import asyncio
7
+ import openai
8
+ from agent_mcp.enhanced_mcp_agent import EnhancedMCPAgent
9
+ from agent_mcp.langchain_mcp_adapter import LangchainMCPAdapter
10
+ from agent_mcp.heterogeneous_group_chat import HeterogeneousGroupChat
11
+ from agent_mcp.mcp_transport import HTTPTransport
12
+
13
+ # Langchain imports
14
+ from langchain_openai import ChatOpenAI
15
+ from langchain_community.utilities.duckduckgo_search import DuckDuckGoSearchAPIWrapper
16
+ from langchain_community.tools import Tool
17
+ from langchain.agents import AgentExecutor, OpenAIFunctionsAgent
18
+ from langchain.schema.messages import SystemMessage
19
+
20
+ # Check for OpenAI API key
21
+ api_key = os.getenv("OPENAI_API_KEY")
22
+ if not api_key:
23
+ raise ValueError("Please set the OPENAI_API_KEY environment variable")
24
+
25
+ openai.api_key = api_key
26
+
27
+ async def setup_langchain_agent():
28
+ """Setup a Langchain agent with search capabilities"""
29
+ # Create Langchain tools
30
+ search = DuckDuckGoSearchAPIWrapper()
31
+ search_tool = Tool(
32
+ name="duckduckgo_search",
33
+ description="Search the web using DuckDuckGo",
34
+ func=search.run
35
+ )
36
+ tools = [search_tool]
37
+
38
+ # Create Langchain model and agent
39
+ llm = ChatOpenAI(temperature=0)
40
+ agent = OpenAIFunctionsAgent.from_llm_and_tools(
41
+ llm=llm,
42
+ tools=tools,
43
+ system_message=SystemMessage(content=(
44
+ "You are a research assistant that helps find and analyze information."
45
+ ))
46
+ )
47
+
48
+ # Create the agent executor
49
+ agent_executor = AgentExecutor.from_agent_and_tools(
50
+ agent=agent,
51
+ tools=tools,
52
+ verbose=True,
53
+ handle_parsing_errors=True
54
+ )
55
+
56
+ return agent, agent_executor
57
+
58
+ async def create_worker_agents(api_key: str):
59
+ """Create a list of worker agents"""
60
+ # Create Autogen worker
61
+ autogen_worker = EnhancedMCPAgent(
62
+ name="AutogenWorker",
63
+ transport=HTTPTransport(host="localhost", port=8001),
64
+ client_mode=True,
65
+ system_message="I help with text analysis and summarization",
66
+ llm_config={
67
+ "config_list": [{
68
+ "model": "gpt-3.5-turbo",
69
+ "api_key": api_key
70
+ }]
71
+ }
72
+ )
73
+
74
+ # Create Langchain worker
75
+ langchain_agent, agent_executor = await setup_langchain_agent()
76
+ langchain_worker = LangchainMCPAdapter(
77
+ name="LangchainWorker",
78
+ transport=HTTPTransport(host="localhost", port=8002),
79
+ client_mode=True,
80
+ langchain_agent=langchain_agent,
81
+ agent_executor=agent_executor
82
+ )
83
+
84
+ return [autogen_worker, langchain_worker]
85
+
86
+ async def main():
87
+ # Create the group chat
88
+ group = HeterogeneousGroupChat(
89
+ name="ResearchTeam",
90
+ host="https://localhost:8000"
91
+ )
92
+
93
+ # Create and add the coordinator
94
+ coordinator = group.create_coordinator(api_key)
95
+
96
+ # Create and add all worker agents at once
97
+ workers = await create_worker_agents(api_key)
98
+ group.add_agents(workers)
99
+
100
+ # Connect all agents
101
+ await group.connect()
102
+
103
+ # Define a collaborative task
104
+ task = {
105
+ "task_id": "research_task_1",
106
+ "type": "collaborative_task",
107
+ "description": "Research the latest developments in quantum computing and prepare a summary",
108
+ "steps": [
109
+ {
110
+ "agent": "LangchainWorker",
111
+ "task_id": "research_task_1_LangchainWorker",
112
+ "description": "Search for recent quantum computing breakthroughs in 2024",
113
+ "url": "http://localhost:8002"
114
+ },
115
+ {
116
+ "agent": "AutogenWorker",
117
+ "task_id": "research_task_1_AutogenWorker",
118
+ "description": "Analyze and summarize the findings",
119
+ "url": "http://localhost:8001",
120
+ "depends_on": ["research_task_1_LangchainWorker"]
121
+ }
122
+ ]
123
+ }
124
+
125
+ # Submit task and wait for completion
126
+ await group.submit_task(task)
127
+ await group.wait_for_completion()
128
+
129
+ if __name__ == "__main__":
130
+ asyncio.run(main())
@@ -0,0 +1,39 @@
1
+ """
2
+ Example of using the one-line MCP integration with CrewAI agents.
3
+ """
4
+
5
+ import os
6
+ from crewai import Agent as CrewAgent
7
+ from agent_mcp.mcp_decorator import mcp_agent
8
+
9
+
10
+ from crewai import Task
11
+
12
+ # One-line integration with CrewAI
13
+ @mcp_agent(name="ResearchAgent")
14
+ class ResearchAgent(CrewAgent):
15
+ def __init__(self):
16
+ super().__init__(
17
+ name="ResearchAgent",
18
+ role="Research Analyst",
19
+ goal="Conduct thorough research on given topics",
20
+ backstory="Expert research analyst with deep analytical skills",
21
+ llm_model="gpt-3.5-turbo", # Specify the model explicitly
22
+ verbose=True # Show what the agent is doing
23
+ )
24
+
25
+ def analyze(self, topic: str) -> str:
26
+ """Analyze a given research topic"""
27
+ task = Task(
28
+ description=f"Analyze the following topic and provide key insights: {topic}",
29
+ expected_output="A detailed analysis with key insights, trends, and potential impacts",
30
+ agent=self
31
+ )
32
+ return self.execute_task(task)
33
+
34
+ # Create and use the agent
35
+ if __name__ == "__main__":
36
+ agent = ResearchAgent()
37
+ result = agent.analyze("AI trends in 2025")
38
+ print(f"Analysis result: {result}")
39
+ print(f"Available MCP tools: {agent.mcp_tools.keys()}")