fast-agent-mcp 0.2.5__py3-none-any.whl → 0.2.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.
- {fast_agent_mcp-0.2.5.dist-info → fast_agent_mcp-0.2.6.dist-info}/METADATA +1 -1
- {fast_agent_mcp-0.2.5.dist-info → fast_agent_mcp-0.2.6.dist-info}/RECORD +21 -21
- mcp_agent/agents/agent.py +1 -1
- mcp_agent/agents/base_agent.py +12 -0
- mcp_agent/agents/workflow/chain_agent.py +7 -1
- mcp_agent/agents/workflow/evaluator_optimizer.py +6 -0
- mcp_agent/agents/workflow/orchestrator_agent.py +6 -1
- mcp_agent/agents/workflow/parallel_agent.py +7 -1
- mcp_agent/agents/workflow/router_agent.py +7 -2
- mcp_agent/cli/commands/setup.py +2 -2
- mcp_agent/core/agent_app.py +8 -19
- mcp_agent/core/agent_types.py +1 -0
- mcp_agent/core/direct_decorators.py +2 -1
- mcp_agent/core/direct_factory.py +1 -1
- mcp_agent/core/interactive_prompt.py +1 -1
- mcp_agent/llm/augmented_llm.py +1 -1
- mcp_agent/mcp/interfaces.py +5 -0
- mcp_agent/mcp_server/agent_server.py +8 -8
- {fast_agent_mcp-0.2.5.dist-info → fast_agent_mcp-0.2.6.dist-info}/WHEEL +0 -0
- {fast_agent_mcp-0.2.5.dist-info → fast_agent_mcp-0.2.6.dist-info}/entry_points.txt +0 -0
- {fast_agent_mcp-0.2.5.dist-info → fast_agent_mcp-0.2.6.dist-info}/licenses/LICENSE +0 -0
@@ -8,33 +8,33 @@ mcp_agent/event_progress.py,sha256=25iz0yyg-O4glMmtijcYpDdUmtUIKsCmR_8A52GgeC4,2
|
|
8
8
|
mcp_agent/mcp_server_registry.py,sha256=r24xX4BYXj4BbWbU37uwuW9e1mFOYgpb258OMb21SaY,9928
|
9
9
|
mcp_agent/progress_display.py,sha256=GeJU9VUt6qKsFVymG688hCMVCsAygG9ifiiEb5IcbN4,361
|
10
10
|
mcp_agent/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
-
mcp_agent/agents/agent.py,sha256=
|
12
|
-
mcp_agent/agents/base_agent.py,sha256=
|
11
|
+
mcp_agent/agents/agent.py,sha256=Tn2YKw_ytx9b8jC-65WYQmrnD43kYiZsLa4sVHxn9d4,3854
|
12
|
+
mcp_agent/agents/base_agent.py,sha256=9IExAXyPpao4t7J_uF2pjSlbnlKp-229oiOykbE6KDI,23515
|
13
13
|
mcp_agent/agents/workflow/__init__.py,sha256=HloteEW6kalvgR0XewpiFAqaQlMPlPJYg5p3K33IUzI,25
|
14
|
-
mcp_agent/agents/workflow/chain_agent.py,sha256=
|
15
|
-
mcp_agent/agents/workflow/evaluator_optimizer.py,sha256=
|
16
|
-
mcp_agent/agents/workflow/orchestrator_agent.py,sha256=
|
14
|
+
mcp_agent/agents/workflow/chain_agent.py,sha256=EW10IgEnKJ3YfwLY61B1SQlYC-84jcXsrRmzpLQbngE,6384
|
15
|
+
mcp_agent/agents/workflow/evaluator_optimizer.py,sha256=VWdzVIy_qSiVsDJO22ta3RB3drkvBfXk9HxBYMpsC5U,13300
|
16
|
+
mcp_agent/agents/workflow/orchestrator_agent.py,sha256=30hFQyAmtjQTX6Li_zWWIHCpdNpfZkDo57YXXW5xIsI,21561
|
17
17
|
mcp_agent/agents/workflow/orchestrator_models.py,sha256=5P_aXADVT4Et8qT4e1cb9RelmHX5dCRrzu8j8T41Kdg,7230
|
18
18
|
mcp_agent/agents/workflow/orchestrator_prompts.py,sha256=EXKEI174sshkZyPPEnWbwwNafzSPuA39MXL7iqG9cWc,9106
|
19
|
-
mcp_agent/agents/workflow/parallel_agent.py,sha256=
|
20
|
-
mcp_agent/agents/workflow/router_agent.py,sha256=
|
19
|
+
mcp_agent/agents/workflow/parallel_agent.py,sha256=SgIXJx2X_MSlLOv6WXYRezwjDYjU9f95eKQzTm5Y_lk,7087
|
20
|
+
mcp_agent/agents/workflow/router_agent.py,sha256=WLv2ny_-6mAJ7tjU-6nUe2yVhW008vso5NU9tczNTn0,10666
|
21
21
|
mcp_agent/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
mcp_agent/cli/__main__.py,sha256=AVZ7tQFhU_sDOGuUGJq8ujgKtcxsYJBJwHbVaaiRDlI,166
|
23
23
|
mcp_agent/cli/main.py,sha256=PZdPJfsAJOm80vTu7j_XpMPhaDZOpqSe-ciU3YQsmA4,3149
|
24
24
|
mcp_agent/cli/terminal.py,sha256=GRwD-RGW7saIz2IOWZn5vD6JjiArscELBThm1GTFkuI,1065
|
25
25
|
mcp_agent/cli/commands/bootstrap.py,sha256=Pv3LQUQLK_5-8nbOQ6iibJI7awgD04P9xh6-VpU15pw,11571
|
26
26
|
mcp_agent/cli/commands/config.py,sha256=jU2gl4d5YESrdUboh3u6mxf7CxVT-_DT_sK8Vuh3ajw,231
|
27
|
-
mcp_agent/cli/commands/setup.py,sha256=
|
27
|
+
mcp_agent/cli/commands/setup.py,sha256=CsmfIvKFfOhU1bOkm1cTqNseQdn3qdlfXN4BALwQ3Ik,6345
|
28
28
|
mcp_agent/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
|
-
mcp_agent/core/agent_app.py,sha256=
|
30
|
-
mcp_agent/core/agent_types.py,sha256=
|
31
|
-
mcp_agent/core/direct_decorators.py,sha256=
|
32
|
-
mcp_agent/core/direct_factory.py,sha256=
|
29
|
+
mcp_agent/core/agent_app.py,sha256=5nQJNo8DocIRWiX4pVKAHUZF8s6HWpc-hJnfzl_1v1c,9697
|
30
|
+
mcp_agent/core/agent_types.py,sha256=LuWslu9YI6JRnAWwh_A1ZejK72-e839wH7tf2MHxSIU,1389
|
31
|
+
mcp_agent/core/direct_decorators.py,sha256=Q6t3VpRPLCRzqJycPZIkKbbEJMVocxdScp5o2xn4gLU,14460
|
32
|
+
mcp_agent/core/direct_factory.py,sha256=hYFCucZVAQ2wrfqIe9Qameoa-cCRaQ53R97EMHvUZAM,17572
|
33
33
|
mcp_agent/core/enhanced_prompt.py,sha256=P9FAtc0rqIYQfUDkTNVXitFIZEtB3fdq_Nr0-st64Qg,17948
|
34
34
|
mcp_agent/core/error_handling.py,sha256=xoyS2kLe0eG0bj2eSJCJ2odIhGUve2SbDR7jP-A-uRw,624
|
35
35
|
mcp_agent/core/exceptions.py,sha256=ENAD_qGG67foxy6vDkIvc-lgopIUQy6O7zvNPpPXaQg,2289
|
36
36
|
mcp_agent/core/fastagent.py,sha256=HTy1OCAhpHIM-4cd37-dxvb97eZUELN-ICAEFgqmJMk,18503
|
37
|
-
mcp_agent/core/interactive_prompt.py,sha256=
|
37
|
+
mcp_agent/core/interactive_prompt.py,sha256=zU53h8mmaJBnddYy2j57tH7jreQ9PUz7vLEo2gdDrio,17704
|
38
38
|
mcp_agent/core/mcp_content.py,sha256=2D7KHY9mG_vxoDwFLKvsPQV9VRIzHItM7V-jcEnACh8,8878
|
39
39
|
mcp_agent/core/prompt.py,sha256=qnintOUGEoDPYLI9bu9G2OlgVMCe5ZPUZilgMzydXhc,7919
|
40
40
|
mcp_agent/core/request_params.py,sha256=bEjWo86fqxdiWm2U5nPDd1uCUpcIQO9oiCinhB8lQN0,1185
|
@@ -50,7 +50,7 @@ mcp_agent/human_input/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
50
50
|
mcp_agent/human_input/handler.py,sha256=s712Z5ssTCwjL9-VKoIdP5CtgMh43YvepynYisiWTTA,3144
|
51
51
|
mcp_agent/human_input/types.py,sha256=RtWBOVzy8vnYoQrc36jRLn8z8N3C4pDPMBN5vF6qM5Y,1476
|
52
52
|
mcp_agent/llm/__init__.py,sha256=d8zgwG-bRFuwiMNMYkywg_qytk4P8lawyld_meuUmHI,68
|
53
|
-
mcp_agent/llm/augmented_llm.py,sha256=
|
53
|
+
mcp_agent/llm/augmented_llm.py,sha256=AFNA_v7cuxy9MSpCigv9FM9CEg27NsaUfeme4tiy1y8,18125
|
54
54
|
mcp_agent/llm/augmented_llm_passthrough.py,sha256=U0LssNWNVuZRuD9I7Wuvpo7vdDW4xtoPLirnYCgBGTY,6128
|
55
55
|
mcp_agent/llm/augmented_llm_playback.py,sha256=YVR2adzjMf9Q5WfYBytryWMRqJ87a3kNBnjxhApsMcU,3413
|
56
56
|
mcp_agent/llm/memory.py,sha256=UakoBCJBf59JBtB6uyZM0OZjlxDW_VHtSfDs08ibVEc,3312
|
@@ -80,7 +80,7 @@ mcp_agent/logging/tracing.py,sha256=d5lSXakzzi5PtQpUkVkOnYaGX8NduGPq__S7vx-Ln8U,
|
|
80
80
|
mcp_agent/logging/transport.py,sha256=m8YsLLu5T8eof_ndpLQs4gHOzqqEL98xsVwBwDsBfxI,17335
|
81
81
|
mcp_agent/mcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
82
82
|
mcp_agent/mcp/gen_client.py,sha256=fAVwFVCgSamw4PwoWOV4wrK9TABx1S_zZv8BctRyF2k,3030
|
83
|
-
mcp_agent/mcp/interfaces.py,sha256=
|
83
|
+
mcp_agent/mcp/interfaces.py,sha256=vma7bbWbY3zp1RM6hMYxVO4aV6Vfaygm-nLwzK2jFKI,6748
|
84
84
|
mcp_agent/mcp/logger_textio.py,sha256=OpnqMam9Pu0oVzYQWFMhrX1dRg2f5Fqb3qqPA6QAATM,2778
|
85
85
|
mcp_agent/mcp/mcp_activity.py,sha256=CajXCFWZ2cKEX9s4-HfNVAj471ePTVs4NOkvmIh65tE,592
|
86
86
|
mcp_agent/mcp/mcp_agent_client_session.py,sha256=RMYNltc2pDIzxwEJSS5589RbvPO0KWV4Y3jSyAmhKf0,4181
|
@@ -102,7 +102,7 @@ mcp_agent/mcp/prompts/prompt_load.py,sha256=VkcY6dD1jRCu-OB5AtSO8YwVATjEoYCkyAIG
|
|
102
102
|
mcp_agent/mcp/prompts/prompt_server.py,sha256=tXtQd4EnH86MmdAvHlXm4oOS1dWLSCW5PvoA7uU1TvA,16493
|
103
103
|
mcp_agent/mcp/prompts/prompt_template.py,sha256=EejiqGkau8OizORNyKTUwUjrPof5V-hH1H_MBQoQfXw,15732
|
104
104
|
mcp_agent/mcp_server/__init__.py,sha256=zBU51ITHIEPScd9nRafnhEddsWqXRPAAvHhkrbRI2_4,155
|
105
|
-
mcp_agent/mcp_server/agent_server.py,sha256=
|
105
|
+
mcp_agent/mcp_server/agent_server.py,sha256=LVZNML2_ysK7nVVLDou8pQuQWiEsMFZLryn_KihmkUQ,6431
|
106
106
|
mcp_agent/resources/examples/data-analysis/analysis-campaign.py,sha256=QdNdo0-7LR4Uzw61hEU_jVKmWyk6A9YpGo81kMwVobM,7267
|
107
107
|
mcp_agent/resources/examples/data-analysis/analysis.py,sha256=M9z8Q4YC5OGuqSa5uefYmmfmctqMn-WqCSfg5LI407o,2609
|
108
108
|
mcp_agent/resources/examples/data-analysis/fastagent.config.yaml,sha256=ini94PHyJCfgpjcjHKMMbGuHs6LIj46F1NwY0ll5HVk,1609
|
@@ -134,8 +134,8 @@ mcp_agent/resources/examples/workflows/orchestrator.py,sha256=rOGilFTliWWnZ3Jx5w
|
|
134
134
|
mcp_agent/resources/examples/workflows/parallel.py,sha256=n0dFN26QvYd2wjgohcaUBflac2SzXYx-bCyxMSousJE,1884
|
135
135
|
mcp_agent/resources/examples/workflows/router.py,sha256=E4x_-c3l4YW9w1i4ARcDtkdeqIdbWEGfsMzwLYpdbVc,1677
|
136
136
|
mcp_agent/ui/console_display.py,sha256=TVGDtJ37hc6UG0ei9g7ZPZZfFNeS1MYozt-Mx8HsPCk,9752
|
137
|
-
fast_agent_mcp-0.2.
|
138
|
-
fast_agent_mcp-0.2.
|
139
|
-
fast_agent_mcp-0.2.
|
140
|
-
fast_agent_mcp-0.2.
|
141
|
-
fast_agent_mcp-0.2.
|
137
|
+
fast_agent_mcp-0.2.6.dist-info/METADATA,sha256=f1wgZfK_zZRytbHKacbUDGvP7JS0Qqjp2YemYm1td9Y,29839
|
138
|
+
fast_agent_mcp-0.2.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
139
|
+
fast_agent_mcp-0.2.6.dist-info/entry_points.txt,sha256=qPM7vwtN1_KmP3dXehxgiCxUBHtqP7yfenZigztvY-w,226
|
140
|
+
fast_agent_mcp-0.2.6.dist-info/licenses/LICENSE,sha256=cN3FxDURL9XuzE5mhK9L2paZo82LTfjwCYVT7e3j0e4,10939
|
141
|
+
fast_agent_mcp-0.2.6.dist-info/RECORD,,
|
mcp_agent/agents/agent.py
CHANGED
@@ -66,7 +66,7 @@ class Agent(BaseAgent):
|
|
66
66
|
agent_name_str = str(self.name)
|
67
67
|
|
68
68
|
# Create agent_types dictionary with just this agent
|
69
|
-
agent_types = {agent_name_str:
|
69
|
+
agent_types = {agent_name_str: self.agent_type}
|
70
70
|
|
71
71
|
# Create the interactive prompt
|
72
72
|
prompt = InteractivePrompt(agent_types=agent_types)
|
mcp_agent/agents/base_agent.py
CHANGED
@@ -622,6 +622,18 @@ class BaseAgent(MCPAggregator, AgentProtocol):
|
|
622
622
|
response = await self.generate(prompts, request_params)
|
623
623
|
return response.first_text()
|
624
624
|
|
625
|
+
@property
|
626
|
+
def agent_type(self) -> str:
|
627
|
+
"""
|
628
|
+
Return the type of this agent.
|
629
|
+
|
630
|
+
This is used for display purposes in the interactive prompt and other UI elements.
|
631
|
+
|
632
|
+
Returns:
|
633
|
+
String representing the agent type
|
634
|
+
"""
|
635
|
+
return self.config.agent_type
|
636
|
+
|
625
637
|
@property
|
626
638
|
def message_history(self) -> List[PromptMessageMultipart]:
|
627
639
|
"""
|
@@ -9,8 +9,9 @@ from typing import Any, List, Optional, Tuple, Type
|
|
9
9
|
|
10
10
|
from mcp.types import TextContent
|
11
11
|
|
12
|
-
from mcp_agent.agents.agent import Agent
|
12
|
+
from mcp_agent.agents.agent import Agent
|
13
13
|
from mcp_agent.agents.base_agent import BaseAgent
|
14
|
+
from mcp_agent.core.agent_types import AgentConfig, AgentType
|
14
15
|
from mcp_agent.core.prompt import Prompt
|
15
16
|
from mcp_agent.core.request_params import RequestParams
|
16
17
|
from mcp_agent.mcp.interfaces import ModelT
|
@@ -22,6 +23,11 @@ class ChainAgent(BaseAgent):
|
|
22
23
|
A chain agent that processes requests through a series of specialized agents in sequence.
|
23
24
|
Passes the output of each agent to the next agent in the chain.
|
24
25
|
"""
|
26
|
+
|
27
|
+
@property
|
28
|
+
def agent_type(self) -> str:
|
29
|
+
"""Return the type of this agent."""
|
30
|
+
return AgentType.CHAIN.value
|
25
31
|
|
26
32
|
def __init__(
|
27
33
|
self,
|
@@ -14,6 +14,7 @@ from pydantic import BaseModel, Field
|
|
14
14
|
|
15
15
|
from mcp_agent.agents.agent import Agent
|
16
16
|
from mcp_agent.agents.base_agent import BaseAgent
|
17
|
+
from mcp_agent.core.agent_types import AgentType
|
17
18
|
from mcp_agent.core.exceptions import AgentConfigError
|
18
19
|
from mcp_agent.core.prompt import Prompt
|
19
20
|
from mcp_agent.core.request_params import RequestParams
|
@@ -63,6 +64,11 @@ class EvaluatorOptimizerAgent(BaseAgent):
|
|
63
64
|
for refinement, continuing until a quality threshold is reached or a maximum
|
64
65
|
number of refinement cycles is completed.
|
65
66
|
"""
|
67
|
+
|
68
|
+
@property
|
69
|
+
def agent_type(self) -> str:
|
70
|
+
"""Return the type of this agent."""
|
71
|
+
return AgentType.EVALUATOR_OPTIMIZER.value
|
66
72
|
|
67
73
|
def __init__(
|
68
74
|
self,
|
@@ -27,7 +27,7 @@ from mcp_agent.agents.workflow.orchestrator_prompts import (
|
|
27
27
|
SYNTHESIZE_PLAN_PROMPT_TEMPLATE,
|
28
28
|
TASK_PROMPT_TEMPLATE,
|
29
29
|
)
|
30
|
-
from mcp_agent.core.agent_types import AgentConfig
|
30
|
+
from mcp_agent.core.agent_types import AgentConfig, AgentType
|
31
31
|
from mcp_agent.core.exceptions import AgentConfigError
|
32
32
|
from mcp_agent.core.prompt import Prompt
|
33
33
|
from mcp_agent.core.request_params import RequestParams
|
@@ -46,6 +46,11 @@ class OrchestratorAgent(BaseAgent):
|
|
46
46
|
to specialized worker agents, synthesizing their results into a cohesive output.
|
47
47
|
Supports both full planning and iterative planning modes.
|
48
48
|
"""
|
49
|
+
|
50
|
+
@property
|
51
|
+
def agent_type(self) -> str:
|
52
|
+
"""Return the type of this agent."""
|
53
|
+
return AgentType.ORCHESTRATOR.value
|
49
54
|
|
50
55
|
def __init__(
|
51
56
|
self,
|
@@ -3,8 +3,9 @@ from typing import Any, List, Optional, Tuple
|
|
3
3
|
|
4
4
|
from mcp.types import TextContent
|
5
5
|
|
6
|
-
from mcp_agent.agents.agent import Agent
|
6
|
+
from mcp_agent.agents.agent import Agent
|
7
7
|
from mcp_agent.agents.base_agent import BaseAgent
|
8
|
+
from mcp_agent.core.agent_types import AgentConfig, AgentType
|
8
9
|
from mcp_agent.core.request_params import RequestParams
|
9
10
|
from mcp_agent.mcp.interfaces import ModelT
|
10
11
|
from mcp_agent.mcp.prompt_message_multipart import PromptMessageMultipart
|
@@ -17,6 +18,11 @@ class ParallelAgent(BaseAgent):
|
|
17
18
|
This workflow performs both the fan-out and fan-in operations using LLMs.
|
18
19
|
From the user's perspective, an input is specified and the output is returned.
|
19
20
|
"""
|
21
|
+
|
22
|
+
@property
|
23
|
+
def agent_type(self) -> str:
|
24
|
+
"""Return the type of this agent."""
|
25
|
+
return AgentType.PARALLEL.value
|
20
26
|
|
21
27
|
def __init__(
|
22
28
|
self,
|
@@ -12,7 +12,7 @@ from pydantic import BaseModel
|
|
12
12
|
|
13
13
|
from mcp_agent.agents.agent import Agent
|
14
14
|
from mcp_agent.agents.base_agent import BaseAgent
|
15
|
-
from mcp_agent.core.agent_types import AgentConfig
|
15
|
+
from mcp_agent.core.agent_types import AgentConfig, AgentType
|
16
16
|
from mcp_agent.core.exceptions import AgentConfigError
|
17
17
|
from mcp_agent.core.prompt import Prompt
|
18
18
|
from mcp_agent.core.request_params import RequestParams
|
@@ -53,7 +53,7 @@ You are a highly accurate request router that directs incoming requests to the m
|
|
53
53
|
Your task is to analyze the request and determine the most appropriate agent from the options above.
|
54
54
|
|
55
55
|
<fastagent:instruction>
|
56
|
-
Respond in JSON format. NEVER include Code Fences:
|
56
|
+
Respond in JSON format. ONLY include JSON (no explanation). NEVER include Code Fences:
|
57
57
|
{{
|
58
58
|
"agent": "<agent name>",
|
59
59
|
"confidence": "<high, medium or low>",
|
@@ -87,6 +87,11 @@ class RouterAgent(BaseAgent):
|
|
87
87
|
A simplified router that uses an LLM to determine the best agent for a request,
|
88
88
|
then dispatches the request to that agent and returns the response.
|
89
89
|
"""
|
90
|
+
|
91
|
+
@property
|
92
|
+
def agent_type(self) -> str:
|
93
|
+
"""Return the type of this agent."""
|
94
|
+
return AgentType.ROUTER.value
|
90
95
|
|
91
96
|
def __init__(
|
92
97
|
self,
|
mcp_agent/cli/commands/setup.py
CHANGED
@@ -73,7 +73,7 @@ mcp:
|
|
73
73
|
|
74
74
|
GITIGNORE_TEMPLATE = """
|
75
75
|
# FastAgent secrets file
|
76
|
-
fastagent
|
76
|
+
fastagent.secrets.yaml
|
77
77
|
|
78
78
|
# Python
|
79
79
|
__pycache__/
|
@@ -215,7 +215,7 @@ def init(
|
|
215
215
|
if "fastagent.secrets.yaml" in created:
|
216
216
|
console.print("\n[yellow]Important:[/yellow] Remember to:")
|
217
217
|
console.print(
|
218
|
-
"1. Add your API keys to fastagent
|
218
|
+
"1. Add your API keys to fastagent.secrets.yaml or set OPENAI_API_KEY and ANTHROPIC_API_KEY environment variables"
|
219
219
|
)
|
220
220
|
console.print(
|
221
221
|
"2. Keep fastagent.secrets.yaml secure and never commit it to version control"
|
mcp_agent/core/agent_app.py
CHANGED
@@ -69,7 +69,7 @@ class AgentApp:
|
|
69
69
|
if message:
|
70
70
|
return await self._agent(agent_name).send(message)
|
71
71
|
|
72
|
-
return await self.interactive(
|
72
|
+
return await self.interactive(agent=agent_name, default_prompt=default_prompt)
|
73
73
|
|
74
74
|
async def send(
|
75
75
|
self,
|
@@ -220,9 +220,9 @@ class AgentApp:
|
|
220
220
|
"""
|
221
221
|
Deprecated - use interactive() instead.
|
222
222
|
"""
|
223
|
-
return await self.interactive(
|
223
|
+
return await self.interactive(agent=agent_name, default_prompt=default_prompt)
|
224
224
|
|
225
|
-
async def interactive(self,
|
225
|
+
async def interactive(self, agent: str | None = None, default_prompt: str = "") -> str:
|
226
226
|
"""
|
227
227
|
Interactive prompt for sending messages with advanced features.
|
228
228
|
|
@@ -235,11 +235,11 @@ class AgentApp:
|
|
235
235
|
"""
|
236
236
|
|
237
237
|
# Get the default agent name if none specified
|
238
|
-
if
|
238
|
+
if agent:
|
239
239
|
# Validate that this agent exists
|
240
|
-
if
|
241
|
-
raise ValueError(f"Agent '{
|
242
|
-
target_name =
|
240
|
+
if agent not in self._agents:
|
241
|
+
raise ValueError(f"Agent '{agent}' not found")
|
242
|
+
target_name = agent
|
243
243
|
else:
|
244
244
|
# Use the first agent's name as default
|
245
245
|
target_name = next(iter(self._agents.keys()))
|
@@ -248,18 +248,7 @@ class AgentApp:
|
|
248
248
|
# The agent's prompt method doesn't fully support switching between agents
|
249
249
|
|
250
250
|
# Create agent_types dictionary mapping agent names to their types
|
251
|
-
agent_types = {}
|
252
|
-
for name, agent in self._agents.items():
|
253
|
-
# Determine agent type if possible
|
254
|
-
agent_type = "Agent" # Default type
|
255
|
-
|
256
|
-
# Try to get the type from the agent directly
|
257
|
-
if hasattr(agent, "agent_type"):
|
258
|
-
agent_type = agent.agent_type
|
259
|
-
elif hasattr(agent, "config") and hasattr(agent.config, "agent_type"):
|
260
|
-
agent_type = agent.config.agent_type
|
261
|
-
|
262
|
-
agent_types[name] = agent_type
|
251
|
+
agent_types = {name: agent.agent_type for name, agent in self._agents.items()}
|
263
252
|
|
264
253
|
# Create the interactive prompt
|
265
254
|
prompt = InteractivePrompt(agent_types=agent_types)
|
mcp_agent/core/agent_types.py
CHANGED
@@ -33,6 +33,7 @@ class AgentConfig:
|
|
33
33
|
use_history: bool = True
|
34
34
|
default_request_params: RequestParams | None = None
|
35
35
|
human_input: bool = False
|
36
|
+
agent_type: str = AgentType.BASIC.value
|
36
37
|
|
37
38
|
def __post_init__(self) -> None:
|
38
39
|
"""Ensure default_request_params exists with proper history setting"""
|
@@ -269,6 +269,7 @@ def router(
|
|
269
269
|
*,
|
270
270
|
agents: List[str],
|
271
271
|
instruction: Optional[str] = None,
|
272
|
+
servers: List[str] = [],
|
272
273
|
model: Optional[str] = None,
|
273
274
|
use_history: bool = False,
|
274
275
|
request_params: RequestParams | None = None,
|
@@ -301,7 +302,7 @@ def router(
|
|
301
302
|
AgentType.ROUTER,
|
302
303
|
name=name,
|
303
304
|
instruction=instruction or default_instruction,
|
304
|
-
servers=
|
305
|
+
servers=servers,
|
305
306
|
model=model,
|
306
307
|
use_history=use_history,
|
307
308
|
request_params=request_params,
|
mcp_agent/core/direct_factory.py
CHANGED
@@ -236,7 +236,7 @@ async def create_agents_by_type(
|
|
236
236
|
config=config,
|
237
237
|
context=app_instance.context,
|
238
238
|
agents=router_agents,
|
239
|
-
routing_instruction=agent_data.get("
|
239
|
+
routing_instruction=agent_data.get("instruction"),
|
240
240
|
)
|
241
241
|
await router.initialize()
|
242
242
|
|
@@ -77,7 +77,7 @@ class InteractivePrompt:
|
|
77
77
|
if agent not in available_agents:
|
78
78
|
raise ValueError(f"No agent named '{agent}'")
|
79
79
|
|
80
|
-
#
|
80
|
+
# Ensure we track available agents in a set for fast lookup
|
81
81
|
available_agents_set = set(available_agents)
|
82
82
|
|
83
83
|
result = ""
|
mcp_agent/llm/augmented_llm.py
CHANGED
@@ -147,7 +147,7 @@ class AugmentedLLM(ContextDependent, AugmentedLLMProtocol, Generic[MessageParamT
|
|
147
147
|
"""Apply the prompt and return the result as a Pydantic model, or None if coercion fails"""
|
148
148
|
try:
|
149
149
|
result: PromptMessageMultipart = await self.generate(prompt, request_params)
|
150
|
-
json_data = from_json(result.first_text(), allow_partial=True)
|
150
|
+
json_data = from_json(result.first_text().strip(), allow_partial=True)
|
151
151
|
validated_model = model.model_validate(json_data)
|
152
152
|
return cast("ModelT", validated_model), Prompt.assistant(json_data)
|
153
153
|
except Exception as e:
|
mcp_agent/mcp/interfaces.py
CHANGED
@@ -136,6 +136,11 @@ class AgentProtocol(AugmentedLLMProtocol, Protocol):
|
|
136
136
|
|
137
137
|
name: str
|
138
138
|
|
139
|
+
@property
|
140
|
+
def agent_type(self) -> str:
|
141
|
+
"""Return the type of this agent"""
|
142
|
+
...
|
143
|
+
|
139
144
|
async def __call__(self, message: Union[str, PromptMessage, PromptMessageMultipart]) -> str:
|
140
145
|
"""Make the agent callable for sending messages directly."""
|
141
146
|
...
|
@@ -38,7 +38,7 @@ class AgentMCPServer:
|
|
38
38
|
|
39
39
|
# Basic send message tool
|
40
40
|
@self.mcp_server.tool(
|
41
|
-
name=f"{agent_name}
|
41
|
+
name=f"{agent_name}_send",
|
42
42
|
description=f"Send a message to the {agent_name} agent",
|
43
43
|
)
|
44
44
|
async def send_message(message: str, ctx: MCPContext) -> str:
|
@@ -58,23 +58,23 @@ class AgentMCPServer:
|
|
58
58
|
return await execute_send()
|
59
59
|
|
60
60
|
# Register a history prompt for this agent
|
61
|
-
@self.mcp_server.prompt(
|
61
|
+
@self.mcp_server.prompt(
|
62
|
+
name=f"{agent_name}_history",
|
63
|
+
description=f"Conversation history for the {agent_name} agent",
|
64
|
+
)
|
62
65
|
async def get_history_prompt() -> list:
|
63
66
|
"""Return the conversation history as MCP messages."""
|
64
67
|
# Get the conversation history from the agent's LLM
|
65
68
|
if not hasattr(agent, "_llm") or agent._llm is None:
|
66
69
|
return []
|
67
|
-
|
70
|
+
|
68
71
|
# Convert the multipart message history to standard PromptMessages
|
69
72
|
multipart_history = agent._llm.message_history
|
70
73
|
prompt_messages = mcp_agent.core.prompt.Prompt.from_multipart(multipart_history)
|
71
|
-
|
74
|
+
|
72
75
|
# In FastMCP, we need to return the raw list of messages
|
73
76
|
# that matches the structure that FastMCP expects (list of dicts with role/content)
|
74
|
-
return [
|
75
|
-
{"role": msg.role, "content": msg.content}
|
76
|
-
for msg in prompt_messages
|
77
|
-
]
|
77
|
+
return [{"role": msg.role, "content": msg.content} for msg in prompt_messages]
|
78
78
|
|
79
79
|
def run(self, transport: str = "sse", host: str = "0.0.0.0", port: int = 8000) -> None:
|
80
80
|
"""Run the MCP server."""
|
File without changes
|
File without changes
|
File without changes
|