fast-agent-mcp 0.1.8__py3-none-any.whl → 0.1.10__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.1.8.dist-info → fast_agent_mcp-0.1.10.dist-info}/METADATA +27 -4
- {fast_agent_mcp-0.1.8.dist-info → fast_agent_mcp-0.1.10.dist-info}/RECORD +51 -30
- {fast_agent_mcp-0.1.8.dist-info → fast_agent_mcp-0.1.10.dist-info}/entry_points.txt +1 -0
- mcp_agent/agents/agent.py +114 -8
- mcp_agent/context.py +0 -2
- mcp_agent/core/agent_app.py +89 -13
- mcp_agent/core/factory.py +14 -13
- mcp_agent/core/fastagent.py +15 -5
- mcp_agent/core/mcp_content.py +222 -0
- mcp_agent/core/prompt.py +132 -0
- mcp_agent/core/proxies.py +79 -36
- mcp_agent/logging/listeners.py +3 -6
- mcp_agent/logging/transport.py +30 -3
- mcp_agent/mcp/mcp_agent_client_session.py +21 -145
- mcp_agent/mcp/mcp_aggregator.py +61 -12
- mcp_agent/mcp/mcp_connection_manager.py +0 -1
- mcp_agent/mcp/mime_utils.py +69 -0
- mcp_agent/mcp/prompt_message_multipart.py +64 -0
- mcp_agent/mcp/prompt_serialization.py +447 -0
- mcp_agent/mcp/prompts/__init__.py +0 -0
- mcp_agent/mcp/prompts/__main__.py +10 -0
- mcp_agent/mcp/prompts/prompt_server.py +509 -0
- mcp_agent/mcp/prompts/prompt_template.py +469 -0
- mcp_agent/mcp/resource_utils.py +223 -0
- mcp_agent/mcp/stdio.py +23 -15
- mcp_agent/mcp_server_registry.py +5 -2
- mcp_agent/resources/examples/internal/agent.py +1 -1
- mcp_agent/resources/examples/internal/fastagent.config.yaml +2 -2
- mcp_agent/resources/examples/internal/sizer.py +0 -5
- mcp_agent/resources/examples/prompting/__init__.py +3 -0
- mcp_agent/resources/examples/prompting/agent.py +23 -0
- mcp_agent/resources/examples/prompting/fastagent.config.yaml +44 -0
- mcp_agent/resources/examples/prompting/image_server.py +56 -0
- mcp_agent/resources/examples/workflows/orchestrator.py +3 -3
- mcp_agent/workflows/llm/anthropic_utils.py +101 -0
- mcp_agent/workflows/llm/augmented_llm.py +139 -66
- mcp_agent/workflows/llm/augmented_llm_anthropic.py +127 -251
- mcp_agent/workflows/llm/augmented_llm_openai.py +149 -305
- mcp_agent/workflows/llm/augmented_llm_passthrough.py +99 -1
- mcp_agent/workflows/llm/augmented_llm_playback.py +109 -0
- mcp_agent/workflows/llm/model_factory.py +20 -3
- mcp_agent/workflows/llm/openai_utils.py +65 -0
- mcp_agent/workflows/llm/providers/__init__.py +8 -0
- mcp_agent/workflows/llm/providers/multipart_converter_anthropic.py +348 -0
- mcp_agent/workflows/llm/providers/multipart_converter_openai.py +426 -0
- mcp_agent/workflows/llm/providers/openai_multipart.py +197 -0
- mcp_agent/workflows/llm/providers/sampling_converter_anthropic.py +258 -0
- mcp_agent/workflows/llm/providers/sampling_converter_openai.py +229 -0
- mcp_agent/workflows/llm/sampling_format_converter.py +39 -0
- mcp_agent/core/server_validation.py +0 -44
- mcp_agent/core/simulator_registry.py +0 -22
- mcp_agent/workflows/llm/enhanced_passthrough.py +0 -70
- {fast_agent_mcp-0.1.8.dist-info → fast_agent_mcp-0.1.10.dist-info}/WHEEL +0 -0
- {fast_agent_mcp-0.1.8.dist-info → fast_agent_mcp-0.1.10.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.10
|
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
|
@@ -212,7 +212,7 @@ Requires-Python: >=3.10
|
|
212
212
|
Requires-Dist: aiohttp>=3.11.13
|
213
213
|
Requires-Dist: anthropic>=0.49.0
|
214
214
|
Requires-Dist: fastapi>=0.115.6
|
215
|
-
Requires-Dist: mcp
|
215
|
+
Requires-Dist: mcp>=1.4.1
|
216
216
|
Requires-Dist: numpy>=2.2.1
|
217
217
|
Requires-Dist: openai>=1.63.2
|
218
218
|
Requires-Dist: opentelemetry-distro>=0.50b0
|
@@ -259,6 +259,11 @@ The simple declarative syntax lets you concentrate on composing your Prompts and
|
|
259
259
|
|
260
260
|
Evaluate how different models handle Agent and MCP Server calling tasks, then build multi-model workflows using the best provider for each task.
|
261
261
|
|
262
|
+
`fast-agent` is now multi-modal, supporting Images and PDFs for both Anthropic and OpenAI endpoints (for supported models), via Prompts, Resources and MCP Tool Call results.
|
263
|
+
|
264
|
+
> [!TIP]
|
265
|
+
> `fast-agent` is now MCP Native! Coming Soon - Full Documentation Site.
|
266
|
+
|
262
267
|
### Agent Application Development
|
263
268
|
|
264
269
|
Prompts and configurations that define your Agent Applications are stored in simple files, with minimal boilerplate, enabling simple management and version control.
|
@@ -588,6 +593,19 @@ agent["greeter"].send("Good Evening!") # Dictionary access is supported
|
|
588
593
|
)
|
589
594
|
```
|
590
595
|
|
596
|
+
### Multimodal Support
|
597
|
+
|
598
|
+
Add Resources to prompts using either the inbuilt `prompt-server` or MCP Types directly. Convenience class are made available to do so simply, for example:
|
599
|
+
|
600
|
+
#### MCP Tool Result Conversion
|
601
|
+
|
602
|
+
LLM APIs have restrictions on the content types that can be returned as Tool Calls/Function results via their Chat Completions API's:
|
603
|
+
|
604
|
+
- OpenAI supports Text
|
605
|
+
- Anthropic supports Text and Image
|
606
|
+
|
607
|
+
For MCP Tool Results, `ImageResources` and `EmbeddedResources` are converted to User Messages and added to the conversation.
|
608
|
+
|
591
609
|
### Prompts
|
592
610
|
|
593
611
|
MCP Prompts are supported with `apply_prompt(name,arguments)`, which always returns an Assistant Message. If the last message from the MCP Server is a 'User' message, it is sent to the LLM for processing. Prompts applied to the Agent's Context are retained - meaning that with `use_history=False`, Agents can act as finely tuned responders.
|
@@ -605,8 +623,9 @@ Prompts can also be applied interactively through the interactive interface by u
|
|
605
623
|
|
606
624
|
### llmindset.co.uk fork:
|
607
625
|
|
626
|
+
- Addition of MCP Prompts including Prompt Server and agent save/replay ability.
|
608
627
|
- Overhaul of Eval/Opt for Conversation Management
|
609
|
-
-
|
628
|
+
- Removed instructor/double-llm calling - native structured outputs for OAI.
|
610
629
|
- Improved handling of Parallel/Fan-In and respose option
|
611
630
|
- XML based generated prompts
|
612
631
|
- "FastAgent" style prototyping, with per-agent models
|
@@ -625,4 +644,8 @@ Prompts can also be applied interactively through the interactive interface by u
|
|
625
644
|
- Declarative workflows
|
626
645
|
- Numerous defect fixes
|
627
646
|
|
628
|
-
### Features to add
|
647
|
+
### Features to add (Commmitted)
|
648
|
+
|
649
|
+
- Run Agent as MCP Server, with interop
|
650
|
+
- Multi-part content types supporing Vision, PDF and multi-part Text.
|
651
|
+
- Improved test automation (supported by prompt_server.py and augmented_llm_playback.py)
|
@@ -2,13 +2,13 @@ mcp_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
mcp_agent/app.py,sha256=0_C1xmNZlk9qZoewnNI_mC7sSfO9oJgkOyiKkQ62MHU,10606
|
3
3
|
mcp_agent/config.py,sha256=OpPTsk9gNm2IA1laUomAMkGA-pAlp5uILQpEPBjavQs,10644
|
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=m1S5M9a2Kdxy5rEGG6Uwwmi19bDEpU6u-e5ZgPmVXfY,8031
|
6
6
|
mcp_agent/context_dependent.py,sha256=TGqRLzYCOnsWGoaD1HtrliYtWo8MeaWCQk6ePUmyYCw,1446
|
7
7
|
mcp_agent/event_progress.py,sha256=25iz0yyg-O4glMmtijcYpDdUmtUIKsCmR_8A52GgeC4,2716
|
8
|
-
mcp_agent/mcp_server_registry.py,sha256=
|
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=qI3njT8SPTLKzCwBfdlWNMVoSEwLGNjuq6owPfhvIas,17444
|
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,18 +17,18 @@ 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=
|
20
|
+
mcp_agent/core/agent_app.py,sha256=6fzvExSmVSXyNo-Rq9Xvu0qUKjKHKjOpuhRfzCthV8o,29735
|
21
21
|
mcp_agent/core/agent_types.py,sha256=yKiMbv9QO2dduq4zXmoMZlOZpXJZhM4oNwIq1-134FE,318
|
22
22
|
mcp_agent/core/agent_utils.py,sha256=QMvwmxZyCqYhBzSyL9xARsxTuwdmlyjQvrPpsH36HnQ,1888
|
23
23
|
mcp_agent/core/decorators.py,sha256=dkAah1eIuYsEfQISDryG0u2GrzNnsO_jyN7lhpQfNlM,16191
|
24
24
|
mcp_agent/core/enhanced_prompt.py,sha256=bykUEnnc1CEWODJwXvl4VGfCtrJPtVXU0D4mUglJK7A,18827
|
25
25
|
mcp_agent/core/error_handling.py,sha256=D3HMW5odrbJvaKqcpCGj6eDXrbFcuqYaCZz7fyYiTu4,623
|
26
26
|
mcp_agent/core/exceptions.py,sha256=a2-JGRwFFRoQEPuAq0JC5PhAJ5TO3xVJfdS4-VN29cw,2225
|
27
|
-
mcp_agent/core/factory.py,sha256=
|
28
|
-
mcp_agent/core/fastagent.py,sha256=
|
29
|
-
mcp_agent/core/
|
30
|
-
mcp_agent/core/
|
31
|
-
mcp_agent/core/
|
27
|
+
mcp_agent/core/factory.py,sha256=MhlYS0G0IyFy_j46HVJdjEznJzfCFjx_NRhUPcbQIJI,19081
|
28
|
+
mcp_agent/core/fastagent.py,sha256=jJmO0DryFGwSkse_3q5Ll-5XONDvj7k_Oeb-ETBKFkA,19620
|
29
|
+
mcp_agent/core/mcp_content.py,sha256=rXT2C5gP9qgC-TI5F362ZLJi_erzcEOnlP9D2ZKK0i0,6860
|
30
|
+
mcp_agent/core/prompt.py,sha256=R-X3kptu3ehV_SQeiGnP6F9HMN-92I8e73gnkQ1tDVs,4317
|
31
|
+
mcp_agent/core/proxies.py,sha256=a5tNv-EVcv67XNAkbzaybQVbRgkNEfhIkcveS1LBp2s,10242
|
32
32
|
mcp_agent/core/types.py,sha256=Zhi9iW7uiOfdpSt9NC0FCtGRFtJPg4mpZPK2aYi7a7M,817
|
33
33
|
mcp_agent/core/validation.py,sha256=x0fsx5eLTawASFm9MDtEukwGOj_RTdY1OW064UihMR8,8309
|
34
34
|
mcp_agent/eval/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -45,33 +45,45 @@ mcp_agent/human_input/types.py,sha256=ZvuDHvI0-wO2tFoS0bzrv8U5B83zYdxAG7g9G9jCxu
|
|
45
45
|
mcp_agent/logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
46
46
|
mcp_agent/logging/events.py,sha256=qfYJnrqgXdujV-nl-iOwBEBh6HMraowBI4zeAWPPU4A,3461
|
47
47
|
mcp_agent/logging/json_serializer.py,sha256=pa_mf0i0YKpLsGq3THuITFUdAbmae-dv1OPOLbcS0to,5782
|
48
|
-
mcp_agent/logging/listeners.py,sha256=
|
48
|
+
mcp_agent/logging/listeners.py,sha256=1DOc0CvAE6pFxOljfZqs2TGgF50sZZGMDt4Gm_PAjWo,6551
|
49
49
|
mcp_agent/logging/logger.py,sha256=Tr009BnfGUKuZcdinnSin0Z_zIsfDNGdcnamw2rDHRQ,10604
|
50
50
|
mcp_agent/logging/rich_progress.py,sha256=IEVFdFGA0nwg6pSt9Ydni5LCNYZZPKYMe-6DCi9pO4Y,4851
|
51
51
|
mcp_agent/logging/tracing.py,sha256=jQivxKYl870oXakmyUk7TXuTQSvsIzpHwZlSQfy4b0c,5203
|
52
|
-
mcp_agent/logging/transport.py,sha256=
|
52
|
+
mcp_agent/logging/transport.py,sha256=MFgiCQ-YFP0tSMhDMpZCj585vflWcMydM4oyCFduVf0,17203
|
53
53
|
mcp_agent/mcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
54
54
|
mcp_agent/mcp/gen_client.py,sha256=u0HwdJiw9YCerS5JC7JDuGgBh9oTcLd7vv9vPjwibXc,3025
|
55
55
|
mcp_agent/mcp/mcp_activity.py,sha256=CajXCFWZ2cKEX9s4-HfNVAj471ePTVs4NOkvmIh65tE,592
|
56
|
-
mcp_agent/mcp/mcp_agent_client_session.py,sha256=
|
56
|
+
mcp_agent/mcp/mcp_agent_client_session.py,sha256=lfz38wzIoMfZyH3dAgclHohOVX0tR7Y2FCE2t7CVsPw,3956
|
57
57
|
mcp_agent/mcp/mcp_agent_server.py,sha256=xP09HZTeguJi4Fq0p3fjLBP55uSYe5AdqM90xCgn9Ho,1639
|
58
|
-
mcp_agent/mcp/mcp_aggregator.py,sha256=
|
59
|
-
mcp_agent/mcp/mcp_connection_manager.py,sha256=
|
60
|
-
mcp_agent/mcp/
|
58
|
+
mcp_agent/mcp/mcp_aggregator.py,sha256=NuFslY5-0as2VAfcg6t-k3sgpX-mh3AWttuS9KHL4n4,37684
|
59
|
+
mcp_agent/mcp/mcp_connection_manager.py,sha256=PdLia-rxbhUdAdEnW7TQbkf1qeI9RR3xhQw1j11Bi6o,13612
|
60
|
+
mcp_agent/mcp/mime_utils.py,sha256=difepNR_gpb4MpMLkBRAoyhDk-AjXUHTiqKvT_VwS1o,1805
|
61
|
+
mcp_agent/mcp/prompt_message_multipart.py,sha256=U7IN0JStmy26akTXcqE4x90oWzm8xs1qa0VeKIyPKmE,1962
|
62
|
+
mcp_agent/mcp/prompt_serialization.py,sha256=StcXV7V4fqqtCmOCXGCyYXx5vpwNhL2xr3RG_awwdqI,16056
|
63
|
+
mcp_agent/mcp/resource_utils.py,sha256=G9IBWyasxKKcbq3T_fSpM6mHE8PjBargEdfQnBPrkZY,6650
|
64
|
+
mcp_agent/mcp/stdio.py,sha256=QJcxEw2CXJrhR7PHyhuwUekzaXoDng_cNjai-rdZNg0,4479
|
65
|
+
mcp_agent/mcp/prompts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
66
|
+
mcp_agent/mcp/prompts/__main__.py,sha256=gr1Tdz9fcK0EXjEuZg_BOnKUmvhYq5AH2lFZicVyNb0,237
|
67
|
+
mcp_agent/mcp/prompts/prompt_server.py,sha256=6K4FeKNW_JApWUNB055gl8UnWyC1mvtl_kPEvgUnPjk,17348
|
68
|
+
mcp_agent/mcp/prompts/prompt_template.py,sha256=NDnSVA0W1wayZHCVx27lfuVPoxlAz-FfBwiCEQG9Ixk,16324
|
61
69
|
mcp_agent/mcp_server/__init__.py,sha256=SEWyU7aSFzdSk6iTYnrQu-llji5_P5dp3TaztCt_rzo,154
|
62
70
|
mcp_agent/mcp_server/agent_server.py,sha256=SUBggPyrzWtBRUC5xIMpCxu6ei-6Vah3q9Si12BQ-zY,4444
|
63
71
|
mcp_agent/resources/examples/data-analysis/analysis-campaign.py,sha256=EG-HhaDHltZ4hHAqhgfX_pHM2wem48aYhSIKJxyWHKc,7269
|
64
72
|
mcp_agent/resources/examples/data-analysis/analysis.py,sha256=5zLoioZQNKUfXt1EXLrGX3TU06-0N06-L9Gtp9BIr6k,2611
|
65
73
|
mcp_agent/resources/examples/data-analysis/fastagent.config.yaml,sha256=ini94PHyJCfgpjcjHKMMbGuHs6LIj46F1NwY0ll5HVk,1609
|
66
74
|
mcp_agent/resources/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-Attrition.csv,sha256=pcMeOL1_r8m8MziE6xgbBrQbjl5Ijo98yycZn7O-dlk,227977
|
67
|
-
mcp_agent/resources/examples/internal/agent.py,sha256=
|
68
|
-
mcp_agent/resources/examples/internal/fastagent.config.yaml,sha256=
|
75
|
+
mcp_agent/resources/examples/internal/agent.py,sha256=4EXhVJcX5mw2LuDqmZL4B4SM0zxMFmMou7NCEeoVeQ0,391
|
76
|
+
mcp_agent/resources/examples/internal/fastagent.config.yaml,sha256=NF-plJ2ZMLZL8_YfdwmfsvRyafgsNEEHzsjm_p8vNlY,1858
|
69
77
|
mcp_agent/resources/examples/internal/job.py,sha256=WEKIAANMEAuKr13__rYf3PqJeTAsNB_kqYqbqVYQlUM,4093
|
70
78
|
mcp_agent/resources/examples/internal/prompt_category.py,sha256=b3tjkfrVIW1EPoDjr4mG87wlZ7D0Uju9eg6asXAYYpI,551
|
71
79
|
mcp_agent/resources/examples/internal/prompt_sizing.py,sha256=UtQ_jvwS4yMh80PHhUQXJ9WXk-fqNYlqUMNTNkZosKM,2003
|
72
|
-
mcp_agent/resources/examples/internal/sizer.py,sha256=
|
80
|
+
mcp_agent/resources/examples/internal/sizer.py,sha256=RBq1qhYVKF2_qtRdvpKpRI3XIFpZ4eyBzhVjnlip-P8,356
|
73
81
|
mcp_agent/resources/examples/internal/social.py,sha256=Cot2lg3PLhLm13gPdVFvFEN28-mm6x3-jHu2YsV4N3s,1707
|
74
82
|
mcp_agent/resources/examples/mcp_researcher/researcher-eval.py,sha256=kNPjIU-JwE0oIBQKwhv6lZsUF_SPtYVkiEEbY1ZVZxk,1807
|
83
|
+
mcp_agent/resources/examples/prompting/__init__.py,sha256=GG1zksC76L-wmerkjplWHwamelxl5vlY0YkRzgAq_v0,49
|
84
|
+
mcp_agent/resources/examples/prompting/agent.py,sha256=gG2jQnRibO8OmljoFQAs9xxhCyHLCkVxJxQkfF7ykfY,607
|
85
|
+
mcp_agent/resources/examples/prompting/fastagent.config.yaml,sha256=UR6LtCpeSIzkHsCrHJW1z-wE7AgmgKozS_IYcfcSAkc,1270
|
86
|
+
mcp_agent/resources/examples/prompting/image_server.py,sha256=-6YWtzS-K5ofHtdoOk4uC3ZBFUyVELT9Fdck1RptcWg,1711
|
75
87
|
mcp_agent/resources/examples/researcher/fastagent.config.yaml,sha256=bNOnID9OgdSBTUEhdimKB8LjaZLa1B6igmp-nxx8nr4,2271
|
76
88
|
mcp_agent/resources/examples/researcher/researcher-eval.py,sha256=0qDjxun7CZ1cZ8JTa6G1v1XcpwGSSL6-qAZ35yI1-K4,1818
|
77
89
|
mcp_agent/resources/examples/researcher/researcher-imp.py,sha256=Xfw2YAyjXd47pQz-uljgG5ii5x77fVuCP2XCivRDI48,7885
|
@@ -81,7 +93,7 @@ mcp_agent/resources/examples/workflows/chaining.py,sha256=1G_0XBcFkSJCOXb6N_iXWl
|
|
81
93
|
mcp_agent/resources/examples/workflows/evaluator.py,sha256=3XmW1mjImlaWb0c5FWHYS9yP8nVGTbEdJySAoWXwrDg,3109
|
82
94
|
mcp_agent/resources/examples/workflows/fastagent.config.yaml,sha256=k2AiapOcK42uqG2nWDVvnSLqN4okQIQZK0FTbZufBpY,809
|
83
95
|
mcp_agent/resources/examples/workflows/human_input.py,sha256=c8cBdLEPbaMXddFwsfN3Z7RFs5PZXsdrjANfvq1VTPM,605
|
84
|
-
mcp_agent/resources/examples/workflows/orchestrator.py,sha256=
|
96
|
+
mcp_agent/resources/examples/workflows/orchestrator.py,sha256=2nkRkpMgi4V-M6fwcpipQUImf0nZoGf4zfVllfojsz8,2596
|
85
97
|
mcp_agent/resources/examples/workflows/parallel.py,sha256=pLbQrtXfbdYqMVddxtg5dZnBnm5Wo2mXlIa1Vf2F1FQ,3096
|
86
98
|
mcp_agent/resources/examples/workflows/router.py,sha256=J1yTAimFY53jcyd21cq1XAZvtOxnNsmtSjSp13M5EgE,1668
|
87
99
|
mcp_agent/resources/examples/workflows/sse.py,sha256=tdmmh7p87YNfcF_fCq3evAmc1Nek0oY0YOqLRKBLqKg,570
|
@@ -104,14 +116,23 @@ mcp_agent/workflows/intent_classifier/intent_classifier_llm.py,sha256=WSLUv2Casb
|
|
104
116
|
mcp_agent/workflows/intent_classifier/intent_classifier_llm_anthropic.py,sha256=Hp4454IniWFxV4ml50Ml8ip9rS1La5FBn5pd7vm1FHA,1964
|
105
117
|
mcp_agent/workflows/intent_classifier/intent_classifier_llm_openai.py,sha256=zj76WlTYnSCYjBQ_IDi5vFBQGmNwYaoUq1rT730sY98,1940
|
106
118
|
mcp_agent/workflows/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
107
|
-
mcp_agent/workflows/llm/
|
108
|
-
mcp_agent/workflows/llm/
|
109
|
-
mcp_agent/workflows/llm/
|
110
|
-
mcp_agent/workflows/llm/
|
111
|
-
mcp_agent/workflows/llm/
|
119
|
+
mcp_agent/workflows/llm/anthropic_utils.py,sha256=OFmsVmDQ22880duDWQrEeQEB47xtvujSYJ-fNw1lhi0,3712
|
120
|
+
mcp_agent/workflows/llm/augmented_llm.py,sha256=9cWy-4yNG13w4oQgXmisgWTcm6aoJIRCYTX85Bkf-MI,30554
|
121
|
+
mcp_agent/workflows/llm/augmented_llm_anthropic.py,sha256=opV4PTai2eoYUzJS0gCPGEy4pe-lT2Eo1Sao6Y_EIiY,20140
|
122
|
+
mcp_agent/workflows/llm/augmented_llm_openai.py,sha256=OUSmvY2m6HU1JOK5nEzKDHpHReT0ffjoHDFHk6aYhoc,21002
|
123
|
+
mcp_agent/workflows/llm/augmented_llm_passthrough.py,sha256=IoMNOKK9l46bp4OxfXrB4uK7_4X7ufjuFyXSQCH4YnM,6219
|
124
|
+
mcp_agent/workflows/llm/augmented_llm_playback.py,sha256=5ypv3owJU6pscktqg9tkLQVKNgaA50e8OWmC1hAhrtE,4328
|
112
125
|
mcp_agent/workflows/llm/llm_selector.py,sha256=G7pIybuBDwtmyxUDov_QrNYH2FoI0qFRu2JfoxWUF5Y,11045
|
113
|
-
mcp_agent/workflows/llm/model_factory.py,sha256=
|
126
|
+
mcp_agent/workflows/llm/model_factory.py,sha256=UHePE5Ow03kpE44kjYtFGEhVFSYp0AY2yGri58yCBKU,7688
|
127
|
+
mcp_agent/workflows/llm/openai_utils.py,sha256=GGkJF-nazA4HWrlmMKKLf0qSfl2gbSqo-rbMDoJs5mE,1895
|
114
128
|
mcp_agent/workflows/llm/prompt_utils.py,sha256=EY3eddqnmc_YDUQJFysPnpTH6hr4r2HneeEmX76P8TQ,4948
|
129
|
+
mcp_agent/workflows/llm/sampling_format_converter.py,sha256=-vN927eMyo0vYg9GkuWAUzYqQR_kpz4BLmukgNfm2K8,1457
|
130
|
+
mcp_agent/workflows/llm/providers/__init__.py,sha256=qirdqAKIbw3BY1NBdGytH9tvpjOu0QNOqKAG2deD_U4,285
|
131
|
+
mcp_agent/workflows/llm/providers/multipart_converter_anthropic.py,sha256=TO0zHEnqnOEVfCjM-qp-DGrJoSUPRWChjUPTRo2Gt9U,13463
|
132
|
+
mcp_agent/workflows/llm/providers/multipart_converter_openai.py,sha256=IaHgR-bo5PJBd960kDJYnvinLmg0dtajg6ZXFYeLke0,17691
|
133
|
+
mcp_agent/workflows/llm/providers/openai_multipart.py,sha256=RKkwssszD6jJpZ-Hj875uu5rbePrwzN7v43Ec69Ziwg,7566
|
134
|
+
mcp_agent/workflows/llm/providers/sampling_converter_anthropic.py,sha256=vaM0QWzYP6VFAUwLLxRGpyB0erAQAJAhQed0eFT2jPQ,8916
|
135
|
+
mcp_agent/workflows/llm/providers/sampling_converter_openai.py,sha256=yUTSF9fmcy-aNVd-9yGT2kGV7F0VAkYCQK5S8eImeIs,8436
|
115
136
|
mcp_agent/workflows/orchestrator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
116
137
|
mcp_agent/workflows/orchestrator/orchestrator.py,sha256=s8-_4CG4oRnvYAwUqqyevGLpy21IYtcNtsd_SbRZ8Fk,22125
|
117
138
|
mcp_agent/workflows/orchestrator/orchestrator_models.py,sha256=1ldku1fYA_hu2F6K4l2C96mAdds05VibtSzSQrGm3yw,7321
|
@@ -130,8 +151,8 @@ mcp_agent/workflows/swarm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
130
151
|
mcp_agent/workflows/swarm/swarm.py,sha256=-lAIeSWDqbGHGRPTvjiP9nIKWvxxy9DAojl9yQzO1Pw,11050
|
131
152
|
mcp_agent/workflows/swarm/swarm_anthropic.py,sha256=pW8zFx5baUWGd5Vw3nIDF2oVOOGNorij4qvGJKdYPcs,1624
|
132
153
|
mcp_agent/workflows/swarm/swarm_openai.py,sha256=wfteywvAGkT5bLmIxX_StHJq8144whYmCRnJASAjOes,1596
|
133
|
-
fast_agent_mcp-0.1.
|
134
|
-
fast_agent_mcp-0.1.
|
135
|
-
fast_agent_mcp-0.1.
|
136
|
-
fast_agent_mcp-0.1.
|
137
|
-
fast_agent_mcp-0.1.
|
154
|
+
fast_agent_mcp-0.1.10.dist-info/METADATA,sha256=Kum2eRyw2tDXTb1rG7JIf-2IrkOC-xWOnFyQpulgXq4,29760
|
155
|
+
fast_agent_mcp-0.1.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
156
|
+
fast_agent_mcp-0.1.10.dist-info/entry_points.txt,sha256=qPM7vwtN1_KmP3dXehxgiCxUBHtqP7yfenZigztvY-w,226
|
157
|
+
fast_agent_mcp-0.1.10.dist-info/licenses/LICENSE,sha256=cN3FxDURL9XuzE5mhK9L2paZo82LTfjwCYVT7e3j0e4,10939
|
158
|
+
fast_agent_mcp-0.1.10.dist-info/RECORD,,
|
mcp_agent/agents/agent.py
CHANGED
@@ -9,7 +9,10 @@ from mcp.types import (
|
|
9
9
|
ListToolsResult,
|
10
10
|
TextContent,
|
11
11
|
Tool,
|
12
|
+
EmbeddedResource,
|
13
|
+
ReadResourceResult,
|
12
14
|
)
|
15
|
+
from mcp_agent.mcp.prompt_message_multipart import PromptMessageMultipart
|
13
16
|
|
14
17
|
from mcp_agent.core.exceptions import PromptExitError
|
15
18
|
from mcp_agent.mcp.mcp_aggregator import MCPAggregator
|
@@ -320,18 +323,25 @@ class Agent(MCPAggregator):
|
|
320
323
|
],
|
321
324
|
)
|
322
325
|
|
323
|
-
async def
|
326
|
+
async def read_resource(
|
327
|
+
self, server_name: str, resource_name: str
|
328
|
+
) -> ReadResourceResult:
|
329
|
+
return None
|
330
|
+
|
331
|
+
async def apply_prompt(
|
332
|
+
self, prompt_name: str, arguments: dict[str, str] = None
|
333
|
+
) -> str:
|
324
334
|
"""
|
325
335
|
Apply an MCP Server Prompt by name and return the assistant's response.
|
326
336
|
Will search all available servers for the prompt if not namespaced.
|
327
|
-
|
337
|
+
|
328
338
|
If the last message in the prompt is from a user, this will automatically
|
329
339
|
generate an assistant response to ensure we always end with an assistant message.
|
330
340
|
|
331
341
|
Args:
|
332
342
|
prompt_name: The name of the prompt to apply
|
333
343
|
arguments: Optional dictionary of string arguments to pass to the prompt template
|
334
|
-
|
344
|
+
|
335
345
|
Returns:
|
336
346
|
The assistant's response or error message
|
337
347
|
"""
|
@@ -358,10 +368,106 @@ class Agent(MCPAggregator):
|
|
358
368
|
result = await self._llm.apply_prompt_template(prompt_result, display_name)
|
359
369
|
return result
|
360
370
|
|
361
|
-
|
362
|
-
|
371
|
+
async def get_resource(self, server_name: str, resource_name: str):
|
372
|
+
"""
|
373
|
+
Get a resource directly from an MCP server by name.
|
374
|
+
|
375
|
+
Args:
|
376
|
+
server_name: Name of the MCP server to retrieve the resource from
|
377
|
+
resource_name: Name of the resource to retrieve
|
378
|
+
|
379
|
+
Returns:
|
380
|
+
The resource object from the MCP server
|
381
|
+
|
382
|
+
Raises:
|
383
|
+
ValueError: If the server doesn't exist or the resource couldn't be found
|
384
|
+
"""
|
385
|
+
if not self.initialized:
|
386
|
+
await self.initialize()
|
387
|
+
|
388
|
+
# Get the specified server connection
|
389
|
+
server = self.get_server(server_name)
|
390
|
+
if not server:
|
391
|
+
raise ValueError(f"Server '{server_name}' not found or not connected")
|
392
|
+
|
393
|
+
# Request the resource directly from the server
|
394
|
+
try:
|
395
|
+
resource_result = await server.get_resource(resource_name)
|
396
|
+
return resource_result
|
397
|
+
except Exception as e:
|
398
|
+
self.logger.error(
|
399
|
+
f"Error retrieving resource '{resource_name}' from server '{server_name}': {str(e)}"
|
400
|
+
)
|
401
|
+
raise ValueError(
|
402
|
+
f"Failed to retrieve resource '{resource_name}' from server '{server_name}': {str(e)}"
|
403
|
+
)
|
404
|
+
|
405
|
+
async def get_embedded_resources(
|
406
|
+
self, server_name: str, resource_name: str
|
407
|
+
) -> List[EmbeddedResource]:
|
408
|
+
"""
|
409
|
+
Get a resource from an MCP server and return it as a list of embedded resources ready for use in prompts.
|
410
|
+
|
411
|
+
Args:
|
412
|
+
server_name: Name of the MCP server to retrieve the resource from
|
413
|
+
resource_name: Name or URI of the resource to retrieve
|
414
|
+
|
415
|
+
Returns:
|
416
|
+
List of EmbeddedResource objects ready to use in a PromptMessageMultipart
|
417
|
+
|
418
|
+
Raises:
|
419
|
+
ValueError: If the server doesn't exist or the resource couldn't be found
|
363
420
|
"""
|
364
|
-
|
365
|
-
|
421
|
+
# Get the raw resource result
|
422
|
+
result: ReadResourceResult = await super().get_resource(
|
423
|
+
server_name, resource_name
|
424
|
+
)
|
425
|
+
|
426
|
+
# Convert each resource content to an EmbeddedResource
|
427
|
+
embedded_resources: List[EmbeddedResource] = []
|
428
|
+
for resource_content in result.contents:
|
429
|
+
embedded_resource = EmbeddedResource(
|
430
|
+
type="resource", resource=resource_content, annotations=None
|
431
|
+
)
|
432
|
+
embedded_resources.append(embedded_resource)
|
433
|
+
|
434
|
+
return embedded_resources
|
435
|
+
|
436
|
+
async def with_resource(
|
437
|
+
self,
|
438
|
+
prompt_content: Union[str, PromptMessageMultipart],
|
439
|
+
server_name: str,
|
440
|
+
resource_name: str,
|
441
|
+
) -> str:
|
442
|
+
"""
|
443
|
+
Create a prompt with the given content and resource, then send it to the agent.
|
444
|
+
|
445
|
+
Args:
|
446
|
+
prompt_content: Either a string message or an existing PromptMessageMultipart
|
447
|
+
server_name: Name of the MCP server to retrieve the resource from
|
448
|
+
resource_name: Name or URI of the resource to retrieve
|
449
|
+
|
450
|
+
Returns:
|
451
|
+
The agent's response as a string
|
366
452
|
"""
|
367
|
-
|
453
|
+
# Get the embedded resources
|
454
|
+
embedded_resources: List[EmbeddedResource] = await self.get_embedded_resources(
|
455
|
+
server_name, resource_name
|
456
|
+
)
|
457
|
+
|
458
|
+
# Create or update the prompt message
|
459
|
+
prompt: PromptMessageMultipart
|
460
|
+
if isinstance(prompt_content, str):
|
461
|
+
# Create a new prompt with the text and resources
|
462
|
+
content = [TextContent(type="text", text=prompt_content)]
|
463
|
+
content.extend(embedded_resources)
|
464
|
+
prompt = PromptMessageMultipart(role="user", content=content)
|
465
|
+
elif isinstance(prompt_content, PromptMessageMultipart):
|
466
|
+
# Add resources to the existing prompt
|
467
|
+
prompt = prompt_content
|
468
|
+
prompt.content.extend(embedded_resources)
|
469
|
+
else:
|
470
|
+
raise TypeError("prompt_content must be a string or PromptMessageMultipart")
|
471
|
+
|
472
|
+
# Send the prompt to the agent and return the response
|
473
|
+
return await self._llm.generate_prompt(prompt, None)
|
mcp_agent/context.py
CHANGED
@@ -24,7 +24,6 @@ from mcp_agent.executor.executor import Executor
|
|
24
24
|
from mcp_agent.executor.decorator_registry import (
|
25
25
|
DecoratorRegistry,
|
26
26
|
register_asyncio_decorators,
|
27
|
-
register_temporal_decorators,
|
28
27
|
)
|
29
28
|
from mcp_agent.executor.task_registry import ActivityRegistry
|
30
29
|
from mcp_agent.executor.executor import AsyncioExecutor
|
@@ -194,7 +193,6 @@ async def initialize_context(
|
|
194
193
|
|
195
194
|
context.decorator_registry = DecoratorRegistry()
|
196
195
|
register_asyncio_decorators(context.decorator_registry)
|
197
|
-
register_temporal_decorators(context.decorator_registry)
|
198
196
|
|
199
197
|
# Store the tracer in context if needed
|
200
198
|
context.tracer = trace.get_tracer(config.otel.service_name)
|
mcp_agent/core/agent_app.py
CHANGED
@@ -2,9 +2,10 @@
|
|
2
2
|
Main application wrapper for interacting with agents.
|
3
3
|
"""
|
4
4
|
|
5
|
-
from typing import Optional, Dict, TYPE_CHECKING
|
5
|
+
from typing import Optional, Dict, Union, TYPE_CHECKING
|
6
6
|
|
7
7
|
from mcp_agent.app import MCPApp
|
8
|
+
from mcp_agent.mcp.prompt_message_multipart import PromptMessageMultipart
|
8
9
|
from mcp_agent.progress_display import progress_display
|
9
10
|
from mcp_agent.workflows.orchestrator.orchestrator import Orchestrator
|
10
11
|
from mcp_agent.workflows.parallel.parallel_llm import ParallelLLM
|
@@ -37,16 +38,80 @@ class AgentApp:
|
|
37
38
|
# Optional: set default agent for direct calls
|
38
39
|
self._default = next(iter(agents)) if agents else None
|
39
40
|
|
40
|
-
async def
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
async def send_prompt(
|
42
|
+
self, prompt: PromptMessageMultipart, agent_name: Optional[str] = None
|
43
|
+
) -> str:
|
44
|
+
"""
|
45
|
+
Send a PromptMessageMultipart to an agent
|
46
|
+
|
47
|
+
Args:
|
48
|
+
prompt: The PromptMessageMultipart to send
|
49
|
+
agent_name: The name of the agent to send to (uses default if None)
|
50
|
+
|
51
|
+
Returns:
|
52
|
+
The agent's response as a string
|
53
|
+
"""
|
54
|
+
target = agent_name or self._default
|
55
|
+
if not target:
|
56
|
+
raise ValueError("No default agent available")
|
57
|
+
|
58
|
+
if target not in self._agents:
|
59
|
+
raise ValueError(f"No agent named '{target}'")
|
60
|
+
|
61
|
+
proxy = self._agents[target]
|
62
|
+
return await proxy.send_prompt(prompt)
|
63
|
+
|
64
|
+
async def send(
|
65
|
+
self,
|
66
|
+
message: Union[str, PromptMessageMultipart] = None,
|
67
|
+
agent_name: Optional[str] = None,
|
68
|
+
) -> str:
|
69
|
+
"""
|
70
|
+
Send a message to the default agent or specified agent
|
71
|
+
|
72
|
+
Args:
|
73
|
+
message: Either a string message or a PromptMessageMultipart object
|
74
|
+
agent_name: The name of the agent to send to (uses default if None)
|
75
|
+
|
76
|
+
Returns:
|
77
|
+
The agent's response as a string
|
78
|
+
"""
|
79
|
+
target = agent_name or self._default
|
80
|
+
if not target:
|
81
|
+
raise ValueError("No default agent available")
|
82
|
+
|
83
|
+
if target not in self._agents:
|
84
|
+
raise ValueError(f"No agent named '{target}'")
|
44
85
|
|
45
|
-
|
46
|
-
|
86
|
+
proxy = self._agents[target]
|
87
|
+
return await proxy.send(message)
|
88
|
+
|
89
|
+
async def apply_prompt(
|
90
|
+
self,
|
91
|
+
prompt_name: str,
|
92
|
+
arguments: Optional[dict[str, str]] = None,
|
93
|
+
agent_name: Optional[str] = None,
|
94
|
+
) -> str:
|
95
|
+
"""
|
96
|
+
Apply an MCP Server Prompt by name and return the assistant's response
|
47
97
|
|
48
|
-
|
49
|
-
|
98
|
+
Args:
|
99
|
+
prompt_name: The name of the prompt to apply
|
100
|
+
arguments: Optional dictionary of string arguments to pass to the prompt template
|
101
|
+
agent_name: The name of the agent to use (uses default if None)
|
102
|
+
|
103
|
+
Returns:
|
104
|
+
The assistant's response as a string
|
105
|
+
"""
|
106
|
+
target = agent_name or self._default
|
107
|
+
if not target:
|
108
|
+
raise ValueError("No default agent available")
|
109
|
+
|
110
|
+
if target not in self._agents:
|
111
|
+
raise ValueError(f"No agent named '{target}'")
|
112
|
+
|
113
|
+
proxy = self._agents[target]
|
114
|
+
return await proxy.apply_prompt(prompt_name, arguments)
|
50
115
|
|
51
116
|
async def prompt(self, agent_name: Optional[str] = None, default: str = "") -> str:
|
52
117
|
"""
|
@@ -506,7 +571,7 @@ class AgentApp:
|
|
506
571
|
if user_input == "":
|
507
572
|
continue
|
508
573
|
|
509
|
-
result = await self.send(
|
574
|
+
result = await self.send(user_input, agent)
|
510
575
|
|
511
576
|
# Check if current agent is a chain that should continue with final agent
|
512
577
|
if agent_types.get(agent) == "Chain":
|
@@ -532,10 +597,21 @@ class AgentApp:
|
|
532
597
|
return self._agents[name]
|
533
598
|
|
534
599
|
async def __call__(
|
535
|
-
self,
|
600
|
+
self,
|
601
|
+
message: Optional[Union[str, PromptMessageMultipart]] = None,
|
602
|
+
agent_name: Optional[str] = None,
|
536
603
|
) -> str:
|
537
|
-
"""
|
604
|
+
"""
|
605
|
+
Support: agent('message') or agent(Prompt.user('message'))
|
606
|
+
|
607
|
+
Args:
|
608
|
+
message: Either a string message or a PromptMessageMultipart object
|
609
|
+
agent_name: The name of the agent to use (uses default if None)
|
610
|
+
|
611
|
+
Returns:
|
612
|
+
The agent's response as a string
|
613
|
+
"""
|
538
614
|
target = agent_name or self._default
|
539
615
|
if not target:
|
540
616
|
raise ValueError("No default agent available")
|
541
|
-
return await self.send(
|
617
|
+
return await self.send(message, target)
|
mcp_agent/core/factory.py
CHANGED
@@ -172,16 +172,17 @@ async def create_agents_by_type(
|
|
172
172
|
if agent_type == AgentType.BASIC:
|
173
173
|
# Get the agent name for special handling
|
174
174
|
agent_name = agent_data["config"].name
|
175
|
-
agent = Agent(
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
model=config.model,
|
181
|
-
request_params=config.default_request_params,
|
182
|
-
)
|
183
|
-
agent._llm = await agent.attach_llm(llm_factory)
|
175
|
+
agent = Agent(
|
176
|
+
config=config,
|
177
|
+
context=app_instance.context,
|
178
|
+
)
|
179
|
+
await agent.initialize()
|
184
180
|
|
181
|
+
llm_factory = model_factory_func(
|
182
|
+
model=config.model,
|
183
|
+
request_params=config.default_request_params,
|
184
|
+
)
|
185
|
+
agent._llm = await agent.attach_llm(llm_factory)
|
185
186
|
# Store the agent
|
186
187
|
instance = agent
|
187
188
|
|
@@ -222,16 +223,16 @@ async def create_agents_by_type(
|
|
222
223
|
default_request_params=base_params,
|
223
224
|
)
|
224
225
|
planner_agent = Agent(
|
225
|
-
config=planner_config,
|
226
|
+
config=planner_config,
|
227
|
+
context=app_instance.context,
|
226
228
|
)
|
227
229
|
planner_factory = model_factory_func(
|
228
230
|
model=config.model,
|
229
231
|
request_params=config.default_request_params,
|
230
232
|
)
|
231
233
|
|
232
|
-
|
233
|
-
|
234
|
-
|
234
|
+
planner = await planner_agent.attach_llm(planner_factory)
|
235
|
+
await planner.initialize()
|
235
236
|
# Create the orchestrator with pre-configured planner
|
236
237
|
instance = Orchestrator(
|
237
238
|
name=config.name,
|
mcp_agent/core/fastagent.py
CHANGED
@@ -16,7 +16,6 @@ from contextlib import asynccontextmanager
|
|
16
16
|
from functools import partial
|
17
17
|
|
18
18
|
from mcp_agent.app import MCPApp
|
19
|
-
from mcp_agent.context_dependent import ContextDependent
|
20
19
|
from mcp_agent.config import Settings
|
21
20
|
|
22
21
|
from mcp_agent.core.agent_app import AgentApp
|
@@ -64,13 +63,18 @@ from mcp_agent.mcp_server import AgentMCPServer
|
|
64
63
|
T = TypeVar("T") # For the wrapper classes
|
65
64
|
|
66
65
|
|
67
|
-
class FastAgent
|
66
|
+
class FastAgent:
|
68
67
|
"""
|
69
68
|
A decorator-based interface for MCP Agent applications.
|
70
69
|
Provides a simplified way to create and manage agents using decorators.
|
71
70
|
"""
|
72
71
|
|
73
|
-
def __init__(
|
72
|
+
def __init__(
|
73
|
+
self,
|
74
|
+
name: str,
|
75
|
+
config_path: Optional[str] = None,
|
76
|
+
ignore_unknown_args: bool = False,
|
77
|
+
):
|
74
78
|
"""
|
75
79
|
Initialize the decorator interface.
|
76
80
|
|
@@ -101,7 +105,12 @@ class FastAgent(ContextDependent):
|
|
101
105
|
action="store_true",
|
102
106
|
help="Disable progress display, tool and message logging for cleaner output",
|
103
107
|
)
|
104
|
-
|
108
|
+
|
109
|
+
if ignore_unknown_args:
|
110
|
+
known_args, _ = parser.parse_known_args()
|
111
|
+
self.args = known_args
|
112
|
+
else:
|
113
|
+
self.args = parser.parse_args()
|
105
114
|
|
106
115
|
# Quiet mode will be handled in _load_config()
|
107
116
|
|
@@ -310,6 +319,7 @@ class FastAgent(ContextDependent):
|
|
310
319
|
"""
|
311
320
|
active_agents = {}
|
312
321
|
had_error = False
|
322
|
+
await self.app.initialize()
|
313
323
|
|
314
324
|
# Handle quiet mode by disabling logger settings after initialization
|
315
325
|
quiet_mode = hasattr(self, "args") and self.args.quiet
|
@@ -372,7 +382,7 @@ class FastAgent(ContextDependent):
|
|
372
382
|
|
373
383
|
# Create wrapper with all agents
|
374
384
|
wrapper = AgentApp(agent_app, active_agents)
|
375
|
-
|
385
|
+
|
376
386
|
# Store reference to AgentApp in MCPApp for proxies to access
|
377
387
|
agent_app._agent_app = wrapper
|
378
388
|
|