fast-agent-mcp 0.1.10__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.10.dist-info → fast_agent_mcp-0.1.12.dist-info}/METADATA +36 -38
- {fast_agent_mcp-0.1.10.dist-info → fast_agent_mcp-0.1.12.dist-info}/RECORD +45 -42
- mcp_agent/agents/agent.py +1 -24
- mcp_agent/app.py +0 -5
- mcp_agent/config.py +9 -0
- mcp_agent/context.py +0 -2
- mcp_agent/core/agent_app.py +29 -0
- 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/proxies.py +3 -0
- 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/gen_client.py +4 -4
- mcp_agent/mcp/interfaces.py +186 -0
- mcp_agent/mcp/mcp_agent_client_session.py +10 -2
- mcp_agent/mcp/mcp_aggregator.py +12 -3
- mcp_agent/mcp/sampling.py +140 -0
- mcp_agent/mcp/stdio.py +1 -2
- mcp_agent/mcp_server/__init__.py +1 -1
- mcp_agent/resources/examples/internal/agent.py +1 -1
- mcp_agent/resources/examples/internal/fastagent.config.yaml +3 -0
- 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 +119 -37
- 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.10.dist-info → fast_agent_mcp-0.1.12.dist-info}/WHEEL +0 -0
- {fast_agent_mcp-0.1.10.dist-info → fast_agent_mcp-0.1.12.dist-info}/entry_points.txt +0 -0
- {fast_agent_mcp-0.1.10.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
|
@@ -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>=1.
|
215
|
+
Requires-Dist: mcp>=1.5.0
|
216
216
|
Requires-Dist: numpy>=2.2.1
|
217
217
|
Requires-Dist: openai>=1.63.2
|
218
218
|
Requires-Dist: opentelemetry-distro>=0.50b0
|
@@ -241,10 +241,9 @@ Provides-Extra: temporal
|
|
241
241
|
Requires-Dist: temporalio>=1.8.0; extra == 'temporal'
|
242
242
|
Description-Content-Type: text/markdown
|
243
243
|
|
244
|
-
## fast-agent
|
245
|
-
|
246
244
|
<p align="center">
|
247
245
|
<a href="https://pypi.org/project/fast-agent-mcp/"><img src="https://img.shields.io/pypi/v/fast-agent-mcp?color=%2334D058&label=pypi" /></a>
|
246
|
+
<a href="#"><img src="https://github.com/evalstate/fast-agent/actions/workflows/main-checks.yml/badge.svg" /></a>
|
248
247
|
<a href="https://github.com/evalstate/fast-agent/issues"><img src="https://img.shields.io/github/issues-raw/evalstate/fast-agent" /></a>
|
249
248
|
<a href="https://lmai.link/discord/mcp-agent"><img src="https://shields.io/discord/1089284610329952357" alt="discord" /></a>
|
250
249
|
<img alt="Pepy Total Downloads" src="https://img.shields.io/pepy/dt/fast-agent-mcp?label=pypi%20%7C%20downloads"/>
|
@@ -253,16 +252,14 @@ Description-Content-Type: text/markdown
|
|
253
252
|
|
254
253
|
## Overview
|
255
254
|
|
256
|
-
**`fast-agent`** enables you to create and interact with sophisticated Agents and Workflows in minutes.
|
255
|
+
**`fast-agent`** enables you to create and interact with sophisticated Agents and Workflows in minutes. It is the first framework with complete, end-to-end tested MCP Feature support including Sampling. Both Anthropic (Haiku, Sonnet, Opus) and OpenAI models (gpt-4o family, o1/o3 family) are supported.
|
257
256
|
|
258
257
|
The simple declarative syntax lets you concentrate on composing your Prompts and MCP Servers to [build effective agents](https://www.anthropic.com/research/building-effective-agents).
|
259
258
|
|
260
|
-
|
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.
|
259
|
+
`fast-agent` is multi-modal, supporting Images and PDFs for both Anthropic and OpenAI endpoints via Prompts, Resources and MCP Tool Call results. The inclusion of passthrough and playback LLMs enable rapid development and test of Python glue-code for your applications.
|
263
260
|
|
264
261
|
> [!TIP]
|
265
|
-
> `fast-agent` is now MCP Native! Coming Soon - Full Documentation Site.
|
262
|
+
> `fast-agent` is now MCP Native! Coming Soon - Full Documentation Site and Further MCP Examples.
|
266
263
|
|
267
264
|
### Agent Application Development
|
268
265
|
|
@@ -272,7 +269,7 @@ Chat with individual Agents and Components before, during and after workflow exe
|
|
272
269
|
|
273
270
|
Simple model selection makes testing Model <-> MCP Server interaction painless. You can read more about the motivation behind this project [here](https://llmindset.co.uk/resources/fast-agent/)
|
274
271
|
|
275
|
-

|
276
273
|
|
277
274
|
## Get started:
|
278
275
|
|
@@ -597,6 +594,14 @@ agent["greeter"].send("Good Evening!") # Dictionary access is supported
|
|
597
594
|
|
598
595
|
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
596
|
|
597
|
+
```python
|
598
|
+
summary: str = await agent.with_resource(
|
599
|
+
"Summarise this PDF please",
|
600
|
+
"mcp_server",
|
601
|
+
"resource://fast-agent/sample.pdf",
|
602
|
+
)
|
603
|
+
```
|
604
|
+
|
600
605
|
#### MCP Tool Result Conversion
|
601
606
|
|
602
607
|
LLM APIs have restrictions on the content types that can be returned as Tool Calls/Function results via their Chat Completions API's:
|
@@ -612,40 +617,33 @@ MCP Prompts are supported with `apply_prompt(name,arguments)`, which always retu
|
|
612
617
|
|
613
618
|
Prompts can also be applied interactively through the interactive interface by using the `/prompt` command.
|
614
619
|
|
620
|
+
### Sampling
|
621
|
+
|
622
|
+
Sampling LLMs are configured per Client/Server pair. Specify the model name in fastagent.config.yaml as follows:
|
623
|
+
|
624
|
+
```yaml
|
625
|
+
mcp:
|
626
|
+
servers:
|
627
|
+
sampling_resource:
|
628
|
+
command: "uv"
|
629
|
+
args: ["run", "sampling_resource_server.py"]
|
630
|
+
sampling:
|
631
|
+
model: "haiku"
|
632
|
+
```
|
633
|
+
|
615
634
|
### Secrets File
|
616
635
|
|
617
636
|
> [!TIP]
|
618
637
|
> fast-agent will look recursively for a fastagent.secrets.yaml file, so you only need to manage this at the root folder of your agent definitions.
|
619
638
|
|
639
|
+
### Interactive Shell
|
640
|
+
|
641
|
+

|
642
|
+
|
620
643
|
## Project Notes
|
621
644
|
|
622
645
|
`fast-agent` builds on the [`mcp-agent`](https://github.com/lastmile-ai/mcp-agent) project by Sarmad Qadri.
|
623
646
|
|
624
|
-
###
|
625
|
-
|
626
|
-
-
|
627
|
-
- Overhaul of Eval/Opt for Conversation Management
|
628
|
-
- Removed instructor/double-llm calling - native structured outputs for OAI.
|
629
|
-
- Improved handling of Parallel/Fan-In and respose option
|
630
|
-
- XML based generated prompts
|
631
|
-
- "FastAgent" style prototyping, with per-agent models
|
632
|
-
- API keys through Environment Variables
|
633
|
-
- Warm-up / Post-Workflow Agent Interactions
|
634
|
-
- Quick Setup
|
635
|
-
- Interactive Prompt Mode
|
636
|
-
- Simple Model Selection with aliases
|
637
|
-
- User/Assistant and Tool Call message display
|
638
|
-
- MCP Sever Environment Variable support
|
639
|
-
- MCP Roots support
|
640
|
-
- Comprehensive Progress display
|
641
|
-
- JSONL file logging with secret revokation
|
642
|
-
- OpenAI o1/o3-mini support with reasoning level
|
643
|
-
- Enhanced Human Input Messaging and Handling
|
644
|
-
- Declarative workflows
|
645
|
-
- Numerous defect fixes
|
646
|
-
|
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)
|
647
|
+
### Contributing
|
648
|
+
|
649
|
+
Contributions and PRs are welcome - feel free to raise issues to discuss. Full guidelines for contributing and roadmap coming very soon. Get in touch!
|
@@ -1,14 +1,14 @@
|
|
1
1
|
mcp_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
mcp_agent/app.py,sha256=
|
3
|
-
mcp_agent/config.py,sha256=
|
2
|
+
mcp_agent/app.py,sha256=cDHUDO6In03iq0QwkzLkIs0QyjokWF42L_fp7xwM8rE,10264
|
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
|
-
mcp_agent/core/proxies.py,sha256=
|
32
|
-
mcp_agent/core/
|
33
|
-
mcp_agent/core/
|
31
|
+
mcp_agent/core/proxies.py,sha256=qsIqyJgiIh-b9ehHiZrM39YutQFJPHaHO14GOMFE1KI,10289
|
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,38 +50,40 @@ 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
|
-
mcp_agent/mcp/gen_client.py,sha256=
|
55
|
+
mcp_agent/mcp/gen_client.py,sha256=D92Yo088CAeuWG6M82Vlkq0H8igUTw9SwwOQinZZCkg,3052
|
56
|
+
mcp_agent/mcp/interfaces.py,sha256=xkXSwW7XBhr5CmwXkVLZqKGcQ7iG9S9A9fakoXopYzw,5555
|
55
57
|
mcp_agent/mcp/mcp_activity.py,sha256=CajXCFWZ2cKEX9s4-HfNVAj471ePTVs4NOkvmIh65tE,592
|
56
|
-
mcp_agent/mcp/mcp_agent_client_session.py,sha256=
|
58
|
+
mcp_agent/mcp/mcp_agent_client_session.py,sha256=2YgbpdTAJ3uCQY182maYXf3bndYWZjBNmlGJ6r7rexU,4157
|
57
59
|
mcp_agent/mcp/mcp_agent_server.py,sha256=xP09HZTeguJi4Fq0p3fjLBP55uSYe5AdqM90xCgn9Ho,1639
|
58
|
-
mcp_agent/mcp/mcp_aggregator.py,sha256=
|
60
|
+
mcp_agent/mcp/mcp_aggregator.py,sha256=vHHwIAso0C4KDD7myJhGZJXktr5op9hamkUgKqI2EU4,37924
|
59
61
|
mcp_agent/mcp/mcp_connection_manager.py,sha256=PdLia-rxbhUdAdEnW7TQbkf1qeI9RR3xhQw1j11Bi6o,13612
|
60
62
|
mcp_agent/mcp/mime_utils.py,sha256=difepNR_gpb4MpMLkBRAoyhDk-AjXUHTiqKvT_VwS1o,1805
|
61
63
|
mcp_agent/mcp/prompt_message_multipart.py,sha256=U7IN0JStmy26akTXcqE4x90oWzm8xs1qa0VeKIyPKmE,1962
|
62
64
|
mcp_agent/mcp/prompt_serialization.py,sha256=StcXV7V4fqqtCmOCXGCyYXx5vpwNhL2xr3RG_awwdqI,16056
|
63
65
|
mcp_agent/mcp/resource_utils.py,sha256=G9IBWyasxKKcbq3T_fSpM6mHE8PjBargEdfQnBPrkZY,6650
|
64
|
-
mcp_agent/mcp/
|
66
|
+
mcp_agent/mcp/sampling.py,sha256=1yg7f9q9bvxJfbY1efLePwL353XGN8ITi3KdP41uve8,4514
|
67
|
+
mcp_agent/mcp/stdio.py,sha256=fZr9yVqPvmPC8pkaf95rZtw0uD8BGND0UI_cUYyuSsE,4478
|
65
68
|
mcp_agent/mcp/prompts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
66
69
|
mcp_agent/mcp/prompts/__main__.py,sha256=gr1Tdz9fcK0EXjEuZg_BOnKUmvhYq5AH2lFZicVyNb0,237
|
67
70
|
mcp_agent/mcp/prompts/prompt_server.py,sha256=6K4FeKNW_JApWUNB055gl8UnWyC1mvtl_kPEvgUnPjk,17348
|
68
71
|
mcp_agent/mcp/prompts/prompt_template.py,sha256=NDnSVA0W1wayZHCVx27lfuVPoxlAz-FfBwiCEQG9Ixk,16324
|
69
|
-
mcp_agent/mcp_server/__init__.py,sha256=
|
72
|
+
mcp_agent/mcp_server/__init__.py,sha256=zBU51ITHIEPScd9nRafnhEddsWqXRPAAvHhkrbRI2_4,155
|
70
73
|
mcp_agent/mcp_server/agent_server.py,sha256=SUBggPyrzWtBRUC5xIMpCxu6ei-6Vah3q9Si12BQ-zY,4444
|
71
74
|
mcp_agent/resources/examples/data-analysis/analysis-campaign.py,sha256=EG-HhaDHltZ4hHAqhgfX_pHM2wem48aYhSIKJxyWHKc,7269
|
72
75
|
mcp_agent/resources/examples/data-analysis/analysis.py,sha256=5zLoioZQNKUfXt1EXLrGX3TU06-0N06-L9Gtp9BIr6k,2611
|
73
76
|
mcp_agent/resources/examples/data-analysis/fastagent.config.yaml,sha256=ini94PHyJCfgpjcjHKMMbGuHs6LIj46F1NwY0ll5HVk,1609
|
74
77
|
mcp_agent/resources/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-Attrition.csv,sha256=pcMeOL1_r8m8MziE6xgbBrQbjl5Ijo98yycZn7O-dlk,227977
|
75
|
-
mcp_agent/resources/examples/internal/agent.py,sha256=
|
76
|
-
mcp_agent/resources/examples/internal/fastagent.config.yaml,sha256=
|
78
|
+
mcp_agent/resources/examples/internal/agent.py,sha256=orShmYKkrjMc7qa3ZtfzoO80uOClZaPaw2Wvc4_FIH8,406
|
79
|
+
mcp_agent/resources/examples/internal/fastagent.config.yaml,sha256=U2s0Asc06wC04FstKnBMeB3J5gIa3xa-Rao-1-74XTk,1935
|
77
80
|
mcp_agent/resources/examples/internal/job.py,sha256=WEKIAANMEAuKr13__rYf3PqJeTAsNB_kqYqbqVYQlUM,4093
|
78
81
|
mcp_agent/resources/examples/internal/prompt_category.py,sha256=b3tjkfrVIW1EPoDjr4mG87wlZ7D0Uju9eg6asXAYYpI,551
|
79
82
|
mcp_agent/resources/examples/internal/prompt_sizing.py,sha256=UtQ_jvwS4yMh80PHhUQXJ9WXk-fqNYlqUMNTNkZosKM,2003
|
80
83
|
mcp_agent/resources/examples/internal/sizer.py,sha256=RBq1qhYVKF2_qtRdvpKpRI3XIFpZ4eyBzhVjnlip-P8,356
|
81
84
|
mcp_agent/resources/examples/internal/social.py,sha256=Cot2lg3PLhLm13gPdVFvFEN28-mm6x3-jHu2YsV4N3s,1707
|
82
85
|
mcp_agent/resources/examples/mcp_researcher/researcher-eval.py,sha256=kNPjIU-JwE0oIBQKwhv6lZsUF_SPtYVkiEEbY1ZVZxk,1807
|
83
|
-
mcp_agent/resources/examples/prompting/__init__.py,sha256=
|
86
|
+
mcp_agent/resources/examples/prompting/__init__.py,sha256=2GSrs9MSDIKo-uDrUI0O311F0UH0RW02ZNdvItJzjfI,50
|
84
87
|
mcp_agent/resources/examples/prompting/agent.py,sha256=gG2jQnRibO8OmljoFQAs9xxhCyHLCkVxJxQkfF7ykfY,607
|
85
88
|
mcp_agent/resources/examples/prompting/fastagent.config.yaml,sha256=UR6LtCpeSIzkHsCrHJW1z-wE7AgmgKozS_IYcfcSAkc,1270
|
86
89
|
mcp_agent/resources/examples/prompting/image_server.py,sha256=-6YWtzS-K5ofHtdoOk4uC3ZBFUyVELT9Fdck1RptcWg,1711
|
@@ -99,14 +102,14 @@ mcp_agent/resources/examples/workflows/router.py,sha256=J1yTAimFY53jcyd21cq1XAZv
|
|
99
102
|
mcp_agent/resources/examples/workflows/sse.py,sha256=tdmmh7p87YNfcF_fCq3evAmc1Nek0oY0YOqLRKBLqKg,570
|
100
103
|
mcp_agent/telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
101
104
|
mcp_agent/telemetry/usage_tracking.py,sha256=ePujKMSjPxB7k6X34DGaVlnsV1728mcWZq38OqahiCU,501
|
102
|
-
mcp_agent/ui/console_display.py,sha256=
|
105
|
+
mcp_agent/ui/console_display.py,sha256=rT017esFdxazGDIt1qxY-LdqIK677ulTMNopEQBYKfo,9718
|
103
106
|
mcp_agent/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
104
107
|
mcp_agent/workflows/embedding/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
105
108
|
mcp_agent/workflows/embedding/embedding_base.py,sha256=-c20ggQ8s7XhMxRX-WEhOgHE7vP_Ca6wtdoXlse-AAA,1681
|
106
109
|
mcp_agent/workflows/embedding/embedding_cohere.py,sha256=OKTJvKD_uEafd4c2uhR5tBjprea1nyvlJOO-3FDqOnk,1540
|
107
110
|
mcp_agent/workflows/embedding/embedding_openai.py,sha256=dntjJ5P-FSMGYuyPZC8MuCU_ehwjXw9wDfzZZuSQN1E,1480
|
108
111
|
mcp_agent/workflows/evaluator_optimizer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
109
|
-
mcp_agent/workflows/evaluator_optimizer/evaluator_optimizer.py,sha256=
|
112
|
+
mcp_agent/workflows/evaluator_optimizer/evaluator_optimizer.py,sha256=Bp3mQddGYY71sJDcgIxnmqDMcjzs9DWZHQ7P6IEp3q0,18129
|
110
113
|
mcp_agent/workflows/intent_classifier/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
111
114
|
mcp_agent/workflows/intent_classifier/intent_classifier_base.py,sha256=zTbOmq6EY_abOlme4zl28HM4RWNNS6bbHl3tF7SshJ0,4004
|
112
115
|
mcp_agent/workflows/intent_classifier/intent_classifier_embedding.py,sha256=_bWZGukc_q9LdA_Q18UoAMSzhN8tt4K_bRHNUhy7Crw,3997
|
@@ -117,22 +120,22 @@ mcp_agent/workflows/intent_classifier/intent_classifier_llm_anthropic.py,sha256=
|
|
117
120
|
mcp_agent/workflows/intent_classifier/intent_classifier_llm_openai.py,sha256=zj76WlTYnSCYjBQ_IDi5vFBQGmNwYaoUq1rT730sY98,1940
|
118
121
|
mcp_agent/workflows/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
119
122
|
mcp_agent/workflows/llm/anthropic_utils.py,sha256=OFmsVmDQ22880duDWQrEeQEB47xtvujSYJ-fNw1lhi0,3712
|
120
|
-
mcp_agent/workflows/llm/augmented_llm.py,sha256=
|
121
|
-
mcp_agent/workflows/llm/augmented_llm_anthropic.py,sha256=
|
122
|
-
mcp_agent/workflows/llm/augmented_llm_openai.py,sha256=
|
123
|
-
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
|
124
127
|
mcp_agent/workflows/llm/augmented_llm_playback.py,sha256=5ypv3owJU6pscktqg9tkLQVKNgaA50e8OWmC1hAhrtE,4328
|
125
|
-
mcp_agent/workflows/llm/
|
126
|
-
mcp_agent/workflows/llm/model_factory.py,sha256=UHePE5Ow03kpE44kjYtFGEhVFSYp0AY2yGri58yCBKU,7688
|
128
|
+
mcp_agent/workflows/llm/model_factory.py,sha256=IR8giuZ_5voBnTIpEwvpLtR1tCIdxF5K9wDnWD9ezfM,7680
|
127
129
|
mcp_agent/workflows/llm/openai_utils.py,sha256=GGkJF-nazA4HWrlmMKKLf0qSfl2gbSqo-rbMDoJs5mE,1895
|
128
|
-
mcp_agent/workflows/llm/prompt_utils.py,sha256=
|
129
|
-
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
|
130
133
|
mcp_agent/workflows/llm/providers/__init__.py,sha256=qirdqAKIbw3BY1NBdGytH9tvpjOu0QNOqKAG2deD_U4,285
|
131
|
-
mcp_agent/workflows/llm/providers/multipart_converter_anthropic.py,sha256=
|
132
|
-
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
|
133
136
|
mcp_agent/workflows/llm/providers/openai_multipart.py,sha256=RKkwssszD6jJpZ-Hj875uu5rbePrwzN7v43Ec69Ziwg,7566
|
134
|
-
mcp_agent/workflows/llm/providers/sampling_converter_anthropic.py,sha256=
|
135
|
-
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
|
136
139
|
mcp_agent/workflows/orchestrator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
137
140
|
mcp_agent/workflows/orchestrator/orchestrator.py,sha256=s8-_4CG4oRnvYAwUqqyevGLpy21IYtcNtsd_SbRZ8Fk,22125
|
138
141
|
mcp_agent/workflows/orchestrator/orchestrator_models.py,sha256=1ldku1fYA_hu2F6K4l2C96mAdds05VibtSzSQrGm3yw,7321
|
@@ -142,7 +145,7 @@ mcp_agent/workflows/parallel/fan_in.py,sha256=EivpUL5-qftctws-tlfwmYS1QeSwr07POI
|
|
142
145
|
mcp_agent/workflows/parallel/fan_out.py,sha256=J-yezgjzAWxfueW_Qcgwoet4PFDRIh0h4m48lIbFA4c,7023
|
143
146
|
mcp_agent/workflows/parallel/parallel_llm.py,sha256=fk88DhBRAI41Ph0spe_yBtrMTSj0g47yoA-ozuOxZhE,5807
|
144
147
|
mcp_agent/workflows/router/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
145
|
-
mcp_agent/workflows/router/router_base.py,sha256=
|
148
|
+
mcp_agent/workflows/router/router_base.py,sha256=yvb-vwNLcLDJAATJjMyo56dlmFldbRtbKXt63Zj30UI,14224
|
146
149
|
mcp_agent/workflows/router/router_embedding.py,sha256=wEU49li9OqTX-Xucm0HDUFLZjlND1WuewOcQVAo0s2E,7944
|
147
150
|
mcp_agent/workflows/router/router_embedding_cohere.py,sha256=aKZVzzQfBuz0by9k0zWLAA0Db_unDIMYL4ynVzzx8C4,1975
|
148
151
|
mcp_agent/workflows/router/router_embedding_openai.py,sha256=KqW2IFLdQoAJ2lIz1X18WQJFjXF-YSFSTtsqVnp1JeI,1975
|
@@ -151,8 +154,8 @@ mcp_agent/workflows/swarm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
151
154
|
mcp_agent/workflows/swarm/swarm.py,sha256=-lAIeSWDqbGHGRPTvjiP9nIKWvxxy9DAojl9yQzO1Pw,11050
|
152
155
|
mcp_agent/workflows/swarm/swarm_anthropic.py,sha256=pW8zFx5baUWGd5Vw3nIDF2oVOOGNorij4qvGJKdYPcs,1624
|
153
156
|
mcp_agent/workflows/swarm/swarm_openai.py,sha256=wfteywvAGkT5bLmIxX_StHJq8144whYmCRnJASAjOes,1596
|
154
|
-
fast_agent_mcp-0.1.
|
155
|
-
fast_agent_mcp-0.1.
|
156
|
-
fast_agent_mcp-0.1.
|
157
|
-
fast_agent_mcp-0.1.
|
158
|
-
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/config.py
CHANGED
@@ -18,6 +18,12 @@ class MCPServerAuthSettings(BaseModel):
|
|
18
18
|
model_config = ConfigDict(extra="allow", arbitrary_types_allowed=True)
|
19
19
|
|
20
20
|
|
21
|
+
class MCPSamplingSettings(BaseModel):
|
22
|
+
model: str = "haiku"
|
23
|
+
|
24
|
+
model_config = ConfigDict(extra="allow", arbitrary_types_allowed=True)
|
25
|
+
|
26
|
+
|
21
27
|
class MCPRootSettings(BaseModel):
|
22
28
|
"""Represents a root directory configuration for an MCP server."""
|
23
29
|
|
@@ -81,6 +87,9 @@ class MCPServerSettings(BaseModel):
|
|
81
87
|
env: Dict[str, str] | None = None
|
82
88
|
"""Environment variables to pass to the server process."""
|
83
89
|
|
90
|
+
sampling: MCPSamplingSettings | None = None
|
91
|
+
"""Sampling settings for this Client/Server pair"""
|
92
|
+
|
84
93
|
|
85
94
|
class MCPSettings(BaseModel):
|
86
95
|
"""Configuration for all MCP servers."""
|
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
@@ -113,6 +113,35 @@ class AgentApp:
|
|
113
113
|
proxy = self._agents[target]
|
114
114
|
return await proxy.apply_prompt(prompt_name, arguments)
|
115
115
|
|
116
|
+
async def with_resource(
|
117
|
+
self,
|
118
|
+
prompt_content: Union[str, PromptMessageMultipart],
|
119
|
+
server_name: str,
|
120
|
+
resource_name: str,
|
121
|
+
agent_name: Optional[str] = None,
|
122
|
+
) -> str:
|
123
|
+
"""
|
124
|
+
Create a prompt with the given content and resource, then send it to the agent.
|
125
|
+
|
126
|
+
Args:
|
127
|
+
prompt_content: Either a string message or an existing PromptMessageMultipart
|
128
|
+
server_name: Name of the MCP server to retrieve the resource from
|
129
|
+
resource_name: Name or URI of the resource to retrieve
|
130
|
+
agent_name: The name of the agent to use (uses default if None)
|
131
|
+
|
132
|
+
Returns:
|
133
|
+
The agent's response as a string
|
134
|
+
"""
|
135
|
+
target = agent_name or self._default
|
136
|
+
if not target:
|
137
|
+
raise ValueError("No default agent available")
|
138
|
+
|
139
|
+
if target not in self._agents:
|
140
|
+
raise ValueError(f"No agent named '{target}'")
|
141
|
+
|
142
|
+
proxy = self._agents[target]
|
143
|
+
return await proxy.with_resource(prompt_content, server_name, resource_name)
|
144
|
+
|
116
145
|
async def prompt(self, agent_name: Optional[str] = None, default: str = "") -> str:
|
117
146
|
"""
|
118
147
|
Interactive prompt for sending messages with advanced features.
|
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))
|
mcp_agent/core/proxies.py
CHANGED
@@ -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
|
+
"""
|