fast-agent-mcp 0.0.12__py3-none-any.whl → 0.0.14__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fast-agent-mcp
3
- Version: 0.0.12
3
+ Version: 0.0.14
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
@@ -247,13 +247,19 @@ Description-Content-Type: text/markdown
247
247
 
248
248
  ## Overview
249
249
 
250
- **`fast-agent`** lets you define, test and interact with agents, tools and workflows in minutes.
250
+ **`fast-agent`** lets you build and interact with Agents and Workflows in minutes.
251
251
 
252
- The simple declarative syntax lets you concentrate on the prompts, MCP Servers and compositions to build effective agents.
252
+ 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).
253
253
 
254
- Quickly compare how different models perform at Agent and MCP Server calling tasks, and build mixed multi-model workflows using the best provider for each task.
254
+ Evaluate how different models handle Agent and MCP Server calling tasks, then build multi-model workflows using the best provider for each task.
255
255
 
256
- ### Get started:
256
+ ### Agent Application Development
257
+
258
+ Prompts and configurations that define your Agent Applications are stored in simple files, with minimal boilerplate, enabling simple management and version control.
259
+
260
+ Chat with individual Agents and Components before, during and after workflow execution to tune and diagnose your agent application. Simple model selection makes testing Model <-> MCP Server interaction painless.
261
+
262
+ ## Get started:
257
263
 
258
264
  Start by installing the [uv package manager](https://docs.astral.sh/uv/) for Python. Then:
259
265
 
@@ -265,10 +271,190 @@ uv run agent.py --model=o3-mini.low # specify a model
265
271
  fast-agent bootstrap workflow # create "building effective agents" examples
266
272
  ```
267
273
 
268
- Other bootstrap examples include a Researcher (with Evaluator-Optimizer workflow) and Data Analysis (similar to ChatGPT experience), demonstrating MCP Roots support.
274
+ Other bootstrap examples include a Researcher Agent (with Evaluator-Optimizer workflow) and Data Analysis Agent (similar to the ChatGPT experience), demonstrating MCP Roots support.
269
275
 
270
276
  > 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.
271
277
 
278
+ ### Basic Agents
279
+
280
+ Defining an agent is as simple as:
281
+
282
+ ```python
283
+ @fast.agent(
284
+ instruction="Given an object, respond only with an estimate of its size."
285
+ )
286
+ ```
287
+
288
+ We can then send messages to the Agent:
289
+
290
+ ```python
291
+ async with fast.run() as agent:
292
+ moon_size = await agent("the moon")
293
+ print(moon_size)
294
+ ```
295
+
296
+ Or start an interactive chat with the Agent:
297
+ ```python
298
+ async with fast.run() as agent:
299
+ await agent()
300
+ ```
301
+
302
+ Here is the complete `sizer.py` Agent application, with boilerplate code:
303
+ ```python
304
+ import asyncio
305
+ from mcp_agent.core.fastagent import FastAgent
306
+
307
+ # Create the application
308
+ fast = FastAgent("Agent Example")
309
+
310
+ @fast.agent(
311
+ instruction="Given an object, respond only with an estimate of its size."
312
+ )
313
+
314
+ async def main():
315
+ async with fast.run() as agent:
316
+ await agent()
317
+
318
+ if __name__ == "__main__":
319
+ asyncio.run(main())
320
+ ```
321
+
322
+ The Agent can be run with `uv run sizer.py` and with a specific model using the command line option `--model gpt-4o-mini`.
323
+
324
+ ### Combining Agents and using MCP Servers
325
+
326
+ _To generate examples use `fast-agent bootstrap workflow`. This example can be run with `uv run chaining.py`. fast-agent looks for configuration files in the current directory before checking parent directories recursively._
327
+
328
+ Agents can be chained to build a workflow:
329
+ ```python
330
+ @fast.agent(
331
+ "url_fetcher",
332
+ instruction="Given a URL, provide a complete and comprehensive summary",
333
+ servers=["fetch"], # Name of an MCP Server defined in fastagent.config.yaml
334
+ )
335
+ @fast.agent(
336
+ "social_media",
337
+ instruction="""
338
+ Write a 280 character social media post for any given text.
339
+ Respond only with the post, never use hashtags.
340
+ """,
341
+ )
342
+
343
+ async def main():
344
+ async with fast.run() as agent:
345
+ await agent.social_media(
346
+ await agent.url_fetcher("http://llmindset.co.uk/resources/mcp-hfspace/")
347
+ )
348
+ ```
349
+
350
+ All Agents and Workflows respond to `.send("message")` to send a message and `.prompt()` to begin a chat session.
351
+
352
+ ## Workflows
353
+
354
+ ### Chain
355
+
356
+ Alternatively, use the `chain` workflow type and the `prompt()` method to capture user input:
357
+ ```python
358
+
359
+ @fast.chain(
360
+ "post_writer",
361
+ sequence=["url_fetcher","social_media"]
362
+ )
363
+
364
+ # we can them prompt it directly:
365
+ async with fast.run() as agent:
366
+ await agent.post_writer.prompt()
367
+
368
+ ```
369
+ Chains can be incorporated in other workflows, or contain other workflow elements (including other Chains). You can set an `instruction` to precisely describe it's capabilities to other workflow steps if needed.
370
+
371
+ ### Parallel
372
+
373
+ The Parallel Workflow sends the same message to multiple Agents simultaneously (`fan-out`), then uses the `fan-in` agent to process the combined content.
374
+
375
+ ```python
376
+
377
+ @fast.agent(
378
+ name="consolidator"
379
+ instruction="combine the lists, remove duplicates"
380
+ )
381
+
382
+ @fast.parallel(
383
+ name="ensemble"
384
+ fan_out=["agent_o3-mini","agent_sonnet37",...]
385
+ fan_in="consolidator"
386
+ )
387
+
388
+ async with fast.run() as agent:
389
+ result = agent.ensemble.send("what are the 10 most important aspects of project management")
390
+ ```
391
+
392
+ Look at the `parallel.py` workflow example for more details.
393
+
394
+ ### Evaluator-Optimizer
395
+
396
+ Evaluator-Optimizers use 2 agents: one to generate content (the `generator`), and one to judge the content and provide actionable feedback (the `evaluator`). Messages are sent to the generator first, then the pair run in a loop until either the evaluator is satisfied with the quality, or the maximum number of refinements is reached.
397
+
398
+ ```python
399
+ @fast.evaluator_optimizer(
400
+ name="researcher"
401
+ generator="web_searcher"
402
+ evaluator="quality_assurance"
403
+ min_rating="EXCELLENT"
404
+ max_refinements=3
405
+ )
406
+
407
+ async with fast.run() as agent:
408
+ await agent.researcher.send("produce a report on how to make the perfect espresso")
409
+ ```
410
+
411
+ See the `evaluator.py` workflow example, or `fast-agent bootstrap researcher` for a more complete example.
412
+
413
+ ### Router
414
+
415
+ Routers use an LLM to assess a message, and route it to the most appropriate Agent direct . The routing prompt is automatically generated by the router.
416
+
417
+ ```python
418
+ @fast.router(
419
+ name="route"
420
+ agents["agent1","agent2","agent3"]
421
+ )
422
+ ```
423
+
424
+ Look at the `router.py` workflow for an example.
425
+
426
+ ### Orchestrator
427
+
428
+ Given a task, an Orchestrator uses an LLM to generate a plan to divide the task amongst the available agents and aggregate a result. The planning and aggregation prompts are generated by the Orchestrator, which benefits from using more capable models. Plans can either be built once at the beginning (`plantype="full"`) or iteratively (`plantype="iterative"`).
429
+
430
+ ```python
431
+ @fast.orchestrator(
432
+ name="orchestrate"
433
+ agents=["task1","task2","task3"]
434
+ )
435
+ ```
436
+
437
+ ## Agent Features
438
+
439
+ ```python
440
+ @fast.agent(
441
+ name="agent",
442
+ instructions="instructions",
443
+ servers=["filesystem"], # list of MCP Servers for the agent, configured in fastagent.config.yaml
444
+ model="o3-mini.high", # specify a model for the agent
445
+ use_history=True, # agent can maintain chat history
446
+ human_input=True, # agent can request human input
447
+ )
448
+ ```
449
+
450
+ ### Human Input
451
+
452
+ When `human_input` is set to true for an Agent, it is presented with the option to prompt the User for input.
453
+
454
+ ## Project Notes
455
+
456
+ `fast-agent` builds on the [`mcp-agent`](https://github.com/lastmile-ai/mcp-agent) project by Sarmad Qadri.
457
+
272
458
  ### llmindset.co.uk fork:
273
459
 
274
460
  - "FastAgent" style prototyping, with per-agent models
@@ -286,10 +472,7 @@ Other bootstrap examples include a Researcher (with Evaluator-Optimizer workflow
286
472
  - Enhanced Human Input Messaging and Handling
287
473
  - Declarative workflows
288
474
 
289
- ## Get Started
290
-
291
- We recommend using [uv](https://docs.astral.sh/uv/) to manage your Python projects:
475
+ ### Features to add.
292
476
 
293
- ## Table of Contents
477
+ - Chat History Clear.
294
478
 
295
- We welcome any and all kinds of contributions. Please see the [CONTRIBUTING guidelines](./CONTRIBUTING.md) to get started.
@@ -8,18 +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=utMR_QWKD1_MqWE_fYY-xqUMKtGlekW0laJfduU6Ckw,9831
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=h_TqBlpIMGhsJr6pp_oxUl00x3F9d1R-JQVwJ9uAreA,2449
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=Q55I2gL-K3Ja8c6MmbLZMVQQ_MaOTxnEC5se09XTI2s,10742
16
+ mcp_agent/cli/commands/bootstrap.py,sha256=z1wZSy8vO_GZPGLrFGzG3EKFQgAHC08jiIdVyylo-58,10778
17
17
  mcp_agent/cli/commands/config.py,sha256=32YTS5jmsYAs9QzAhjkG70_daAHqOemf4XbZBBSMz6g,204
18
- mcp_agent/cli/commands/setup.py,sha256=dI_01B5nye707Rcd15gvZZCYlZGSiKajlnuLf6hJf2A,6197
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/enhanced_prompt.py,sha256=U4hbAbm5WFUwTiwmBlNR7nadbMD9oHYgKuNNQVrGdvc,11047
21
- mcp_agent/core/exceptions.py,sha256=xDdhYh83ni3t0NiXQTEL0_Yyx0qQxBPQL1gSwRToeaw,1469
22
- mcp_agent/core/fastagent.py,sha256=Wn5uHR6DIzMXu4S93Ll8oFD7VJUcSBH4wMm4c0aofpw,48858
20
+ mcp_agent/core/enhanced_prompt.py,sha256=0V5q0xcCk8PBwtc0p62B8JJ1VvqxN_wuJiXC2QPqv1M,12750
21
+ mcp_agent/core/exceptions.py,sha256=a2-JGRwFFRoQEPuAq0JC5PhAJ5TO3xVJfdS4-VN29cw,2225
22
+ mcp_agent/core/fastagent.py,sha256=nMAOhxoS1KqV9IueIFpsYz7yZoVr2pNntI5FoHnzWFE,58011
23
23
  mcp_agent/core/server_validation.py,sha256=_59cn16nNT4HGPwg19HgxMtHK4MsdWYDUw_CuL-5xek,1696
24
24
  mcp_agent/eval/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  mcp_agent/executor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -30,7 +30,7 @@ mcp_agent/executor/temporal.py,sha256=U-wyltgWlVmzJoyivT6rR0Z1U3S6TbMXpeCxyuXako
30
30
  mcp_agent/executor/workflow.py,sha256=lA6r7PNEvxCVFHp4XkEJkaR0QCTf-J6iw9JwNx-tzNY,6727
31
31
  mcp_agent/executor/workflow_signal.py,sha256=3PWwSgXhz3PhkA8SRX3u0BDVoSlQqRGqC9d1qLC25vE,11210
32
32
  mcp_agent/human_input/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- mcp_agent/human_input/handler.py,sha256=_gVIyvjDo53Aj8NFoKCiM8nBdQIuCxiStvgEtRBwYv8,1812
33
+ mcp_agent/human_input/handler.py,sha256=37ERNg9OXaFgm4Ew-6aaU4y2jKre4VpekSnYZtRYFFI,2904
34
34
  mcp_agent/human_input/types.py,sha256=ZvuDHvI0-wO2tFoS0bzrv8U5B83zYdxAG7g9G9jCxug,1489
35
35
  mcp_agent/logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  mcp_agent/logging/events.py,sha256=qfYJnrqgXdujV-nl-iOwBEBh6HMraowBI4zeAWPPU4A,3461
@@ -46,7 +46,7 @@ mcp_agent/mcp/mcp_activity.py,sha256=CajXCFWZ2cKEX9s4-HfNVAj471ePTVs4NOkvmIh65tE
46
46
  mcp_agent/mcp/mcp_agent_client_session.py,sha256=NtWcQhjmnnaR3yYcYj2d2lh-m563NexZUa57K1tAjeM,9477
47
47
  mcp_agent/mcp/mcp_agent_server.py,sha256=xP09HZTeguJi4Fq0p3fjLBP55uSYe5AdqM90xCgn9Ho,1639
48
48
  mcp_agent/mcp/mcp_aggregator.py,sha256=RVsgNnSJ1IPBkqKgF_Gp-Cpv97FVBIdppPey6FRoHB0,14751
49
- mcp_agent/mcp/mcp_connection_manager.py,sha256=LH9ZmK-fXC-_7exAFclzWEjfFjwwdPqO_ZERqoHI_JM,13166
49
+ mcp_agent/mcp/mcp_connection_manager.py,sha256=WLli0w3TVcsszyD9M7zP7vLKPetnQLTf_0PGhvMm9YM,13145
50
50
  mcp_agent/mcp/stdio.py,sha256=tW075R5rQ-UlflXWFKIFDgCbWbuhKqxhiYolWvyEkFs,3985
51
51
  mcp_agent/resources/examples/data-analysis/analysis.py,sha256=Sp-umPPfwVjG3yNrHdQA6blGtG6jc5of1e_0oS4njYc,1379
52
52
  mcp_agent/resources/examples/data-analysis/fastagent.config.yaml,sha256=eTKGbjnTHhDTeNRPQvG_fr9OQpEZ5Y9v7X2NyCj0V70,530
@@ -54,18 +54,16 @@ mcp_agent/resources/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-A
54
54
  mcp_agent/resources/examples/internal/agent.py,sha256=f-jTgYabV3nWCQm0ZP9NtSEWjx3nQbRngzArRufcELg,384
55
55
  mcp_agent/resources/examples/internal/job.py,sha256=WEKIAANMEAuKr13__rYf3PqJeTAsNB_kqYqbqVYQlUM,4093
56
56
  mcp_agent/resources/examples/mcp_researcher/researcher-eval.py,sha256=kNPjIU-JwE0oIBQKwhv6lZsUF_SPtYVkiEEbY1ZVZxk,1807
57
- mcp_agent/resources/examples/mcp_researcher/researcher.py,sha256=jPRafm7jbpHKkX_dQiYGG3Sw-e1Dm86q-JZT-WZDhM0,1425
58
57
  mcp_agent/resources/examples/researcher/fastagent.config.yaml,sha256=2_VXZneckR6zk6RWzzL-smV_oWmgg4uSkLWqZv8jF0I,1995
59
58
  mcp_agent/resources/examples/researcher/researcher-eval.py,sha256=kNPjIU-JwE0oIBQKwhv6lZsUF_SPtYVkiEEbY1ZVZxk,1807
60
59
  mcp_agent/resources/examples/researcher/researcher.py,sha256=jPRafm7jbpHKkX_dQiYGG3Sw-e1Dm86q-JZT-WZDhM0,1425
61
- mcp_agent/resources/examples/workflows/agent.py,sha256=f-jTgYabV3nWCQm0ZP9NtSEWjx3nQbRngzArRufcELg,384
62
60
  mcp_agent/resources/examples/workflows/agent_build.py,sha256=vdjS02rZR88RU53WYzXxPscfFNEFFe_niHYE_i49I8Q,2396
63
- mcp_agent/resources/examples/workflows/chaining.py,sha256=QD_r_PKIoDedWqOTzg7IBnTY8OVoDSMot5WnArJubnc,751
64
- mcp_agent/resources/examples/workflows/evaluator.py,sha256=kC8uBcCMoeDROip4B_X6jLr-1QXXvcUB0fZ6elun7k4,3147
65
- mcp_agent/resources/examples/workflows/fastagent.py,sha256=lkO3waYLt_zQtAVqGjirmIsG73jpHA5ad1WSm4BXv2I,532
61
+ mcp_agent/resources/examples/workflows/chaining.py,sha256=1G_0XBcFkSJCOXb6N_iXWlSc_oGAlhENR0k_CN1vJKI,1208
62
+ mcp_agent/resources/examples/workflows/evaluator.py,sha256=FZy-ciZafdqSHUW67LKdHw0t9rvX6X67waMOoeIN3GY,3147
63
+ mcp_agent/resources/examples/workflows/fastagent.config.yaml,sha256=k2AiapOcK42uqG2nWDVvnSLqN4okQIQZK0FTbZufBpY,809
66
64
  mcp_agent/resources/examples/workflows/human_input.py,sha256=c8cBdLEPbaMXddFwsfN3Z7RFs5PZXsdrjANfvq1VTPM,605
67
- mcp_agent/resources/examples/workflows/orchestrator.py,sha256=kHUDDALqjA8TRjkbsDP2MwspEj1a5DdSUOPAiI17izQ,2545
68
- mcp_agent/resources/examples/workflows/parallel.py,sha256=cNYcIcsdo0-KK-S7KEPCc11aWELeVlQJdJ2LIC9xgDs,3090
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
69
67
  mcp_agent/resources/examples/workflows/router.py,sha256=XT_ewCrxPxdUTMCYQGw34qZQ3GGu8TYY_v5Lige8By4,1707
70
68
  mcp_agent/telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
71
69
  mcp_agent/telemetry/usage_tracking.py,sha256=ePujKMSjPxB7k6X34DGaVlnsV1728mcWZq38OqahiCU,501
@@ -85,11 +83,11 @@ mcp_agent/workflows/intent_classifier/intent_classifier_llm.py,sha256=WSLUv2Casb
85
83
  mcp_agent/workflows/intent_classifier/intent_classifier_llm_anthropic.py,sha256=Hp4454IniWFxV4ml50Ml8ip9rS1La5FBn5pd7vm1FHA,1964
86
84
  mcp_agent/workflows/intent_classifier/intent_classifier_llm_openai.py,sha256=zj76WlTYnSCYjBQ_IDi5vFBQGmNwYaoUq1rT730sY98,1940
87
85
  mcp_agent/workflows/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
- mcp_agent/workflows/llm/augmented_llm.py,sha256=AjYxTn2XdBDHnibmjlCKwaVfQQlQRES9sRBMIU6NaPQ,23258
86
+ mcp_agent/workflows/llm/augmented_llm.py,sha256=8D0hUePn47ChZrmUL8nt60u-iw09EFnJIV7wiQDd2fo,23362
89
87
  mcp_agent/workflows/llm/augmented_llm_anthropic.py,sha256=yrOv1V6rOfm2TTDR58fnf8YU8hBnTIpOZhB2sUgZw6o,21246
90
88
  mcp_agent/workflows/llm/augmented_llm_openai.py,sha256=5PwTh0QJSQ29EtK0UuiltgX6snRSBoau75C35S4xQcQ,24477
91
89
  mcp_agent/workflows/llm/llm_selector.py,sha256=G7pIybuBDwtmyxUDov_QrNYH2FoI0qFRu2JfoxWUF5Y,11045
92
- mcp_agent/workflows/llm/model_factory.py,sha256=5JrMXZ5jbE8isiteF2A912gGuCyomGpjtC_BCVSAM9s,6806
90
+ mcp_agent/workflows/llm/model_factory.py,sha256=7zTJrO2ReHa_6dfh_gY6xO8dTySqGFCKlOG9-AMJ-i8,6920
93
91
  mcp_agent/workflows/orchestrator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
94
92
  mcp_agent/workflows/orchestrator/orchestrator.py,sha256=Fn5r0uUGNAiUq5NLFDjaJ04t19MnGEgr9iknbUj0DSA,14733
95
93
  mcp_agent/workflows/orchestrator/orchestrator_models.py,sha256=UWn7_HFLcqFGlcjZ1Rn2SYQfm5k9seS6QJN_FRST5Kc,4513
@@ -108,8 +106,8 @@ mcp_agent/workflows/swarm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
108
106
  mcp_agent/workflows/swarm/swarm.py,sha256=-lAIeSWDqbGHGRPTvjiP9nIKWvxxy9DAojl9yQzO1Pw,11050
109
107
  mcp_agent/workflows/swarm/swarm_anthropic.py,sha256=pW8zFx5baUWGd5Vw3nIDF2oVOOGNorij4qvGJKdYPcs,1624
110
108
  mcp_agent/workflows/swarm/swarm_openai.py,sha256=wfteywvAGkT5bLmIxX_StHJq8144whYmCRnJASAjOes,1596
111
- fast_agent_mcp-0.0.12.dist-info/METADATA,sha256=mgH0wJrtVRReqKTn2a-ANc_reC_quUXY-texT2zGdVI,16583
112
- fast_agent_mcp-0.0.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
113
- fast_agent_mcp-0.0.12.dist-info/entry_points.txt,sha256=2IXtSmDK9XjWN__RWuRIJTgWyW17wJnJ_h-pb0pZAxo,174
114
- fast_agent_mcp-0.0.12.dist-info/licenses/LICENSE,sha256=cN3FxDURL9XuzE5mhK9L2paZo82LTfjwCYVT7e3j0e4,10939
115
- fast_agent_mcp-0.0.12.dist-info/RECORD,,
109
+ fast_agent_mcp-0.0.14.dist-info/METADATA,sha256=7qlGcDMbyR9SsI2Sx5bnSdZxrUmrGxptJLmSKVQm4l4,22080
110
+ fast_agent_mcp-0.0.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
111
+ fast_agent_mcp-0.0.14.dist-info/entry_points.txt,sha256=2IXtSmDK9XjWN__RWuRIJTgWyW17wJnJ_h-pb0pZAxo,174
112
+ fast_agent_mcp-0.0.14.dist-info/licenses/LICENSE,sha256=cN3FxDURL9XuzE5mhK9L2paZo82LTfjwCYVT7e3j0e4,10939
113
+ fast_agent_mcp-0.0.14.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
- request = HumanInputRequest(**arguments.get("request"))
257
- result: HumanInputResponse = await self.request_human_input(request=request)
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: {result.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,8 +26,9 @@ EXAMPLE_TYPES = {
26
26
  "orchestrator.py",
27
27
  "parallel.py",
28
28
  "router.py",
29
+ "fastagent.config.yaml",
29
30
  ],
30
- "create_subdir": False,
31
+ "create_subdir": True,
31
32
  },
32
33
  "researcher": {
33
34
  "description": "Research agent example with additional evaluation/optimization\n"
@@ -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 (decorator, researcher, etc.)"
35
+ "bootstrap", "Create example applications (workflow, researcher, etc.)"
36
36
  )
37
37
  # table.add_row("config", "Manage agent configuration settings")
38
38
 
@@ -41,8 +41,8 @@ def show_welcome():
41
41
  console.print("\n[bold]Getting Started:[/bold]")
42
42
  console.print("1. Set up a new project:")
43
43
  console.print(" fastagent setup")
44
- console.print("\n2. Try an example:")
45
- console.print(" fastagent bootstrap create decorator")
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
47
  console.print("Example: fastagent bootstrap --help")
48
48