fast-agent-mcp 0.0.11__py3-none-any.whl → 0.0.13__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.0.11.dist-info → fast_agent_mcp-0.0.13.dist-info}/METADATA +9 -1
- {fast_agent_mcp-0.0.11.dist-info → fast_agent_mcp-0.0.13.dist-info}/RECORD +30 -25
- mcp_agent/agents/agent.py +48 -8
- mcp_agent/cli/commands/bootstrap.py +2 -5
- mcp_agent/cli/commands/setup.py +1 -1
- mcp_agent/cli/main.py +6 -6
- mcp_agent/core/enhanced_prompt.py +358 -0
- mcp_agent/core/exceptions.py +17 -0
- mcp_agent/core/fastagent.py +108 -34
- mcp_agent/human_input/handler.py +43 -18
- mcp_agent/mcp/mcp_connection_manager.py +14 -12
- mcp_agent/resources/examples/internal/agent.py +17 -0
- mcp_agent/resources/examples/internal/job.py +1 -1
- mcp_agent/resources/examples/mcp_researcher/researcher-eval.py +1 -1
- mcp_agent/resources/examples/researcher/fastagent.config.yaml +53 -0
- mcp_agent/resources/examples/researcher/researcher-eval.py +53 -0
- mcp_agent/resources/examples/workflows/chaining.py +5 -1
- mcp_agent/resources/examples/workflows/evaluator.py +7 -4
- mcp_agent/resources/examples/workflows/fastagent.config.yaml +24 -0
- mcp_agent/resources/examples/workflows/orchestrator.py +3 -2
- mcp_agent/resources/examples/workflows/parallel.py +2 -1
- mcp_agent/workflows/evaluator_optimizer/evaluator_optimizer.py +31 -30
- mcp_agent/workflows/llm/augmented_llm.py +8 -2
- mcp_agent/workflows/llm/augmented_llm_anthropic.py +3 -1
- mcp_agent/workflows/llm/augmented_llm_openai.py +20 -9
- mcp_agent/workflows/llm/model_factory.py +7 -4
- {fast_agent_mcp-0.0.11.dist-info → fast_agent_mcp-0.0.13.dist-info}/WHEEL +0 -0
- {fast_agent_mcp-0.0.11.dist-info → fast_agent_mcp-0.0.13.dist-info}/entry_points.txt +0 -0
- {fast_agent_mcp-0.0.11.dist-info → fast_agent_mcp-0.0.13.dist-info}/licenses/LICENSE +0 -0
- /mcp_agent/resources/examples/{mcp_researcher → researcher}/researcher.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fast-agent-mcp
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.13
|
|
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
|
|
@@ -217,6 +217,7 @@ Requires-Dist: numpy>=2.2.1
|
|
|
217
217
|
Requires-Dist: openai>=1.63.2
|
|
218
218
|
Requires-Dist: opentelemetry-distro>=0.50b0
|
|
219
219
|
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.29.0
|
|
220
|
+
Requires-Dist: prompt-toolkit>=3.0.50
|
|
220
221
|
Requires-Dist: pydantic-settings>=2.7.0
|
|
221
222
|
Requires-Dist: pydantic>=2.10.4
|
|
222
223
|
Requires-Dist: pyyaml>=6.0.2
|
|
@@ -268,9 +269,16 @@ Other bootstrap examples include a Researcher (with Evaluator-Optimizer workflow
|
|
|
268
269
|
|
|
269
270
|
> Windows Users - there are a couple of configuration changes needed for the Filesystem and Docker MCP Servers - necessary changes are detailed within the configuration files.
|
|
270
271
|
|
|
272
|
+
## Agent Development
|
|
273
|
+
|
|
274
|
+
FastAgent lets you interact with Agents during a workflow, enabling "warm-up" and diagnostic prompting to improve behaviour and refine prompts.
|
|
275
|
+
|
|
276
|
+
## MCP Server Development
|
|
277
|
+
|
|
271
278
|
### llmindset.co.uk fork:
|
|
272
279
|
|
|
273
280
|
- "FastAgent" style prototyping, with per-agent models
|
|
281
|
+
- Api keys through Environment Variables
|
|
274
282
|
- Warm-up / Post-Workflow Agent Interactions
|
|
275
283
|
- Quick Setup
|
|
276
284
|
- Interactive Prompt Mode
|
|
@@ -8,17 +8,18 @@ mcp_agent/event_progress.py,sha256=25iz0yyg-O4glMmtijcYpDdUmtUIKsCmR_8A52GgeC4,2
|
|
|
8
8
|
mcp_agent/mcp_server_registry.py,sha256=5x30L1IlmC18JASl7NQbZYHMqPWS3ay0f_3U3uleaMM,9884
|
|
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=losanPSdZXZzmeiX-J6ctOinLlkhNZsxwi3Swr8lnxA,11482
|
|
12
12
|
mcp_agent/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
mcp_agent/cli/__main__.py,sha256=bhxe66GYqy0q78OQhi7dkuubY1Tn0bQL6hU5Nn47E34,73
|
|
14
|
-
mcp_agent/cli/main.py,sha256=
|
|
14
|
+
mcp_agent/cli/main.py,sha256=cqRxYTpeZ656lzf9qLR3LPnQXrFVDxlWm5gRuqyzUQg,2456
|
|
15
15
|
mcp_agent/cli/terminal.py,sha256=5fqrKlJvIpKEuvpvZ653OueQSYFFktBEbosjr2ucMUc,1026
|
|
16
|
-
mcp_agent/cli/commands/bootstrap.py,sha256=
|
|
16
|
+
mcp_agent/cli/commands/bootstrap.py,sha256=N7pGP7IWjL5HI99glk4BXzaAYwHGkJjQcDTBMOmDAGQ,10779
|
|
17
17
|
mcp_agent/cli/commands/config.py,sha256=32YTS5jmsYAs9QzAhjkG70_daAHqOemf4XbZBBSMz6g,204
|
|
18
|
-
mcp_agent/cli/commands/setup.py,sha256=
|
|
18
|
+
mcp_agent/cli/commands/setup.py,sha256=8ofxUAF2nUSu1IarDZSAsTt6_6PoEht3TGbz9N6WSbs,6239
|
|
19
19
|
mcp_agent/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
-
mcp_agent/core/
|
|
21
|
-
mcp_agent/core/
|
|
20
|
+
mcp_agent/core/enhanced_prompt.py,sha256=0V5q0xcCk8PBwtc0p62B8JJ1VvqxN_wuJiXC2QPqv1M,12750
|
|
21
|
+
mcp_agent/core/exceptions.py,sha256=pcI-JNn5Eql4weIKsDYnIwhPyzkc7CBJBJHOUT0w6kQ,2005
|
|
22
|
+
mcp_agent/core/fastagent.py,sha256=_9PRnxZZJWgLxvcjF-KnibsxqYs2lVs-BD_gj9o_Neo,49733
|
|
22
23
|
mcp_agent/core/server_validation.py,sha256=_59cn16nNT4HGPwg19HgxMtHK4MsdWYDUw_CuL-5xek,1696
|
|
23
24
|
mcp_agent/eval/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
25
|
mcp_agent/executor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -29,7 +30,7 @@ mcp_agent/executor/temporal.py,sha256=U-wyltgWlVmzJoyivT6rR0Z1U3S6TbMXpeCxyuXako
|
|
|
29
30
|
mcp_agent/executor/workflow.py,sha256=lA6r7PNEvxCVFHp4XkEJkaR0QCTf-J6iw9JwNx-tzNY,6727
|
|
30
31
|
mcp_agent/executor/workflow_signal.py,sha256=3PWwSgXhz3PhkA8SRX3u0BDVoSlQqRGqC9d1qLC25vE,11210
|
|
31
32
|
mcp_agent/human_input/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
|
-
mcp_agent/human_input/handler.py,sha256=
|
|
33
|
+
mcp_agent/human_input/handler.py,sha256=37ERNg9OXaFgm4Ew-6aaU4y2jKre4VpekSnYZtRYFFI,2904
|
|
33
34
|
mcp_agent/human_input/types.py,sha256=ZvuDHvI0-wO2tFoS0bzrv8U5B83zYdxAG7g9G9jCxug,1489
|
|
34
35
|
mcp_agent/logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
35
36
|
mcp_agent/logging/events.py,sha256=qfYJnrqgXdujV-nl-iOwBEBh6HMraowBI4zeAWPPU4A,3461
|
|
@@ -45,20 +46,24 @@ mcp_agent/mcp/mcp_activity.py,sha256=CajXCFWZ2cKEX9s4-HfNVAj471ePTVs4NOkvmIh65tE
|
|
|
45
46
|
mcp_agent/mcp/mcp_agent_client_session.py,sha256=NtWcQhjmnnaR3yYcYj2d2lh-m563NexZUa57K1tAjeM,9477
|
|
46
47
|
mcp_agent/mcp/mcp_agent_server.py,sha256=xP09HZTeguJi4Fq0p3fjLBP55uSYe5AdqM90xCgn9Ho,1639
|
|
47
48
|
mcp_agent/mcp/mcp_aggregator.py,sha256=RVsgNnSJ1IPBkqKgF_Gp-Cpv97FVBIdppPey6FRoHB0,14751
|
|
48
|
-
mcp_agent/mcp/mcp_connection_manager.py,sha256=
|
|
49
|
+
mcp_agent/mcp/mcp_connection_manager.py,sha256=WLli0w3TVcsszyD9M7zP7vLKPetnQLTf_0PGhvMm9YM,13145
|
|
49
50
|
mcp_agent/mcp/stdio.py,sha256=tW075R5rQ-UlflXWFKIFDgCbWbuhKqxhiYolWvyEkFs,3985
|
|
50
51
|
mcp_agent/resources/examples/data-analysis/analysis.py,sha256=Sp-umPPfwVjG3yNrHdQA6blGtG6jc5of1e_0oS4njYc,1379
|
|
51
52
|
mcp_agent/resources/examples/data-analysis/fastagent.config.yaml,sha256=eTKGbjnTHhDTeNRPQvG_fr9OQpEZ5Y9v7X2NyCj0V70,530
|
|
52
53
|
mcp_agent/resources/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-Attrition.csv,sha256=pcMeOL1_r8m8MziE6xgbBrQbjl5Ijo98yycZn7O-dlk,227977
|
|
53
|
-
mcp_agent/resources/examples/internal/
|
|
54
|
-
mcp_agent/resources/examples/
|
|
55
|
-
mcp_agent/resources/examples/mcp_researcher/researcher.py,sha256=
|
|
54
|
+
mcp_agent/resources/examples/internal/agent.py,sha256=f-jTgYabV3nWCQm0ZP9NtSEWjx3nQbRngzArRufcELg,384
|
|
55
|
+
mcp_agent/resources/examples/internal/job.py,sha256=WEKIAANMEAuKr13__rYf3PqJeTAsNB_kqYqbqVYQlUM,4093
|
|
56
|
+
mcp_agent/resources/examples/mcp_researcher/researcher-eval.py,sha256=kNPjIU-JwE0oIBQKwhv6lZsUF_SPtYVkiEEbY1ZVZxk,1807
|
|
57
|
+
mcp_agent/resources/examples/researcher/fastagent.config.yaml,sha256=2_VXZneckR6zk6RWzzL-smV_oWmgg4uSkLWqZv8jF0I,1995
|
|
58
|
+
mcp_agent/resources/examples/researcher/researcher-eval.py,sha256=kNPjIU-JwE0oIBQKwhv6lZsUF_SPtYVkiEEbY1ZVZxk,1807
|
|
59
|
+
mcp_agent/resources/examples/researcher/researcher.py,sha256=jPRafm7jbpHKkX_dQiYGG3Sw-e1Dm86q-JZT-WZDhM0,1425
|
|
56
60
|
mcp_agent/resources/examples/workflows/agent_build.py,sha256=vdjS02rZR88RU53WYzXxPscfFNEFFe_niHYE_i49I8Q,2396
|
|
57
|
-
mcp_agent/resources/examples/workflows/chaining.py,sha256=
|
|
58
|
-
mcp_agent/resources/examples/workflows/evaluator.py,sha256=
|
|
61
|
+
mcp_agent/resources/examples/workflows/chaining.py,sha256=sDymBRuU5V_tlnDuclOaMYHPbHOk8eyaWsya5vxzrGo,817
|
|
62
|
+
mcp_agent/resources/examples/workflows/evaluator.py,sha256=FZy-ciZafdqSHUW67LKdHw0t9rvX6X67waMOoeIN3GY,3147
|
|
63
|
+
mcp_agent/resources/examples/workflows/fastagent.config.yaml,sha256=k2AiapOcK42uqG2nWDVvnSLqN4okQIQZK0FTbZufBpY,809
|
|
59
64
|
mcp_agent/resources/examples/workflows/human_input.py,sha256=c8cBdLEPbaMXddFwsfN3Z7RFs5PZXsdrjANfvq1VTPM,605
|
|
60
|
-
mcp_agent/resources/examples/workflows/orchestrator.py,sha256=
|
|
61
|
-
mcp_agent/resources/examples/workflows/parallel.py,sha256=
|
|
65
|
+
mcp_agent/resources/examples/workflows/orchestrator.py,sha256=pRJqB-ok79_iEj8aG4FysHyXz6wAHLUX-5tS8khUI7k,2574
|
|
66
|
+
mcp_agent/resources/examples/workflows/parallel.py,sha256=pLbQrtXfbdYqMVddxtg5dZnBnm5Wo2mXlIa1Vf2F1FQ,3096
|
|
62
67
|
mcp_agent/resources/examples/workflows/router.py,sha256=XT_ewCrxPxdUTMCYQGw34qZQ3GGu8TYY_v5Lige8By4,1707
|
|
63
68
|
mcp_agent/telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
64
69
|
mcp_agent/telemetry/usage_tracking.py,sha256=ePujKMSjPxB7k6X34DGaVlnsV1728mcWZq38OqahiCU,501
|
|
@@ -68,7 +73,7 @@ mcp_agent/workflows/embedding/embedding_base.py,sha256=-c20ggQ8s7XhMxRX-WEhOgHE7
|
|
|
68
73
|
mcp_agent/workflows/embedding/embedding_cohere.py,sha256=OKTJvKD_uEafd4c2uhR5tBjprea1nyvlJOO-3FDqOnk,1540
|
|
69
74
|
mcp_agent/workflows/embedding/embedding_openai.py,sha256=dntjJ5P-FSMGYuyPZC8MuCU_ehwjXw9wDfzZZuSQN1E,1480
|
|
70
75
|
mcp_agent/workflows/evaluator_optimizer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
71
|
-
mcp_agent/workflows/evaluator_optimizer/evaluator_optimizer.py,sha256=
|
|
76
|
+
mcp_agent/workflows/evaluator_optimizer/evaluator_optimizer.py,sha256=r0ATtuc8JouBZz6iPc_dQ6g5oUZc7JXfbI9adKd2Wg8,13572
|
|
72
77
|
mcp_agent/workflows/intent_classifier/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
73
78
|
mcp_agent/workflows/intent_classifier/intent_classifier_base.py,sha256=zTbOmq6EY_abOlme4zl28HM4RWNNS6bbHl3tF7SshJ0,4004
|
|
74
79
|
mcp_agent/workflows/intent_classifier/intent_classifier_embedding.py,sha256=_bWZGukc_q9LdA_Q18UoAMSzhN8tt4K_bRHNUhy7Crw,3997
|
|
@@ -78,11 +83,11 @@ mcp_agent/workflows/intent_classifier/intent_classifier_llm.py,sha256=WSLUv2Casb
|
|
|
78
83
|
mcp_agent/workflows/intent_classifier/intent_classifier_llm_anthropic.py,sha256=Hp4454IniWFxV4ml50Ml8ip9rS1La5FBn5pd7vm1FHA,1964
|
|
79
84
|
mcp_agent/workflows/intent_classifier/intent_classifier_llm_openai.py,sha256=zj76WlTYnSCYjBQ_IDi5vFBQGmNwYaoUq1rT730sY98,1940
|
|
80
85
|
mcp_agent/workflows/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
81
|
-
mcp_agent/workflows/llm/augmented_llm.py,sha256=
|
|
82
|
-
mcp_agent/workflows/llm/augmented_llm_anthropic.py,sha256=
|
|
83
|
-
mcp_agent/workflows/llm/augmented_llm_openai.py,sha256=
|
|
86
|
+
mcp_agent/workflows/llm/augmented_llm.py,sha256=8D0hUePn47ChZrmUL8nt60u-iw09EFnJIV7wiQDd2fo,23362
|
|
87
|
+
mcp_agent/workflows/llm/augmented_llm_anthropic.py,sha256=yrOv1V6rOfm2TTDR58fnf8YU8hBnTIpOZhB2sUgZw6o,21246
|
|
88
|
+
mcp_agent/workflows/llm/augmented_llm_openai.py,sha256=5PwTh0QJSQ29EtK0UuiltgX6snRSBoau75C35S4xQcQ,24477
|
|
84
89
|
mcp_agent/workflows/llm/llm_selector.py,sha256=G7pIybuBDwtmyxUDov_QrNYH2FoI0qFRu2JfoxWUF5Y,11045
|
|
85
|
-
mcp_agent/workflows/llm/model_factory.py,sha256=
|
|
90
|
+
mcp_agent/workflows/llm/model_factory.py,sha256=7zTJrO2ReHa_6dfh_gY6xO8dTySqGFCKlOG9-AMJ-i8,6920
|
|
86
91
|
mcp_agent/workflows/orchestrator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
87
92
|
mcp_agent/workflows/orchestrator/orchestrator.py,sha256=Fn5r0uUGNAiUq5NLFDjaJ04t19MnGEgr9iknbUj0DSA,14733
|
|
88
93
|
mcp_agent/workflows/orchestrator/orchestrator_models.py,sha256=UWn7_HFLcqFGlcjZ1Rn2SYQfm5k9seS6QJN_FRST5Kc,4513
|
|
@@ -101,8 +106,8 @@ mcp_agent/workflows/swarm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
|
101
106
|
mcp_agent/workflows/swarm/swarm.py,sha256=-lAIeSWDqbGHGRPTvjiP9nIKWvxxy9DAojl9yQzO1Pw,11050
|
|
102
107
|
mcp_agent/workflows/swarm/swarm_anthropic.py,sha256=pW8zFx5baUWGd5Vw3nIDF2oVOOGNorij4qvGJKdYPcs,1624
|
|
103
108
|
mcp_agent/workflows/swarm/swarm_openai.py,sha256=wfteywvAGkT5bLmIxX_StHJq8144whYmCRnJASAjOes,1596
|
|
104
|
-
fast_agent_mcp-0.0.
|
|
105
|
-
fast_agent_mcp-0.0.
|
|
106
|
-
fast_agent_mcp-0.0.
|
|
107
|
-
fast_agent_mcp-0.0.
|
|
108
|
-
fast_agent_mcp-0.0.
|
|
109
|
+
fast_agent_mcp-0.0.13.dist-info/METADATA,sha256=5Mu-PczPn7wfDWw_j_UXpYWlUYhDHOQEcGRvHyxg5MA,16777
|
|
110
|
+
fast_agent_mcp-0.0.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
111
|
+
fast_agent_mcp-0.0.13.dist-info/entry_points.txt,sha256=2IXtSmDK9XjWN__RWuRIJTgWyW17wJnJ_h-pb0pZAxo,174
|
|
112
|
+
fast_agent_mcp-0.0.13.dist-info/licenses/LICENSE,sha256=cN3FxDURL9XuzE5mhK9L2paZo82LTfjwCYVT7e3j0e4,10939
|
|
113
|
+
fast_agent_mcp-0.0.13.dist-info/RECORD,,
|
mcp_agent/agents/agent.py
CHANGED
|
@@ -11,6 +11,7 @@ from mcp.types import (
|
|
|
11
11
|
Tool,
|
|
12
12
|
)
|
|
13
13
|
|
|
14
|
+
from mcp_agent.core.exceptions import PromptExitError
|
|
14
15
|
from mcp_agent.mcp.mcp_aggregator import MCPAggregator
|
|
15
16
|
from mcp_agent.workflows.llm.augmented_llm import RequestParams
|
|
16
17
|
from mcp_agent.human_input.types import (
|
|
@@ -24,6 +25,7 @@ from mcp_agent.logging.logger import get_logger
|
|
|
24
25
|
|
|
25
26
|
if TYPE_CHECKING:
|
|
26
27
|
from mcp_agent.context import Context
|
|
28
|
+
import traceback
|
|
27
29
|
|
|
28
30
|
logger = get_logger(__name__)
|
|
29
31
|
|
|
@@ -148,10 +150,7 @@ class Agent(MCPAggregator):
|
|
|
148
150
|
"""
|
|
149
151
|
await super().close()
|
|
150
152
|
|
|
151
|
-
async def request_human_input(
|
|
152
|
-
self,
|
|
153
|
-
request: HumanInputRequest,
|
|
154
|
-
) -> str:
|
|
153
|
+
async def request_human_input(self, request: HumanInputRequest) -> str:
|
|
155
154
|
"""
|
|
156
155
|
Request input from a human user. Pauses the workflow until input is received.
|
|
157
156
|
|
|
@@ -170,14 +169,23 @@ class Agent(MCPAggregator):
|
|
|
170
169
|
# Generate a unique ID for this request to avoid signal collisions
|
|
171
170
|
request_id = f"{HUMAN_INPUT_SIGNAL_NAME}_{self.name}_{uuid.uuid4()}"
|
|
172
171
|
request.request_id = request_id
|
|
173
|
-
|
|
172
|
+
# Use metadata as a dictionary to pass agent name
|
|
173
|
+
request.metadata = {"agent_name": self.name}
|
|
174
174
|
self.logger.debug("Requesting human input:", data=request)
|
|
175
175
|
|
|
176
176
|
async def call_callback_and_signal():
|
|
177
177
|
try:
|
|
178
178
|
user_input = await self.human_input_callback(request)
|
|
179
|
+
|
|
179
180
|
self.logger.debug("Received human input:", data=user_input)
|
|
180
181
|
await self.executor.signal(signal_name=request_id, payload=user_input)
|
|
182
|
+
except PromptExitError as e:
|
|
183
|
+
# Propagate the exit error through the signal system
|
|
184
|
+
self.logger.info("User requested to exit session")
|
|
185
|
+
await self.executor.signal(
|
|
186
|
+
signal_name=request_id,
|
|
187
|
+
payload={"exit_requested": True, "error": str(e)},
|
|
188
|
+
)
|
|
181
189
|
except Exception as e:
|
|
182
190
|
await self.executor.signal(
|
|
183
191
|
request_id, payload=f"Error getting human input: {str(e)}"
|
|
@@ -197,6 +205,10 @@ class Agent(MCPAggregator):
|
|
|
197
205
|
signal_type=HumanInputResponse, # TODO: saqadri - should this be HumanInputResponse?
|
|
198
206
|
)
|
|
199
207
|
|
|
208
|
+
if isinstance(result, dict) and result.get("exit_requested", False):
|
|
209
|
+
raise PromptExitError(
|
|
210
|
+
result.get("error", "User requested to exit FastAgent session")
|
|
211
|
+
)
|
|
200
212
|
self.logger.debug("Received human input signal", data=result)
|
|
201
213
|
return result
|
|
202
214
|
|
|
@@ -253,13 +265,39 @@ class Agent(MCPAggregator):
|
|
|
253
265
|
) -> CallToolResult:
|
|
254
266
|
# Handle human input request
|
|
255
267
|
try:
|
|
256
|
-
|
|
257
|
-
|
|
268
|
+
# Make sure arguments is not None
|
|
269
|
+
if arguments is None:
|
|
270
|
+
arguments = {}
|
|
271
|
+
|
|
272
|
+
# Extract request data
|
|
273
|
+
request_data = arguments.get("request")
|
|
274
|
+
|
|
275
|
+
# Handle both string and dict request formats
|
|
276
|
+
if isinstance(request_data, str):
|
|
277
|
+
request = HumanInputRequest(prompt=request_data)
|
|
278
|
+
elif isinstance(request_data, dict):
|
|
279
|
+
request = HumanInputRequest(**request_data)
|
|
280
|
+
else:
|
|
281
|
+
# Fallback for invalid or missing request data
|
|
282
|
+
request = HumanInputRequest(prompt="Please provide input:")
|
|
283
|
+
|
|
284
|
+
result = await self.request_human_input(request=request)
|
|
285
|
+
|
|
286
|
+
# Use response attribute if available, otherwise use the result directly
|
|
287
|
+
response_text = (
|
|
288
|
+
result.response
|
|
289
|
+
if isinstance(result, HumanInputResponse)
|
|
290
|
+
else str(result)
|
|
291
|
+
)
|
|
292
|
+
|
|
258
293
|
return CallToolResult(
|
|
259
294
|
content=[
|
|
260
|
-
TextContent(type="text", text=f"Human response: {
|
|
295
|
+
TextContent(type="text", text=f"Human response: {response_text}")
|
|
261
296
|
]
|
|
262
297
|
)
|
|
298
|
+
|
|
299
|
+
except PromptExitError:
|
|
300
|
+
raise
|
|
263
301
|
except TimeoutError as e:
|
|
264
302
|
return CallToolResult(
|
|
265
303
|
isError=True,
|
|
@@ -271,6 +309,8 @@ class Agent(MCPAggregator):
|
|
|
271
309
|
],
|
|
272
310
|
)
|
|
273
311
|
except Exception as e:
|
|
312
|
+
print(f"Error in _call_human_input_tool: {traceback.format_exc()}")
|
|
313
|
+
|
|
274
314
|
return CallToolResult(
|
|
275
315
|
isError=True,
|
|
276
316
|
content=[
|
|
@@ -26,6 +26,7 @@ EXAMPLE_TYPES = {
|
|
|
26
26
|
"orchestrator.py",
|
|
27
27
|
"parallel.py",
|
|
28
28
|
"router.py",
|
|
29
|
+
"fastagent.config.yaml",
|
|
29
30
|
],
|
|
30
31
|
"create_subdir": False,
|
|
31
32
|
},
|
|
@@ -33,11 +34,7 @@ EXAMPLE_TYPES = {
|
|
|
33
34
|
"description": "Research agent example with additional evaluation/optimization\n"
|
|
34
35
|
"example. Uses Brave Search and Docker MCP Servers.\n"
|
|
35
36
|
"Creates examples in a 'researcher' subdirectory.",
|
|
36
|
-
"files": [
|
|
37
|
-
"researcher.py",
|
|
38
|
-
"researcher-eval.py",
|
|
39
|
-
"mcp_agent.secrets.yaml.example",
|
|
40
|
-
],
|
|
37
|
+
"files": ["researcher.py", "researcher-eval.py", "fastagent.config.yaml"],
|
|
41
38
|
"create_subdir": True,
|
|
42
39
|
},
|
|
43
40
|
"data-analysis": {
|
mcp_agent/cli/commands/setup.py
CHANGED
|
@@ -119,7 +119,7 @@ fast = FastAgent("FastAgent Example")
|
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
# Define the agent
|
|
122
|
-
@fast.agent(servers=["fetch"])
|
|
122
|
+
@fast.agent(instruction="You are a helpful AI Agent", servers=["fetch"])
|
|
123
123
|
async def main():
|
|
124
124
|
# use the --model command line switch or agent arguments to change model
|
|
125
125
|
async with fast.run() as agent:
|
mcp_agent/cli/main.py
CHANGED
|
@@ -32,7 +32,7 @@ def show_welcome():
|
|
|
32
32
|
|
|
33
33
|
table.add_row("setup", "Set up a new agent project with configuration files")
|
|
34
34
|
table.add_row(
|
|
35
|
-
"bootstrap", "Create example applications (
|
|
35
|
+
"bootstrap", "Create example applications (workflow, researcher, etc.)"
|
|
36
36
|
)
|
|
37
37
|
# table.add_row("config", "Manage agent configuration settings")
|
|
38
38
|
|
|
@@ -40,11 +40,11 @@ def show_welcome():
|
|
|
40
40
|
|
|
41
41
|
console.print("\n[bold]Getting Started:[/bold]")
|
|
42
42
|
console.print("1. Set up a new project:")
|
|
43
|
-
console.print("
|
|
44
|
-
console.print("\n2. Try an example:")
|
|
45
|
-
console.print("
|
|
43
|
+
console.print(" fastagent setup")
|
|
44
|
+
console.print("\n2. Try an example workflow:")
|
|
45
|
+
console.print(" fastagent bootstrap create workflow")
|
|
46
46
|
console.print("\nUse --help with any command for more information")
|
|
47
|
-
console.print("Example:
|
|
47
|
+
console.print("Example: fastagent bootstrap --help")
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
@app.callback(invoke_without_command=True)
|
|
@@ -56,7 +56,7 @@ def main(
|
|
|
56
56
|
True, "--color/--no-color", help="Enable/disable color output"
|
|
57
57
|
),
|
|
58
58
|
):
|
|
59
|
-
"""
|
|
59
|
+
"""FastAgent CLI - Build effective agents using Model Context Protocol (MCP).
|
|
60
60
|
|
|
61
61
|
Use --help with any command for detailed usage information.
|
|
62
62
|
"""
|