fast-agent-mcp 0.1.11__py3-none-any.whl → 0.1.12__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.
Potentially problematic release.
This version of fast-agent-mcp might be problematic. Click here for more details.
- {fast_agent_mcp-0.1.11.dist-info → fast_agent_mcp-0.1.12.dist-info}/METADATA +1 -1
- {fast_agent_mcp-0.1.11.dist-info → fast_agent_mcp-0.1.12.dist-info}/RECORD +39 -38
- mcp_agent/agents/agent.py +1 -24
- mcp_agent/app.py +0 -5
- mcp_agent/context.py +0 -2
- mcp_agent/core/agent_app.py +1 -1
- mcp_agent/core/agent_types.py +29 -2
- mcp_agent/core/decorators.py +1 -2
- mcp_agent/core/error_handling.py +1 -1
- mcp_agent/core/factory.py +2 -3
- mcp_agent/core/mcp_content.py +2 -3
- mcp_agent/core/request_params.py +43 -0
- mcp_agent/core/types.py +4 -2
- mcp_agent/core/validation.py +14 -15
- mcp_agent/logging/transport.py +2 -2
- mcp_agent/mcp/interfaces.py +37 -3
- mcp_agent/mcp/mcp_agent_client_session.py +1 -1
- mcp_agent/mcp/mcp_aggregator.py +5 -6
- mcp_agent/mcp/sampling.py +60 -53
- mcp_agent/mcp_server/__init__.py +1 -1
- mcp_agent/resources/examples/prompting/__init__.py +1 -1
- mcp_agent/ui/console_display.py +2 -2
- mcp_agent/workflows/evaluator_optimizer/evaluator_optimizer.py +2 -2
- mcp_agent/workflows/llm/augmented_llm.py +42 -102
- mcp_agent/workflows/llm/augmented_llm_anthropic.py +4 -3
- mcp_agent/workflows/llm/augmented_llm_openai.py +4 -3
- mcp_agent/workflows/llm/augmented_llm_passthrough.py +33 -4
- mcp_agent/workflows/llm/model_factory.py +1 -1
- mcp_agent/workflows/llm/prompt_utils.py +42 -28
- mcp_agent/workflows/llm/providers/multipart_converter_anthropic.py +244 -140
- mcp_agent/workflows/llm/providers/multipart_converter_openai.py +230 -185
- mcp_agent/workflows/llm/providers/sampling_converter_anthropic.py +5 -204
- mcp_agent/workflows/llm/providers/sampling_converter_openai.py +9 -207
- mcp_agent/workflows/llm/sampling_converter.py +124 -0
- mcp_agent/workflows/llm/sampling_format_converter.py +0 -17
- mcp_agent/workflows/router/router_base.py +10 -10
- mcp_agent/workflows/llm/llm_selector.py +0 -345
- {fast_agent_mcp-0.1.11.dist-info → fast_agent_mcp-0.1.12.dist-info}/WHEEL +0 -0
- {fast_agent_mcp-0.1.11.dist-info → fast_agent_mcp-0.1.12.dist-info}/entry_points.txt +0 -0
- {fast_agent_mcp-0.1.11.dist-info → fast_agent_mcp-0.1.12.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fast-agent-mcp
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.12
|
4
4
|
Summary: Define, Prompt and Test MCP enabled Agents and Workflows
|
5
5
|
Author-email: Shaun Smith <fastagent@llmindset.co.uk>, Sarmad Qadri <sarmad@lastmileai.dev>
|
6
6
|
License: Apache License
|
@@ -1,14 +1,14 @@
|
|
1
1
|
mcp_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
mcp_agent/app.py,sha256=
|
2
|
+
mcp_agent/app.py,sha256=cDHUDO6In03iq0QwkzLkIs0QyjokWF42L_fp7xwM8rE,10264
|
3
3
|
mcp_agent/config.py,sha256=cEiY_J5MqKj23KkHtzP1h04yalaGgO2OiXErduiVf2M,10890
|
4
4
|
mcp_agent/console.py,sha256=Gjf2QLFumwG1Lav__c07X_kZxxEUSkzV-1_-YbAwcwo,813
|
5
|
-
mcp_agent/context.py,sha256=
|
5
|
+
mcp_agent/context.py,sha256=iTDO_T42YWVoIv-5hUZRRRBoejmK6LFA96VRR8ECDik,7917
|
6
6
|
mcp_agent/context_dependent.py,sha256=TGqRLzYCOnsWGoaD1HtrliYtWo8MeaWCQk6ePUmyYCw,1446
|
7
7
|
mcp_agent/event_progress.py,sha256=25iz0yyg-O4glMmtijcYpDdUmtUIKsCmR_8A52GgeC4,2716
|
8
8
|
mcp_agent/mcp_server_registry.py,sha256=eQbl0usicnsNE03haxc6C_FHl_0goPAZdcb082cDIQk,9992
|
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=
|
11
|
+
mcp_agent/agents/agent.py,sha256=nThss3gP6SZv27DA1EVHK0Q1IsKKjQCN6qktosUxbSs,16668
|
12
12
|
mcp_agent/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
mcp_agent/cli/__main__.py,sha256=AVZ7tQFhU_sDOGuUGJq8ujgKtcxsYJBJwHbVaaiRDlI,166
|
14
14
|
mcp_agent/cli/main.py,sha256=DE6EZzspfzHwPK59x8vL4AIDHRQkVQ1Ja70XRGU1IQs,2753
|
@@ -17,20 +17,21 @@ mcp_agent/cli/commands/bootstrap.py,sha256=Rmwbuwl52eHfnya7fnwKk2J7nCsHpSh6irka4
|
|
17
17
|
mcp_agent/cli/commands/config.py,sha256=32YTS5jmsYAs9QzAhjkG70_daAHqOemf4XbZBBSMz6g,204
|
18
18
|
mcp_agent/cli/commands/setup.py,sha256=_SCpd6_PrixqbSaE72JQ7erIRkZnJGmh_3TvvwSzEiE,6392
|
19
19
|
mcp_agent/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
|
-
mcp_agent/core/agent_app.py,sha256=
|
21
|
-
mcp_agent/core/agent_types.py,sha256=
|
20
|
+
mcp_agent/core/agent_app.py,sha256=KSOpxu6gfCnzMGg8WvKzwtwTk0GD3cklbTUVuGQtGfA,30799
|
21
|
+
mcp_agent/core/agent_types.py,sha256=dVOImGJY5xbDFpzLk2Ib4daFsqnm7j06fJN6l34Zwg4,1255
|
22
22
|
mcp_agent/core/agent_utils.py,sha256=QMvwmxZyCqYhBzSyL9xARsxTuwdmlyjQvrPpsH36HnQ,1888
|
23
|
-
mcp_agent/core/decorators.py,sha256=
|
23
|
+
mcp_agent/core/decorators.py,sha256=SoUSctM_EdaRUlo4y1bT282TWk7eyLC-WhOjOzLZuic,16157
|
24
24
|
mcp_agent/core/enhanced_prompt.py,sha256=bykUEnnc1CEWODJwXvl4VGfCtrJPtVXU0D4mUglJK7A,18827
|
25
|
-
mcp_agent/core/error_handling.py,sha256=
|
25
|
+
mcp_agent/core/error_handling.py,sha256=xoyS2kLe0eG0bj2eSJCJ2odIhGUve2SbDR7jP-A-uRw,624
|
26
26
|
mcp_agent/core/exceptions.py,sha256=a2-JGRwFFRoQEPuAq0JC5PhAJ5TO3xVJfdS4-VN29cw,2225
|
27
|
-
mcp_agent/core/factory.py,sha256=
|
27
|
+
mcp_agent/core/factory.py,sha256=6f05_vtWjf-BgVQtHU-KNRYZWRPj8zOCqUiXENWooBY,19080
|
28
28
|
mcp_agent/core/fastagent.py,sha256=jJmO0DryFGwSkse_3q5Ll-5XONDvj7k_Oeb-ETBKFkA,19620
|
29
|
-
mcp_agent/core/mcp_content.py,sha256=
|
29
|
+
mcp_agent/core/mcp_content.py,sha256=Q-VqghkHzUht1CcWKFdyVkww9-4vAWU2PfK9PPiaXzQ,6846
|
30
30
|
mcp_agent/core/prompt.py,sha256=R-X3kptu3ehV_SQeiGnP6F9HMN-92I8e73gnkQ1tDVs,4317
|
31
31
|
mcp_agent/core/proxies.py,sha256=qsIqyJgiIh-b9ehHiZrM39YutQFJPHaHO14GOMFE1KI,10289
|
32
|
-
mcp_agent/core/
|
33
|
-
mcp_agent/core/
|
32
|
+
mcp_agent/core/request_params.py,sha256=Ewu9TihgJ3SZWFOXLG4gA-BMdCeZsdaRZl4dXz58K1o,1112
|
33
|
+
mcp_agent/core/types.py,sha256=AM6l0suJp0vtX7H58HFGelAuEzSMU1kTwVW3uC0CNvM,827
|
34
|
+
mcp_agent/core/validation.py,sha256=1UL-jtV1THdg7-45a--R9frQZSMqwX21nJ9phkz9bKc,8273
|
34
35
|
mcp_agent/eval/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
36
|
mcp_agent/executor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
37
|
mcp_agent/executor/decorator_registry.py,sha256=eONv5WvIcjKd43jVqeP7iB2EkAK-ErhdmXt6ogN0K_w,3848
|
@@ -49,26 +50,26 @@ mcp_agent/logging/listeners.py,sha256=1DOc0CvAE6pFxOljfZqs2TGgF50sZZGMDt4Gm_PAjW
|
|
49
50
|
mcp_agent/logging/logger.py,sha256=Tr009BnfGUKuZcdinnSin0Z_zIsfDNGdcnamw2rDHRQ,10604
|
50
51
|
mcp_agent/logging/rich_progress.py,sha256=IEVFdFGA0nwg6pSt9Ydni5LCNYZZPKYMe-6DCi9pO4Y,4851
|
51
52
|
mcp_agent/logging/tracing.py,sha256=jQivxKYl870oXakmyUk7TXuTQSvsIzpHwZlSQfy4b0c,5203
|
52
|
-
mcp_agent/logging/transport.py,sha256=
|
53
|
+
mcp_agent/logging/transport.py,sha256=pcAKd-2sk1jPZ2j154gxd0HrKqPndhotHLOyUydinBU,17183
|
53
54
|
mcp_agent/mcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
54
55
|
mcp_agent/mcp/gen_client.py,sha256=D92Yo088CAeuWG6M82Vlkq0H8igUTw9SwwOQinZZCkg,3052
|
55
|
-
mcp_agent/mcp/interfaces.py,sha256=
|
56
|
+
mcp_agent/mcp/interfaces.py,sha256=xkXSwW7XBhr5CmwXkVLZqKGcQ7iG9S9A9fakoXopYzw,5555
|
56
57
|
mcp_agent/mcp/mcp_activity.py,sha256=CajXCFWZ2cKEX9s4-HfNVAj471ePTVs4NOkvmIh65tE,592
|
57
|
-
mcp_agent/mcp/mcp_agent_client_session.py,sha256=
|
58
|
+
mcp_agent/mcp/mcp_agent_client_session.py,sha256=2YgbpdTAJ3uCQY182maYXf3bndYWZjBNmlGJ6r7rexU,4157
|
58
59
|
mcp_agent/mcp/mcp_agent_server.py,sha256=xP09HZTeguJi4Fq0p3fjLBP55uSYe5AdqM90xCgn9Ho,1639
|
59
|
-
mcp_agent/mcp/mcp_aggregator.py,sha256=
|
60
|
+
mcp_agent/mcp/mcp_aggregator.py,sha256=vHHwIAso0C4KDD7myJhGZJXktr5op9hamkUgKqI2EU4,37924
|
60
61
|
mcp_agent/mcp/mcp_connection_manager.py,sha256=PdLia-rxbhUdAdEnW7TQbkf1qeI9RR3xhQw1j11Bi6o,13612
|
61
62
|
mcp_agent/mcp/mime_utils.py,sha256=difepNR_gpb4MpMLkBRAoyhDk-AjXUHTiqKvT_VwS1o,1805
|
62
63
|
mcp_agent/mcp/prompt_message_multipart.py,sha256=U7IN0JStmy26akTXcqE4x90oWzm8xs1qa0VeKIyPKmE,1962
|
63
64
|
mcp_agent/mcp/prompt_serialization.py,sha256=StcXV7V4fqqtCmOCXGCyYXx5vpwNhL2xr3RG_awwdqI,16056
|
64
65
|
mcp_agent/mcp/resource_utils.py,sha256=G9IBWyasxKKcbq3T_fSpM6mHE8PjBargEdfQnBPrkZY,6650
|
65
|
-
mcp_agent/mcp/sampling.py,sha256=
|
66
|
+
mcp_agent/mcp/sampling.py,sha256=1yg7f9q9bvxJfbY1efLePwL353XGN8ITi3KdP41uve8,4514
|
66
67
|
mcp_agent/mcp/stdio.py,sha256=fZr9yVqPvmPC8pkaf95rZtw0uD8BGND0UI_cUYyuSsE,4478
|
67
68
|
mcp_agent/mcp/prompts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
68
69
|
mcp_agent/mcp/prompts/__main__.py,sha256=gr1Tdz9fcK0EXjEuZg_BOnKUmvhYq5AH2lFZicVyNb0,237
|
69
70
|
mcp_agent/mcp/prompts/prompt_server.py,sha256=6K4FeKNW_JApWUNB055gl8UnWyC1mvtl_kPEvgUnPjk,17348
|
70
71
|
mcp_agent/mcp/prompts/prompt_template.py,sha256=NDnSVA0W1wayZHCVx27lfuVPoxlAz-FfBwiCEQG9Ixk,16324
|
71
|
-
mcp_agent/mcp_server/__init__.py,sha256=
|
72
|
+
mcp_agent/mcp_server/__init__.py,sha256=zBU51ITHIEPScd9nRafnhEddsWqXRPAAvHhkrbRI2_4,155
|
72
73
|
mcp_agent/mcp_server/agent_server.py,sha256=SUBggPyrzWtBRUC5xIMpCxu6ei-6Vah3q9Si12BQ-zY,4444
|
73
74
|
mcp_agent/resources/examples/data-analysis/analysis-campaign.py,sha256=EG-HhaDHltZ4hHAqhgfX_pHM2wem48aYhSIKJxyWHKc,7269
|
74
75
|
mcp_agent/resources/examples/data-analysis/analysis.py,sha256=5zLoioZQNKUfXt1EXLrGX3TU06-0N06-L9Gtp9BIr6k,2611
|
@@ -82,7 +83,7 @@ mcp_agent/resources/examples/internal/prompt_sizing.py,sha256=UtQ_jvwS4yMh80PHhU
|
|
82
83
|
mcp_agent/resources/examples/internal/sizer.py,sha256=RBq1qhYVKF2_qtRdvpKpRI3XIFpZ4eyBzhVjnlip-P8,356
|
83
84
|
mcp_agent/resources/examples/internal/social.py,sha256=Cot2lg3PLhLm13gPdVFvFEN28-mm6x3-jHu2YsV4N3s,1707
|
84
85
|
mcp_agent/resources/examples/mcp_researcher/researcher-eval.py,sha256=kNPjIU-JwE0oIBQKwhv6lZsUF_SPtYVkiEEbY1ZVZxk,1807
|
85
|
-
mcp_agent/resources/examples/prompting/__init__.py,sha256=
|
86
|
+
mcp_agent/resources/examples/prompting/__init__.py,sha256=2GSrs9MSDIKo-uDrUI0O311F0UH0RW02ZNdvItJzjfI,50
|
86
87
|
mcp_agent/resources/examples/prompting/agent.py,sha256=gG2jQnRibO8OmljoFQAs9xxhCyHLCkVxJxQkfF7ykfY,607
|
87
88
|
mcp_agent/resources/examples/prompting/fastagent.config.yaml,sha256=UR6LtCpeSIzkHsCrHJW1z-wE7AgmgKozS_IYcfcSAkc,1270
|
88
89
|
mcp_agent/resources/examples/prompting/image_server.py,sha256=-6YWtzS-K5ofHtdoOk4uC3ZBFUyVELT9Fdck1RptcWg,1711
|
@@ -101,14 +102,14 @@ mcp_agent/resources/examples/workflows/router.py,sha256=J1yTAimFY53jcyd21cq1XAZv
|
|
101
102
|
mcp_agent/resources/examples/workflows/sse.py,sha256=tdmmh7p87YNfcF_fCq3evAmc1Nek0oY0YOqLRKBLqKg,570
|
102
103
|
mcp_agent/telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
103
104
|
mcp_agent/telemetry/usage_tracking.py,sha256=ePujKMSjPxB7k6X34DGaVlnsV1728mcWZq38OqahiCU,501
|
104
|
-
mcp_agent/ui/console_display.py,sha256=
|
105
|
+
mcp_agent/ui/console_display.py,sha256=rT017esFdxazGDIt1qxY-LdqIK677ulTMNopEQBYKfo,9718
|
105
106
|
mcp_agent/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
106
107
|
mcp_agent/workflows/embedding/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
107
108
|
mcp_agent/workflows/embedding/embedding_base.py,sha256=-c20ggQ8s7XhMxRX-WEhOgHE7vP_Ca6wtdoXlse-AAA,1681
|
108
109
|
mcp_agent/workflows/embedding/embedding_cohere.py,sha256=OKTJvKD_uEafd4c2uhR5tBjprea1nyvlJOO-3FDqOnk,1540
|
109
110
|
mcp_agent/workflows/embedding/embedding_openai.py,sha256=dntjJ5P-FSMGYuyPZC8MuCU_ehwjXw9wDfzZZuSQN1E,1480
|
110
111
|
mcp_agent/workflows/evaluator_optimizer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
111
|
-
mcp_agent/workflows/evaluator_optimizer/evaluator_optimizer.py,sha256=
|
112
|
+
mcp_agent/workflows/evaluator_optimizer/evaluator_optimizer.py,sha256=Bp3mQddGYY71sJDcgIxnmqDMcjzs9DWZHQ7P6IEp3q0,18129
|
112
113
|
mcp_agent/workflows/intent_classifier/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
113
114
|
mcp_agent/workflows/intent_classifier/intent_classifier_base.py,sha256=zTbOmq6EY_abOlme4zl28HM4RWNNS6bbHl3tF7SshJ0,4004
|
114
115
|
mcp_agent/workflows/intent_classifier/intent_classifier_embedding.py,sha256=_bWZGukc_q9LdA_Q18UoAMSzhN8tt4K_bRHNUhy7Crw,3997
|
@@ -119,22 +120,22 @@ mcp_agent/workflows/intent_classifier/intent_classifier_llm_anthropic.py,sha256=
|
|
119
120
|
mcp_agent/workflows/intent_classifier/intent_classifier_llm_openai.py,sha256=zj76WlTYnSCYjBQ_IDi5vFBQGmNwYaoUq1rT730sY98,1940
|
120
121
|
mcp_agent/workflows/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
121
122
|
mcp_agent/workflows/llm/anthropic_utils.py,sha256=OFmsVmDQ22880duDWQrEeQEB47xtvujSYJ-fNw1lhi0,3712
|
122
|
-
mcp_agent/workflows/llm/augmented_llm.py,sha256=
|
123
|
-
mcp_agent/workflows/llm/augmented_llm_anthropic.py,sha256=
|
124
|
-
mcp_agent/workflows/llm/augmented_llm_openai.py,sha256=
|
125
|
-
mcp_agent/workflows/llm/augmented_llm_passthrough.py,sha256=
|
123
|
+
mcp_agent/workflows/llm/augmented_llm.py,sha256=cMNwDp-THL6NON0-J0-IuwxlmHoxI8iIdOVIx3v31Rg,27835
|
124
|
+
mcp_agent/workflows/llm/augmented_llm_anthropic.py,sha256=WedsOlyh4Gc8omRa0SntvSW83qXje_vKEv_w7Owplzw,20165
|
125
|
+
mcp_agent/workflows/llm/augmented_llm_openai.py,sha256=65TLrvTiJCiNb2jn_1Gw6nIfD83IFwMK6HCqVXoUQUo,21027
|
126
|
+
mcp_agent/workflows/llm/augmented_llm_passthrough.py,sha256=2Qx19a24ntAdPUevHbO7RFUtXD13ne4VJtSco6WEtwg,8934
|
126
127
|
mcp_agent/workflows/llm/augmented_llm_playback.py,sha256=5ypv3owJU6pscktqg9tkLQVKNgaA50e8OWmC1hAhrtE,4328
|
127
|
-
mcp_agent/workflows/llm/
|
128
|
-
mcp_agent/workflows/llm/model_factory.py,sha256=UHePE5Ow03kpE44kjYtFGEhVFSYp0AY2yGri58yCBKU,7688
|
128
|
+
mcp_agent/workflows/llm/model_factory.py,sha256=IR8giuZ_5voBnTIpEwvpLtR1tCIdxF5K9wDnWD9ezfM,7680
|
129
129
|
mcp_agent/workflows/llm/openai_utils.py,sha256=GGkJF-nazA4HWrlmMKKLf0qSfl2gbSqo-rbMDoJs5mE,1895
|
130
|
-
mcp_agent/workflows/llm/prompt_utils.py,sha256=
|
131
|
-
mcp_agent/workflows/llm/
|
130
|
+
mcp_agent/workflows/llm/prompt_utils.py,sha256=EicXAGMLBUADRfyrsJIFF_7cDhDAccKb-ow7dAblGAA,4839
|
131
|
+
mcp_agent/workflows/llm/sampling_converter.py,sha256=0OauvVYCfHi9v57uvJ35IE91mULVAQa7tb_Q8nCo0A8,3653
|
132
|
+
mcp_agent/workflows/llm/sampling_format_converter.py,sha256=mTgmSzHye8WkOUkw-zZv9gSEV4cS_LEykVnZrUwR9x0,738
|
132
133
|
mcp_agent/workflows/llm/providers/__init__.py,sha256=qirdqAKIbw3BY1NBdGytH9tvpjOu0QNOqKAG2deD_U4,285
|
133
|
-
mcp_agent/workflows/llm/providers/multipart_converter_anthropic.py,sha256=
|
134
|
-
mcp_agent/workflows/llm/providers/multipart_converter_openai.py,sha256=
|
134
|
+
mcp_agent/workflows/llm/providers/multipart_converter_anthropic.py,sha256=5hEl_g94-uEfdfYfuLYz0A16zBwkvfDE18pkvugNwJg,16501
|
135
|
+
mcp_agent/workflows/llm/providers/multipart_converter_openai.py,sha256=Mzz4fZFgpAGAOobRHl-plpCHOSHOg2WY2Mf8n-wyeMA,16934
|
135
136
|
mcp_agent/workflows/llm/providers/openai_multipart.py,sha256=RKkwssszD6jJpZ-Hj875uu5rbePrwzN7v43Ec69Ziwg,7566
|
136
|
-
mcp_agent/workflows/llm/providers/sampling_converter_anthropic.py,sha256=
|
137
|
-
mcp_agent/workflows/llm/providers/sampling_converter_openai.py,sha256=
|
137
|
+
mcp_agent/workflows/llm/providers/sampling_converter_anthropic.py,sha256=fJuVeAv1Rdnpb59wjxEs1YbZDIeuVWh3QLnKQQ9k3MI,1628
|
138
|
+
mcp_agent/workflows/llm/providers/sampling_converter_openai.py,sha256=cjX-IlBsvsCpP2O3_Pk8I-upwjqsk05tWyZXQagfkdM,849
|
138
139
|
mcp_agent/workflows/orchestrator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
139
140
|
mcp_agent/workflows/orchestrator/orchestrator.py,sha256=s8-_4CG4oRnvYAwUqqyevGLpy21IYtcNtsd_SbRZ8Fk,22125
|
140
141
|
mcp_agent/workflows/orchestrator/orchestrator_models.py,sha256=1ldku1fYA_hu2F6K4l2C96mAdds05VibtSzSQrGm3yw,7321
|
@@ -144,7 +145,7 @@ mcp_agent/workflows/parallel/fan_in.py,sha256=EivpUL5-qftctws-tlfwmYS1QeSwr07POI
|
|
144
145
|
mcp_agent/workflows/parallel/fan_out.py,sha256=J-yezgjzAWxfueW_Qcgwoet4PFDRIh0h4m48lIbFA4c,7023
|
145
146
|
mcp_agent/workflows/parallel/parallel_llm.py,sha256=fk88DhBRAI41Ph0spe_yBtrMTSj0g47yoA-ozuOxZhE,5807
|
146
147
|
mcp_agent/workflows/router/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
147
|
-
mcp_agent/workflows/router/router_base.py,sha256=
|
148
|
+
mcp_agent/workflows/router/router_base.py,sha256=yvb-vwNLcLDJAATJjMyo56dlmFldbRtbKXt63Zj30UI,14224
|
148
149
|
mcp_agent/workflows/router/router_embedding.py,sha256=wEU49li9OqTX-Xucm0HDUFLZjlND1WuewOcQVAo0s2E,7944
|
149
150
|
mcp_agent/workflows/router/router_embedding_cohere.py,sha256=aKZVzzQfBuz0by9k0zWLAA0Db_unDIMYL4ynVzzx8C4,1975
|
150
151
|
mcp_agent/workflows/router/router_embedding_openai.py,sha256=KqW2IFLdQoAJ2lIz1X18WQJFjXF-YSFSTtsqVnp1JeI,1975
|
@@ -153,8 +154,8 @@ mcp_agent/workflows/swarm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
153
154
|
mcp_agent/workflows/swarm/swarm.py,sha256=-lAIeSWDqbGHGRPTvjiP9nIKWvxxy9DAojl9yQzO1Pw,11050
|
154
155
|
mcp_agent/workflows/swarm/swarm_anthropic.py,sha256=pW8zFx5baUWGd5Vw3nIDF2oVOOGNorij4qvGJKdYPcs,1624
|
155
156
|
mcp_agent/workflows/swarm/swarm_openai.py,sha256=wfteywvAGkT5bLmIxX_StHJq8144whYmCRnJASAjOes,1596
|
156
|
-
fast_agent_mcp-0.1.
|
157
|
-
fast_agent_mcp-0.1.
|
158
|
-
fast_agent_mcp-0.1.
|
159
|
-
fast_agent_mcp-0.1.
|
160
|
-
fast_agent_mcp-0.1.
|
157
|
+
fast_agent_mcp-0.1.12.dist-info/METADATA,sha256=jdLjF7CHODEDoDvHWxTEdtzAjZGUR3eSyRay07jguXE,29678
|
158
|
+
fast_agent_mcp-0.1.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
159
|
+
fast_agent_mcp-0.1.12.dist-info/entry_points.txt,sha256=qPM7vwtN1_KmP3dXehxgiCxUBHtqP7yfenZigztvY-w,226
|
160
|
+
fast_agent_mcp-0.1.12.dist-info/licenses/LICENSE,sha256=cN3FxDURL9XuzE5mhK9L2paZo82LTfjwCYVT7e3j0e4,10939
|
161
|
+
fast_agent_mcp-0.1.12.dist-info/RECORD,,
|
mcp_agent/agents/agent.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import asyncio
|
2
2
|
import uuid
|
3
|
-
from dataclasses import dataclass
|
4
3
|
from typing import Callable, Dict, List, Optional, TypeVar, Union, TYPE_CHECKING
|
5
4
|
|
6
5
|
from mcp.server.fastmcp.tools import Tool as FastTool
|
@@ -16,7 +15,7 @@ from mcp_agent.mcp.prompt_message_multipart import PromptMessageMultipart
|
|
16
15
|
|
17
16
|
from mcp_agent.core.exceptions import PromptExitError
|
18
17
|
from mcp_agent.mcp.mcp_aggregator import MCPAggregator
|
19
|
-
from mcp_agent.
|
18
|
+
from mcp_agent.core.agent_types import AgentConfig
|
20
19
|
from mcp_agent.human_input.types import (
|
21
20
|
HumanInputCallback,
|
22
21
|
HumanInputRequest,
|
@@ -38,28 +37,6 @@ LLM = TypeVar("LLM", bound=AugmentedLLM)
|
|
38
37
|
HUMAN_INPUT_TOOL_NAME = "__human_input__"
|
39
38
|
|
40
39
|
|
41
|
-
@dataclass
|
42
|
-
class AgentConfig:
|
43
|
-
"""Configuration for an Agent instance"""
|
44
|
-
|
45
|
-
name: str
|
46
|
-
instruction: Union[str, Callable[[Dict], str]]
|
47
|
-
servers: List[str]
|
48
|
-
model: Optional[str] = None
|
49
|
-
use_history: bool = True
|
50
|
-
default_request_params: Optional[RequestParams] = None
|
51
|
-
human_input: bool = False
|
52
|
-
|
53
|
-
def __post_init__(self):
|
54
|
-
"""Ensure default_request_params exists with proper history setting"""
|
55
|
-
|
56
|
-
if self.default_request_params is None:
|
57
|
-
self.default_request_params = RequestParams(use_history=self.use_history)
|
58
|
-
else:
|
59
|
-
# Override the request params history setting if explicitly configured
|
60
|
-
self.default_request_params.use_history = self.use_history
|
61
|
-
|
62
|
-
|
63
40
|
class Agent(MCPAggregator):
|
64
41
|
"""
|
65
42
|
An Agent is an entity that has access to a set of MCP servers and can interact with them.
|
mcp_agent/app.py
CHANGED
@@ -11,7 +11,6 @@ from mcp_agent.logging.logger import get_logger
|
|
11
11
|
from mcp_agent.executor.workflow_signal import SignalWaitCallback
|
12
12
|
from mcp_agent.human_input.types import HumanInputCallback
|
13
13
|
from mcp_agent.human_input.handler import console_input_callback
|
14
|
-
from mcp_agent.workflows.llm.llm_selector import ModelSelector
|
15
14
|
|
16
15
|
R = TypeVar("R")
|
17
16
|
|
@@ -44,7 +43,6 @@ class MCPApp:
|
|
44
43
|
human_input_callback: Optional[HumanInputCallback] = console_input_callback,
|
45
44
|
signal_notification: Optional[SignalWaitCallback] = None,
|
46
45
|
upstream_session: Optional["ServerSession"] = None,
|
47
|
-
model_selector: ModelSelector = None,
|
48
46
|
):
|
49
47
|
"""
|
50
48
|
Initialize the application with a name and optional settings.
|
@@ -55,7 +53,6 @@ class MCPApp:
|
|
55
53
|
human_input_callback: Callback for handling human input
|
56
54
|
signal_notification: Callback for getting notified on workflow signals/events.
|
57
55
|
upstream_session: Optional upstream session if the MCPApp is running as a server to an MCP client.
|
58
|
-
initialize_model_selector: Initializes the built-in ModelSelector to help with model selection. Defaults to False.
|
59
56
|
"""
|
60
57
|
self.name = name
|
61
58
|
|
@@ -64,7 +61,6 @@ class MCPApp:
|
|
64
61
|
self._human_input_callback = human_input_callback
|
65
62
|
self._signal_notification = signal_notification
|
66
63
|
self._upstream_session = upstream_session
|
67
|
-
self._model_selector = model_selector
|
68
64
|
|
69
65
|
self._workflows: Dict[str, Type] = {} # id to workflow class
|
70
66
|
self._logger = None
|
@@ -128,7 +124,6 @@ class MCPApp:
|
|
128
124
|
self._context.human_input_handler = self._human_input_callback
|
129
125
|
self._context.signal_notification = self._signal_notification
|
130
126
|
self._context.upstream_session = self._upstream_session
|
131
|
-
self._context.model_selector = self._model_selector
|
132
127
|
|
133
128
|
self._initialized = True
|
134
129
|
self.logger.info(
|
mcp_agent/context.py
CHANGED
@@ -32,7 +32,6 @@ from mcp_agent.logging.events import EventFilter
|
|
32
32
|
from mcp_agent.logging.logger import LoggingConfig
|
33
33
|
from mcp_agent.logging.transport import create_transport
|
34
34
|
from mcp_agent.mcp_server_registry import ServerRegistry
|
35
|
-
from mcp_agent.workflows.llm.llm_selector import ModelSelector
|
36
35
|
from mcp_agent.logging.logger import get_logger
|
37
36
|
|
38
37
|
|
@@ -58,7 +57,6 @@ class Context(BaseModel):
|
|
58
57
|
human_input_handler: Optional[HumanInputCallback] = None
|
59
58
|
signal_notification: Optional[SignalWaitCallback] = None
|
60
59
|
upstream_session: Optional[ServerSession] = None # TODO: saqadri - figure this out
|
61
|
-
model_selector: Optional[ModelSelector] = None
|
62
60
|
|
63
61
|
# Registries
|
64
62
|
server_registry: Optional[ServerRegistry] = None
|
mcp_agent/core/agent_app.py
CHANGED
mcp_agent/core/agent_types.py
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
"""
|
2
|
-
|
2
|
+
Type definitions for agents and agent configurations.
|
3
3
|
"""
|
4
4
|
|
5
|
+
from dataclasses import dataclass
|
5
6
|
from enum import Enum
|
7
|
+
from typing import Callable, Dict, List, Optional, Union
|
8
|
+
|
9
|
+
# Forward imports to avoid circular dependencies
|
10
|
+
from mcp_agent.core.request_params import RequestParams
|
6
11
|
|
7
12
|
|
8
13
|
class AgentType(Enum):
|
@@ -13,4 +18,26 @@ class AgentType(Enum):
|
|
13
18
|
PARALLEL = "parallel"
|
14
19
|
EVALUATOR_OPTIMIZER = "evaluator_optimizer"
|
15
20
|
ROUTER = "router"
|
16
|
-
CHAIN = "chain"
|
21
|
+
CHAIN = "chain"
|
22
|
+
|
23
|
+
|
24
|
+
@dataclass
|
25
|
+
class AgentConfig:
|
26
|
+
"""Configuration for an Agent instance"""
|
27
|
+
|
28
|
+
name: str
|
29
|
+
instruction: Union[str, Callable[[Dict], str]]
|
30
|
+
servers: List[str]
|
31
|
+
model: Optional[str] = None
|
32
|
+
use_history: bool = True
|
33
|
+
default_request_params: Optional[RequestParams] = None
|
34
|
+
human_input: bool = False
|
35
|
+
|
36
|
+
def __post_init__(self):
|
37
|
+
"""Ensure default_request_params exists with proper history setting"""
|
38
|
+
|
39
|
+
if self.default_request_params is None:
|
40
|
+
self.default_request_params = RequestParams(use_history=self.use_history)
|
41
|
+
else:
|
42
|
+
# Override the request params history setting if explicitly configured
|
43
|
+
self.default_request_params.use_history = self.use_history
|
mcp_agent/core/decorators.py
CHANGED
@@ -4,9 +4,8 @@ Contains decorator definitions extracted from fastagent.py.
|
|
4
4
|
"""
|
5
5
|
|
6
6
|
from typing import Callable, Dict, List, Optional, TypeVar, Literal
|
7
|
-
from mcp_agent.
|
7
|
+
from mcp_agent.core.agent_types import AgentConfig, AgentType
|
8
8
|
from mcp_agent.workflows.llm.augmented_llm import RequestParams
|
9
|
-
from mcp_agent.core.agent_types import AgentType
|
10
9
|
|
11
10
|
T = TypeVar("T") # For the wrapper classes
|
12
11
|
|
mcp_agent/core/error_handling.py
CHANGED
mcp_agent/core/factory.py
CHANGED
@@ -5,7 +5,8 @@ Factory functions for creating agent and workflow instances.
|
|
5
5
|
from typing import Dict, Any, Optional, TypeVar, Callable
|
6
6
|
|
7
7
|
from mcp_agent.app import MCPApp
|
8
|
-
from mcp_agent.agents.agent import Agent
|
8
|
+
from mcp_agent.agents.agent import Agent
|
9
|
+
from mcp_agent.core.agent_types import AgentConfig, AgentType
|
9
10
|
from mcp_agent.event_progress import ProgressAction
|
10
11
|
from mcp_agent.workflows.evaluator_optimizer.evaluator_optimizer import (
|
11
12
|
EvaluatorOptimizerLLM,
|
@@ -16,8 +17,6 @@ from mcp_agent.workflows.llm.model_factory import ModelFactory
|
|
16
17
|
from mcp_agent.workflows.orchestrator.orchestrator import Orchestrator
|
17
18
|
from mcp_agent.workflows.parallel.parallel_llm import ParallelLLM
|
18
19
|
from mcp_agent.workflows.router.router_llm import LLMRouter
|
19
|
-
|
20
|
-
from mcp_agent.core.agent_types import AgentType
|
21
20
|
from mcp_agent.core.exceptions import AgentConfigError
|
22
21
|
from mcp_agent.core.proxies import (
|
23
22
|
BaseAgentProxy,
|
mcp_agent/core/mcp_content.py
CHANGED
@@ -146,7 +146,6 @@ def MCPFile(
|
|
146
146
|
}
|
147
147
|
|
148
148
|
|
149
|
-
|
150
149
|
def MCPPrompt(
|
151
150
|
*content_items, role: Literal["user", "assistant"] = "user"
|
152
151
|
) -> List[dict]:
|
@@ -154,7 +153,7 @@ def MCPPrompt(
|
|
154
153
|
Create one or more prompt messages with various content types.
|
155
154
|
|
156
155
|
This function intelligently creates different content types:
|
157
|
-
- Strings become TextContent
|
156
|
+
- Strings become TextContent
|
158
157
|
- File paths with image mime types become ImageContent
|
159
158
|
- File paths with text mime types or other mime types become EmbeddedResource
|
160
159
|
- Dicts with role and content are passed through unchanged
|
@@ -180,7 +179,7 @@ def MCPPrompt(
|
|
180
179
|
# File path - determine the content type based on mime type
|
181
180
|
path_str = str(item)
|
182
181
|
mime_type = guess_mime_type(path_str)
|
183
|
-
|
182
|
+
|
184
183
|
if is_image_mime_type(mime_type):
|
185
184
|
# Image files (except SVG which is handled as text)
|
186
185
|
result.append(MCPImage(path=item, role=role))
|
@@ -0,0 +1,43 @@
|
|
1
|
+
"""
|
2
|
+
Request parameters definitions for LLM interactions.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from pydantic import Field
|
6
|
+
from mcp.types import CreateMessageRequestParams
|
7
|
+
|
8
|
+
|
9
|
+
class RequestParams(CreateMessageRequestParams):
|
10
|
+
"""
|
11
|
+
Parameters to configure the AugmentedLLM 'generate' requests.
|
12
|
+
"""
|
13
|
+
|
14
|
+
messages: None = Field(exclude=True, default=None)
|
15
|
+
"""
|
16
|
+
Ignored. 'messages' are removed from CreateMessageRequestParams
|
17
|
+
to avoid confusion with the 'message' parameter on 'generate' method.
|
18
|
+
"""
|
19
|
+
|
20
|
+
maxTokens: int = 2048
|
21
|
+
"""The maximum number of tokens to sample, as requested by the server."""
|
22
|
+
|
23
|
+
model: str | None = None
|
24
|
+
"""
|
25
|
+
The model to use for the LLM generation.
|
26
|
+
If specified, this overrides the 'modelPreferences' selection criteria.
|
27
|
+
"""
|
28
|
+
|
29
|
+
use_history: bool = True
|
30
|
+
"""
|
31
|
+
Include the message history in the generate request.
|
32
|
+
"""
|
33
|
+
|
34
|
+
max_iterations: int = 10
|
35
|
+
"""
|
36
|
+
The maximum number of iterations to run the LLM for.
|
37
|
+
"""
|
38
|
+
|
39
|
+
parallel_tool_calls: bool = True
|
40
|
+
"""
|
41
|
+
Whether to allow multiple tool calls per iteration.
|
42
|
+
Also known as multi-step tool use.
|
43
|
+
"""
|
mcp_agent/core/types.py
CHANGED
@@ -7,7 +7,9 @@ from typing import Dict, Union, TypeAlias, TYPE_CHECKING
|
|
7
7
|
from mcp_agent.agents.agent import Agent
|
8
8
|
from mcp_agent.workflows.orchestrator.orchestrator import Orchestrator
|
9
9
|
from mcp_agent.workflows.parallel.parallel_llm import ParallelLLM
|
10
|
-
from mcp_agent.workflows.evaluator_optimizer.evaluator_optimizer import
|
10
|
+
from mcp_agent.workflows.evaluator_optimizer.evaluator_optimizer import (
|
11
|
+
EvaluatorOptimizerLLM,
|
12
|
+
)
|
11
13
|
from mcp_agent.workflows.router.router_llm import LLMRouter
|
12
14
|
|
13
15
|
# Avoid circular imports
|
@@ -19,4 +21,4 @@ WorkflowType: TypeAlias = Union[
|
|
19
21
|
Orchestrator, ParallelLLM, EvaluatorOptimizerLLM, LLMRouter
|
20
22
|
]
|
21
23
|
AgentOrWorkflow: TypeAlias = Union[Agent, WorkflowType]
|
22
|
-
ProxyDict: TypeAlias = Dict[str, "BaseAgentProxy"] # Forward reference as string
|
24
|
+
ProxyDict: TypeAlias = Dict[str, "BaseAgentProxy"] # Forward reference as string
|
mcp_agent/core/validation.py
CHANGED
@@ -5,14 +5,18 @@ Validation utilities for FastAgent configuration and dependencies.
|
|
5
5
|
from typing import Dict, List, Any
|
6
6
|
from mcp_agent.core.agent_types import AgentType
|
7
7
|
from mcp_agent.workflows.llm.augmented_llm import AugmentedLLM
|
8
|
-
from mcp_agent.core.exceptions import
|
8
|
+
from mcp_agent.core.exceptions import (
|
9
|
+
ServerConfigError,
|
10
|
+
AgentConfigError,
|
11
|
+
CircularDependencyError,
|
12
|
+
)
|
9
13
|
|
10
14
|
|
11
15
|
def validate_server_references(context, agents: Dict[str, Dict[str, Any]]) -> None:
|
12
16
|
"""
|
13
17
|
Validate that all server references in agent configurations exist in config.
|
14
18
|
Raises ServerConfigError if any referenced servers are not defined.
|
15
|
-
|
19
|
+
|
16
20
|
Args:
|
17
21
|
context: Application context
|
18
22
|
agents: Dictionary of agent configurations
|
@@ -39,7 +43,7 @@ def validate_workflow_references(agents: Dict[str, Dict[str, Any]]) -> None:
|
|
39
43
|
Validate that all workflow references point to valid agents/workflows.
|
40
44
|
Also validates that referenced agents have required configuration.
|
41
45
|
Raises AgentConfigError if any validation fails.
|
42
|
-
|
46
|
+
|
43
47
|
Args:
|
44
48
|
agents: Dictionary of agent configurations
|
45
49
|
"""
|
@@ -133,11 +137,11 @@ def validate_workflow_references(agents: Dict[str, Dict[str, Any]]) -> None:
|
|
133
137
|
|
134
138
|
|
135
139
|
def get_dependencies(
|
136
|
-
name: str,
|
140
|
+
name: str,
|
137
141
|
agents: Dict[str, Dict[str, Any]],
|
138
|
-
visited: set,
|
139
|
-
path: set,
|
140
|
-
agent_type: AgentType = None
|
142
|
+
visited: set,
|
143
|
+
path: set,
|
144
|
+
agent_type: AgentType = None,
|
141
145
|
) -> List[str]:
|
142
146
|
"""
|
143
147
|
Get dependencies for an agent in topological order.
|
@@ -184,9 +188,7 @@ def get_dependencies(
|
|
184
188
|
# Get dependencies from sequence agents
|
185
189
|
sequence = config.get("sequence", config.get("agents", []))
|
186
190
|
for agent_name in sequence:
|
187
|
-
deps.extend(
|
188
|
-
get_dependencies(agent_name, agents, visited, path, agent_type)
|
189
|
-
)
|
191
|
+
deps.extend(get_dependencies(agent_name, agents, visited, path, agent_type))
|
190
192
|
|
191
193
|
# Add this agent after its dependencies
|
192
194
|
deps.append(name)
|
@@ -197,10 +199,7 @@ def get_dependencies(
|
|
197
199
|
|
198
200
|
|
199
201
|
def get_parallel_dependencies(
|
200
|
-
name: str,
|
201
|
-
agents: Dict[str, Dict[str, Any]],
|
202
|
-
visited: set,
|
203
|
-
path: set
|
202
|
+
name: str, agents: Dict[str, Dict[str, Any]], visited: set, path: set
|
204
203
|
) -> List[str]:
|
205
204
|
"""
|
206
205
|
Get dependencies for a parallel agent in topological order.
|
@@ -218,4 +217,4 @@ def get_parallel_dependencies(
|
|
218
217
|
Raises:
|
219
218
|
CircularDependencyError: If circular dependency detected
|
220
219
|
"""
|
221
|
-
return get_dependencies(name, agents, visited, path, AgentType.PARALLEL)
|
220
|
+
return get_dependencies(name, agents, visited, path, AgentType.PARALLEL)
|
mcp_agent/logging/transport.py
CHANGED
@@ -290,7 +290,7 @@ class AsyncEventBus:
|
|
290
290
|
# Update transport if provided
|
291
291
|
cls._instance.transport = transport
|
292
292
|
return cls._instance
|
293
|
-
|
293
|
+
|
294
294
|
@classmethod
|
295
295
|
def reset(cls) -> None:
|
296
296
|
"""
|
@@ -302,7 +302,7 @@ class AsyncEventBus:
|
|
302
302
|
# Signal shutdown
|
303
303
|
cls._instance._running = False
|
304
304
|
cls._instance._stop_event.set()
|
305
|
-
|
305
|
+
|
306
306
|
# Clear the singleton instance
|
307
307
|
cls._instance = None
|
308
308
|
|
mcp_agent/mcp/interfaces.py
CHANGED
@@ -4,12 +4,24 @@ This module defines protocols (interfaces) that can be used to break circular de
|
|
4
4
|
"""
|
5
5
|
|
6
6
|
from contextlib import asynccontextmanager
|
7
|
-
from typing import
|
7
|
+
from typing import (
|
8
|
+
Any,
|
9
|
+
AsyncGenerator,
|
10
|
+
Callable,
|
11
|
+
Generic,
|
12
|
+
List,
|
13
|
+
Optional,
|
14
|
+
Protocol,
|
15
|
+
Type,
|
16
|
+
TypeVar,
|
17
|
+
)
|
8
18
|
|
9
19
|
from mcp import ClientSession
|
10
20
|
from mcp.types import CreateMessageRequestParams
|
11
21
|
from pydantic import Field
|
12
22
|
|
23
|
+
from mcp_agent.mcp.prompt_message_multipart import PromptMessageMultipart
|
24
|
+
|
13
25
|
|
14
26
|
class ServerRegistryProtocol(Protocol):
|
15
27
|
"""
|
@@ -128,13 +140,35 @@ class AugmentedLLMProtocol(Protocol, Generic[MessageParamT, MessageT]):
|
|
128
140
|
) -> ModelT:
|
129
141
|
"""Request a structured LLM generation and return the result as a Pydantic model."""
|
130
142
|
|
143
|
+
async def generate_prompt(
|
144
|
+
self, prompt: PromptMessageMultipart, request_params: RequestParams | None
|
145
|
+
) -> str:
|
146
|
+
"""Request an LLM generation and return a string representation of the result"""
|
147
|
+
|
148
|
+
async def apply_prompt(
|
149
|
+
self,
|
150
|
+
multipart_messages: List["PromptMessageMultipart"],
|
151
|
+
request_params: RequestParams | None = None,
|
152
|
+
) -> str:
|
153
|
+
"""
|
154
|
+
Apply a list of PromptMessageMultipart messages directly to the LLM.
|
155
|
+
This is a cleaner interface to _apply_prompt_template_provider_specific.
|
156
|
+
|
157
|
+
Args:
|
158
|
+
multipart_messages: List of PromptMessageMultipart objects
|
159
|
+
request_params: Optional parameters to configure the LLM request
|
160
|
+
|
161
|
+
Returns:
|
162
|
+
String representation of the assistant's response
|
163
|
+
"""
|
164
|
+
|
131
165
|
|
132
166
|
class ModelFactoryClassProtocol(Protocol):
|
133
167
|
"""
|
134
168
|
Protocol defining the minimal interface of the ModelFactory class needed by sampling.
|
135
169
|
This allows sampling.py to depend on this protocol rather than the concrete ModelFactory class.
|
136
170
|
"""
|
137
|
-
|
171
|
+
|
138
172
|
@classmethod
|
139
173
|
def create_factory(
|
140
174
|
cls, model_string: str, request_params: Optional[RequestParams] = None
|
@@ -149,4 +183,4 @@ class ModelFactoryClassProtocol(Protocol):
|
|
149
183
|
Returns:
|
150
184
|
A factory function that can create an LLM instance
|
151
185
|
"""
|
152
|
-
...
|
186
|
+
...
|