fast-agent-mcp 0.0.15__py3-none-any.whl → 0.0.16__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fast-agent-mcp
3
- Version: 0.0.15
3
+ Version: 0.0.16
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
@@ -259,14 +259,17 @@ Prompts and configurations that define your Agent Applications are stored in sim
259
259
 
260
260
  Chat with individual Agents and Components before, during and after workflow execution to tune and diagnose your application.
261
261
 
262
- Simple model selection makes testing Model <-> MCP Server interaction painless.
262
+ 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/)
263
+
264
+ ![fast-agent](https://github.com/user-attachments/assets/3e692103-bf97-489a-b519-2d0fee036369)
263
265
 
264
266
  ## Get started:
265
267
 
266
268
  Start by installing the [uv package manager](https://docs.astral.sh/uv/) for Python. Then:
267
269
 
268
270
  ```bash
269
- uv pip install fast-agent-mcp # install fast-agent
271
+ uv pip install fast-agent-mcp # install fast-agent!
272
+
270
273
  fast-agent setup # create an example agent and config files
271
274
  uv run agent.py # run your first agent
272
275
  uv run agent.py --model=o3-mini.low # specify a model
@@ -275,6 +278,7 @@ fast-agent bootstrap workflow # create "building effective agents" example
275
278
 
276
279
  Other bootstrap examples include a Researcher Agent (with Evaluator-Optimizer workflow) and Data Analysis Agent (similar to the ChatGPT experience), demonstrating MCP Roots support.
277
280
 
281
+ > [!TIP]
278
282
  > 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.
279
283
 
280
284
  ### Basic Agents
@@ -354,7 +358,7 @@ async def main():
354
358
  )
355
359
  ```
356
360
 
357
- All Agents and Workflows respond to `.send("message")` and `.prompt()` to begin a chat session.
361
+ All Agents and Workflows respond to `.send("message")` or `.prompt()` to begin a chat session.
358
362
 
359
363
  Saved as `social.py` we can now run this workflow from the command line with:
360
364
 
@@ -362,7 +366,7 @@ Saved as `social.py` we can now run this workflow from the command line with:
362
366
  uv run social.py --agent social_media --message "<url>"
363
367
  ```
364
368
 
365
- Add the `--quiet` switch to only return the final response.
369
+ Add the `--quiet` switch to only return the final response, which is useful for simple automations.
366
370
 
367
371
  ## Workflows
368
372
 
@@ -383,7 +387,7 @@ async with fast.run() as agent:
383
387
 
384
388
  ```
385
389
 
386
- This starts an interactive session, which produces a short social media post for a given URL. If a _chain_ is prompted, by default it returns to a chat with last Agent in the chain.
390
+ This starts an interactive session, which produces a short social media post for a given URL. If a _chain_ is prompted it returns to a chat with last Agent in the chain. You can switch the agent to prompt by typing `@agent-name`.
387
391
 
388
392
  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.
389
393
 
@@ -407,9 +411,9 @@ The Parallel Workflow sends the same message to multiple Agents simultaneously (
407
411
  )
408
412
  ```
409
413
 
410
- Look at the `parallel.py` workflow example for more examples. If you don't specify a `fan-in` agent, the `parallel` returns Agent results verbatim.
414
+ Look at the `parallel.py` workflow example for more examples. If you don't specify a `fan-in` agent, the `parallel` returns the combined Agent results verbatim.
411
415
 
412
- The Parallel is also useful to ensemble ideas from different LLMs.
416
+ `parallel` is also useful to ensemble ideas from different LLMs.
413
417
 
414
418
  ### Evaluator-Optimizer
415
419
 
@@ -458,20 +462,107 @@ See `orchestrator.py` in the workflow examples.
458
462
 
459
463
  ## Agent Features
460
464
 
465
+ ### Calling Agents
466
+
467
+ All definitions allow omitting the name and instructions arguments for brevity:
468
+
469
+ ```python
470
+ @fast.agent("You are a helpful agent") # Create an agent with a default name.
471
+ @fast.agent("greeter","Respond cheerfully!") # Create an agent with the name "greeter"
472
+
473
+ moon_size = await agent("the moon") # Call the default (first defined agent) with a message
474
+
475
+ result = await agent.greeter("Good morning!") # Send a message to an agent by name using dot notation
476
+ result = await agent.greeter.send("Hello!") # You can call 'send' explicitly
477
+
478
+ await agent.greeter() # If no message is specified, a chat session will open
479
+ await agent.greeter.prompt() # that can be made more explicit
480
+ await agent.greeter.prompt(default_prompt="OK") # and supports setting a default prompt
481
+
482
+ agent["greeter"].send("Good Evening!") # Dictionary access is supported if preferred
483
+ ```
484
+
485
+ ### Defining Agents
486
+
487
+ #### Basic Agent
488
+
461
489
  ```python
462
490
  @fast.agent(
463
- name="agent",
464
- instructions="instructions",
465
- servers=["filesystem"], # list of MCP Servers for the agent, configured in fastagent.config.yaml
466
- model="o3-mini.high", # specify a model for the agent
467
- use_history=True, # agent can maintain chat history
468
- human_input=True, # agent can request human input
491
+ name="agent", # name of the agent
492
+ instruction="You are a helpful Agent", # base instruction for the agent
493
+ servers=["filesystem"], # list of MCP Servers for the agent
494
+ model="o3-mini.high", # specify a model for the agent
495
+ use_history=True, # agent maintains chat history
496
+ request_params={"temperature": 0.7}, # additional parameters for the LLM (or RequestParams())
497
+ human_input=True, # agent can request human input
498
+ )
499
+ ```
500
+
501
+ #### Chain
502
+
503
+ ```python
504
+ @fast.chain(
505
+ name="chain", # name of the chain
506
+ sequence=["agent1", "agent2", ...], # list of agents in execution order
507
+ instruction="instruction", # instruction to describe the chain for other workflows
508
+ continue_with_final=True, # open chat with agent at end of chain after prompting
469
509
  )
470
510
  ```
471
511
 
472
- ### Human Input
512
+ #### Parallel
513
+
514
+ ```python
515
+ @fast.parallel(
516
+ name="parallel", # name of the parallel workflow
517
+ fan_out=["agent1", "agent2"], # list of agents to run in parallel
518
+ fan_in="aggregator", # name of agent that combines results (optional)
519
+ instruction="instruction", # instruction to describe the parallel for other workflows
520
+ include_request=True, # include original request in fan-in message
521
+ )
522
+ ```
473
523
 
474
- When `human_input` is set to true for an Agent, it is presented with the option to prompt the User for input.
524
+ #### Evaluator-Optimizer
525
+
526
+ ```python
527
+ @fast.evaluator_optimizer(
528
+ name="researcher", # name of the workflow
529
+ generator="web_searcher", # name of the content generator agent
530
+ evaluator="quality_assurance", # name of the evaluator agent
531
+ min_rating="GOOD", # minimum acceptable quality (EXCELLENT, GOOD, FAIR, POOR)
532
+ max_refinements=3, # maximum number of refinement iterations
533
+ )
534
+ ```
535
+
536
+ #### Router
537
+
538
+ ```python
539
+ @fast.router(
540
+ name="route", # name of the router
541
+ agents=["agent1", "agent2", "agent3"], # list of agent names router can delegate to
542
+ model="o3-mini.high", # specify routing model
543
+ use_history=True, # router maintains chat history
544
+ human_input=False, # whether router can request human input
545
+ )
546
+ ```
547
+
548
+ #### Orchestrator
549
+
550
+ ```python
551
+ @fast.orchestrator(
552
+ name="orchestrator", # name of the orchestrator
553
+ instruction="instruction", # base instruction for the orchestrator
554
+ agents=["agent1", "agent2"], # list of agent names this orchestrator can use
555
+ model="o3-mini.high", # specify orchestrator planning model
556
+ use_history=False, # orchestrator doesn't maintain chat history by default
557
+ human_input=False, # whether orchestrator can request human input
558
+ plan_type="full", # planning approach: "full" or "iterative"
559
+ )
560
+ ```
561
+
562
+ ### Secrets File
563
+
564
+ > [!TIP]
565
+ > 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.
475
566
 
476
567
  ## Project Notes
477
568
 
@@ -479,8 +570,11 @@ When `human_input` is set to true for an Agent, it is presented with the option
479
570
 
480
571
  ### llmindset.co.uk fork:
481
572
 
573
+ - Remove instructor use for Orchestrator
574
+ - Improved handling of Parallel/Fan-In and respose option
575
+ - XML based generated prompts
482
576
  - "FastAgent" style prototyping, with per-agent models
483
- - Api keys through Environment Variables
577
+ - API keys through Environment Variables
484
578
  - Warm-up / Post-Workflow Agent Interactions
485
579
  - Quick Setup
486
580
  - Interactive Prompt Mode
@@ -493,7 +587,12 @@ When `human_input` is set to true for an Agent, it is presented with the option
493
587
  - OpenAI o1/o3-mini support with reasoning level
494
588
  - Enhanced Human Input Messaging and Handling
495
589
  - Declarative workflows
590
+ - Numerous defect fixes
496
591
 
497
592
  ### Features to add.
498
593
 
499
594
  - Chat History Clear.
595
+
596
+ ```
597
+
598
+ ```
@@ -1,6 +1,6 @@
1
1
  mcp_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  mcp_agent/app.py,sha256=0_C1xmNZlk9qZoewnNI_mC7sSfO9oJgkOyiKkQ62MHU,10606
3
- mcp_agent/config.py,sha256=mShpoyIAGeyQKMH9gUCAXBZ2HNF3SM2KoMjSMpPQnmg,10210
3
+ mcp_agent/config.py,sha256=OpPTsk9gNm2IA1laUomAMkGA-pAlp5uILQpEPBjavQs,10644
4
4
  mcp_agent/console.py,sha256=Gjf2QLFumwG1Lav__c07X_kZxxEUSkzV-1_-YbAwcwo,813
5
5
  mcp_agent/context.py,sha256=qzwUrexZXVBzFiNkYI4xjztdGxuuiDWZbWrQgVhA-vE,8126
6
6
  mcp_agent/context_dependent.py,sha256=TGqRLzYCOnsWGoaD1HtrliYtWo8MeaWCQk6ePUmyYCw,1446
@@ -10,7 +10,7 @@ mcp_agent/progress_display.py,sha256=GeJU9VUt6qKsFVymG688hCMVCsAygG9ifiiEb5IcbN4
10
10
  mcp_agent/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  mcp_agent/agents/agent.py,sha256=losanPSdZXZzmeiX-J6ctOinLlkhNZsxwi3Swr8lnxA,11482
12
12
  mcp_agent/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- mcp_agent/cli/__main__.py,sha256=bhxe66GYqy0q78OQhi7dkuubY1Tn0bQL6hU5Nn47E34,73
13
+ mcp_agent/cli/__main__.py,sha256=AVZ7tQFhU_sDOGuUGJq8ujgKtcxsYJBJwHbVaaiRDlI,166
14
14
  mcp_agent/cli/main.py,sha256=cqRxYTpeZ656lzf9qLR3LPnQXrFVDxlWm5gRuqyzUQg,2456
15
15
  mcp_agent/cli/terminal.py,sha256=5fqrKlJvIpKEuvpvZ653OueQSYFFktBEbosjr2ucMUc,1026
16
16
  mcp_agent/cli/commands/bootstrap.py,sha256=z1wZSy8vO_GZPGLrFGzG3EKFQgAHC08jiIdVyylo-58,10778
@@ -20,7 +20,7 @@ mcp_agent/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  mcp_agent/core/agent_app.py,sha256=2gnORb52cpWYGjRDNTJ9lVCEEc11c7Xi874ho7bbYVQ,6097
21
21
  mcp_agent/core/agent_types.py,sha256=yKiMbv9QO2dduq4zXmoMZlOZpXJZhM4oNwIq1-134FE,318
22
22
  mcp_agent/core/agent_utils.py,sha256=yUJ-qvw5TblqqOsB1vj0Qvcz9mass9awPA6UNNvuw0A,1738
23
- mcp_agent/core/enhanced_prompt.py,sha256=0V5q0xcCk8PBwtc0p62B8JJ1VvqxN_wuJiXC2QPqv1M,12750
23
+ mcp_agent/core/enhanced_prompt.py,sha256=ka-uuGNW7XggaGzXZQFB9T4azej455VPcgO66Q_7jnY,13008
24
24
  mcp_agent/core/error_handling.py,sha256=D3HMW5odrbJvaKqcpCGj6eDXrbFcuqYaCZz7fyYiTu4,623
25
25
  mcp_agent/core/exceptions.py,sha256=a2-JGRwFFRoQEPuAq0JC5PhAJ5TO3xVJfdS4-VN29cw,2225
26
26
  mcp_agent/core/fastagent.py,sha256=MLMdQ4_Cjb2svWyGVWLGf8EzI3dSFCl4BS5qq8UrKgg,56966
@@ -54,7 +54,7 @@ mcp_agent/mcp/mcp_agent_server.py,sha256=xP09HZTeguJi4Fq0p3fjLBP55uSYe5AdqM90xCg
54
54
  mcp_agent/mcp/mcp_aggregator.py,sha256=RVsgNnSJ1IPBkqKgF_Gp-Cpv97FVBIdppPey6FRoHB0,14751
55
55
  mcp_agent/mcp/mcp_connection_manager.py,sha256=WLli0w3TVcsszyD9M7zP7vLKPetnQLTf_0PGhvMm9YM,13145
56
56
  mcp_agent/mcp/stdio.py,sha256=tW075R5rQ-UlflXWFKIFDgCbWbuhKqxhiYolWvyEkFs,3985
57
- mcp_agent/resources/examples/data-analysis/analysis.py,sha256=Sp-umPPfwVjG3yNrHdQA6blGtG6jc5of1e_0oS4njYc,1379
57
+ mcp_agent/resources/examples/data-analysis/analysis.py,sha256=1Ce68epq8j6yjgxkJeTtnLR4l5yq8ANGEZ2k1sIf6dw,2292
58
58
  mcp_agent/resources/examples/data-analysis/fastagent.config.yaml,sha256=eTKGbjnTHhDTeNRPQvG_fr9OQpEZ5Y9v7X2NyCj0V70,530
59
59
  mcp_agent/resources/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-Attrition.csv,sha256=pcMeOL1_r8m8MziE6xgbBrQbjl5Ijo98yycZn7O-dlk,227977
60
60
  mcp_agent/resources/examples/internal/agent.py,sha256=f-jTgYabV3nWCQm0ZP9NtSEWjx3nQbRngzArRufcELg,384
@@ -66,11 +66,11 @@ mcp_agent/resources/examples/researcher/researcher-eval.py,sha256=kNPjIU-JwE0oIB
66
66
  mcp_agent/resources/examples/researcher/researcher.py,sha256=jPRafm7jbpHKkX_dQiYGG3Sw-e1Dm86q-JZT-WZDhM0,1425
67
67
  mcp_agent/resources/examples/workflows/agent_build.py,sha256=vdjS02rZR88RU53WYzXxPscfFNEFFe_niHYE_i49I8Q,2396
68
68
  mcp_agent/resources/examples/workflows/chaining.py,sha256=1G_0XBcFkSJCOXb6N_iXWlSc_oGAlhENR0k_CN1vJKI,1208
69
- mcp_agent/resources/examples/workflows/evaluator.py,sha256=FZy-ciZafdqSHUW67LKdHw0t9rvX6X67waMOoeIN3GY,3147
69
+ mcp_agent/resources/examples/workflows/evaluator.py,sha256=aUotC9-soTjWgw5GAf9m74BKAHzwxRPBdnSb5ga3lY8,3072
70
70
  mcp_agent/resources/examples/workflows/fastagent.config.yaml,sha256=k2AiapOcK42uqG2nWDVvnSLqN4okQIQZK0FTbZufBpY,809
71
71
  mcp_agent/resources/examples/workflows/human_input.py,sha256=c8cBdLEPbaMXddFwsfN3Z7RFs5PZXsdrjANfvq1VTPM,605
72
72
  mcp_agent/resources/examples/workflows/orchestrator.py,sha256=pRJqB-ok79_iEj8aG4FysHyXz6wAHLUX-5tS8khUI7k,2574
73
- mcp_agent/resources/examples/workflows/parallel.py,sha256=dowCw6i8mVaWFWqLvyEEJz1kZDQqdeiltcM-hEz38iY,3222
73
+ mcp_agent/resources/examples/workflows/parallel.py,sha256=pLbQrtXfbdYqMVddxtg5dZnBnm5Wo2mXlIa1Vf2F1FQ,3096
74
74
  mcp_agent/resources/examples/workflows/router.py,sha256=XT_ewCrxPxdUTMCYQGw34qZQ3GGu8TYY_v5Lige8By4,1707
75
75
  mcp_agent/telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
76
  mcp_agent/telemetry/usage_tracking.py,sha256=ePujKMSjPxB7k6X34DGaVlnsV1728mcWZq38OqahiCU,501
@@ -80,7 +80,7 @@ mcp_agent/workflows/embedding/embedding_base.py,sha256=-c20ggQ8s7XhMxRX-WEhOgHE7
80
80
  mcp_agent/workflows/embedding/embedding_cohere.py,sha256=OKTJvKD_uEafd4c2uhR5tBjprea1nyvlJOO-3FDqOnk,1540
81
81
  mcp_agent/workflows/embedding/embedding_openai.py,sha256=dntjJ5P-FSMGYuyPZC8MuCU_ehwjXw9wDfzZZuSQN1E,1480
82
82
  mcp_agent/workflows/evaluator_optimizer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
83
- mcp_agent/workflows/evaluator_optimizer/evaluator_optimizer.py,sha256=r0ATtuc8JouBZz6iPc_dQ6g5oUZc7JXfbI9adKd2Wg8,13572
83
+ mcp_agent/workflows/evaluator_optimizer/evaluator_optimizer.py,sha256=NsRaRte0_zbGPrvwAZadvcgSpY3d5ugbfVHooHOcJfc,15706
84
84
  mcp_agent/workflows/intent_classifier/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
85
85
  mcp_agent/workflows/intent_classifier/intent_classifier_base.py,sha256=zTbOmq6EY_abOlme4zl28HM4RWNNS6bbHl3tF7SshJ0,4004
86
86
  mcp_agent/workflows/intent_classifier/intent_classifier_embedding.py,sha256=_bWZGukc_q9LdA_Q18UoAMSzhN8tt4K_bRHNUhy7Crw,3997
@@ -91,30 +91,31 @@ mcp_agent/workflows/intent_classifier/intent_classifier_llm_anthropic.py,sha256=
91
91
  mcp_agent/workflows/intent_classifier/intent_classifier_llm_openai.py,sha256=zj76WlTYnSCYjBQ_IDi5vFBQGmNwYaoUq1rT730sY98,1940
92
92
  mcp_agent/workflows/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
93
93
  mcp_agent/workflows/llm/augmented_llm.py,sha256=Hyx-jwgbMjE_WQ--YjIUvdj6HAgX36IvXBesGy6uic0,25884
94
- mcp_agent/workflows/llm/augmented_llm_anthropic.py,sha256=4hyC8xI8zTLm7NgbyQRoWRu2ycoTP4Qu6bnPXR1p9ow,22473
95
- mcp_agent/workflows/llm/augmented_llm_openai.py,sha256=5PwTh0QJSQ29EtK0UuiltgX6snRSBoau75C35S4xQcQ,24477
94
+ mcp_agent/workflows/llm/augmented_llm_anthropic.py,sha256=iHfbn7bwC-ICTajEhGwg9vP-UEj681kNmZ9Cv6H05s4,22968
95
+ mcp_agent/workflows/llm/augmented_llm_openai.py,sha256=a95Q4AFiVw36bXMgYNLFrC2zyDmHERWwkjxJFHlL6JU,25061
96
96
  mcp_agent/workflows/llm/llm_selector.py,sha256=G7pIybuBDwtmyxUDov_QrNYH2FoI0qFRu2JfoxWUF5Y,11045
97
97
  mcp_agent/workflows/llm/model_factory.py,sha256=7zTJrO2ReHa_6dfh_gY6xO8dTySqGFCKlOG9-AMJ-i8,6920
98
+ mcp_agent/workflows/llm/prompt_utils.py,sha256=EY3eddqnmc_YDUQJFysPnpTH6hr4r2HneeEmX76P8TQ,4948
98
99
  mcp_agent/workflows/orchestrator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
99
- mcp_agent/workflows/orchestrator/orchestrator.py,sha256=Fn5r0uUGNAiUq5NLFDjaJ04t19MnGEgr9iknbUj0DSA,14733
100
- mcp_agent/workflows/orchestrator/orchestrator_models.py,sha256=UWn7_HFLcqFGlcjZ1Rn2SYQfm5k9seS6QJN_FRST5Kc,4513
101
- mcp_agent/workflows/orchestrator/orchestrator_prompts.py,sha256=-ogkjDoCXBDOyYE9yk3qhjqq0LofsSpRvRZfWVzrVTE,4396
100
+ mcp_agent/workflows/orchestrator/orchestrator.py,sha256=dmj7CwTEHj0f8bTakijjvaOfJJ8ShgWwOWaCmFRiX7s,21933
101
+ mcp_agent/workflows/orchestrator/orchestrator_models.py,sha256=xTl2vUIqdLPvDAnqA485Hf_A3DD48TWhAbo-jfGrmRE,7182
102
+ mcp_agent/workflows/orchestrator/orchestrator_prompts.py,sha256=eJSQThfd6Jvr1jTDx104sJI5R684yE55L_edCiWERsQ,6153
102
103
  mcp_agent/workflows/parallel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
103
104
  mcp_agent/workflows/parallel/fan_in.py,sha256=EivpUL5-qftctws-tlfwmYS1QeSwr07POIbBUbwvwOk,13184
104
105
  mcp_agent/workflows/parallel/fan_out.py,sha256=J-yezgjzAWxfueW_Qcgwoet4PFDRIh0h4m48lIbFA4c,7023
105
106
  mcp_agent/workflows/parallel/parallel_llm.py,sha256=fk88DhBRAI41Ph0spe_yBtrMTSj0g47yoA-ozuOxZhE,5807
106
107
  mcp_agent/workflows/router/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
107
- mcp_agent/workflows/router/router_base.py,sha256=1Qr3Fx9_KxpotMV-eaNT79etayAxWuQOmanDfk1qjtI,10250
108
+ mcp_agent/workflows/router/router_base.py,sha256=S-UxofpdW9e7ZQXaZcSE8zBY--6W0m5qc0lw6BZi0ug,14336
108
109
  mcp_agent/workflows/router/router_embedding.py,sha256=wEU49li9OqTX-Xucm0HDUFLZjlND1WuewOcQVAo0s2E,7944
109
110
  mcp_agent/workflows/router/router_embedding_cohere.py,sha256=aKZVzzQfBuz0by9k0zWLAA0Db_unDIMYL4ynVzzx8C4,1975
110
111
  mcp_agent/workflows/router/router_embedding_openai.py,sha256=KqW2IFLdQoAJ2lIz1X18WQJFjXF-YSFSTtsqVnp1JeI,1975
111
- mcp_agent/workflows/router/router_llm.py,sha256=xRLzFt8UvJT9PZNHIVDr8DguWqHFi-MJ-uGALL5Ahzw,10639
112
+ mcp_agent/workflows/router/router_llm.py,sha256=jnOK5NHK7zUk-80kJ7HS4p7CGKe3vUA1aZ8-MMflUSA,11030
112
113
  mcp_agent/workflows/swarm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
113
114
  mcp_agent/workflows/swarm/swarm.py,sha256=-lAIeSWDqbGHGRPTvjiP9nIKWvxxy9DAojl9yQzO1Pw,11050
114
115
  mcp_agent/workflows/swarm/swarm_anthropic.py,sha256=pW8zFx5baUWGd5Vw3nIDF2oVOOGNorij4qvGJKdYPcs,1624
115
116
  mcp_agent/workflows/swarm/swarm_openai.py,sha256=wfteywvAGkT5bLmIxX_StHJq8144whYmCRnJASAjOes,1596
116
- fast_agent_mcp-0.0.15.dist-info/METADATA,sha256=KL03PExGMGz9tQ9E72MKAnDS6Fi6rSGjoqyYAV3JLd4,22779
117
- fast_agent_mcp-0.0.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
118
- fast_agent_mcp-0.0.15.dist-info/entry_points.txt,sha256=2IXtSmDK9XjWN__RWuRIJTgWyW17wJnJ_h-pb0pZAxo,174
119
- fast_agent_mcp-0.0.15.dist-info/licenses/LICENSE,sha256=cN3FxDURL9XuzE5mhK9L2paZo82LTfjwCYVT7e3j0e4,10939
120
- fast_agent_mcp-0.0.15.dist-info/RECORD,,
117
+ fast_agent_mcp-0.0.16.dist-info/METADATA,sha256=8lvkk2i0uitUQtc30LcOd7Wdak4uflU0aXO_Ve37X1Y,26857
118
+ fast_agent_mcp-0.0.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
119
+ fast_agent_mcp-0.0.16.dist-info/entry_points.txt,sha256=2IXtSmDK9XjWN__RWuRIJTgWyW17wJnJ_h-pb0pZAxo,174
120
+ fast_agent_mcp-0.0.16.dist-info/licenses/LICENSE,sha256=cN3FxDURL9XuzE5mhK9L2paZo82LTfjwCYVT7e3j0e4,10939
121
+ fast_agent_mcp-0.0.16.dist-info/RECORD,,
mcp_agent/cli/__main__.py CHANGED
@@ -1,4 +1,7 @@
1
1
  from mcp_agent.cli.main import app
2
2
 
3
+ # This must be here for the console entry points defined in pyproject.toml
4
+ # DO NOT REMOVE!
5
+
3
6
  if __name__ == "__main__":
4
7
  app()
mcp_agent/config.py CHANGED
@@ -313,17 +313,25 @@ def get_settings(config_path: str | None = None) -> Settings:
313
313
  with open(config_file, "r", encoding="utf-8") as f:
314
314
  yaml_settings = yaml.safe_load(f) or {}
315
315
  merged_settings = yaml_settings
316
-
317
- # Look for secrets file in the same directory
318
- for secrets_file in [
319
- config_file.parent / "mcp-agent.secrets.yaml",
320
- config_file.parent / "mcp_agent.secrets.yaml",
321
- config_file.parent / "fastagent.secrets.yaml",
322
- ]:
323
- if secrets_file.exists():
324
- with open(secrets_file, "r", encoding="utf-8") as f:
325
- yaml_secrets = yaml.safe_load(f) or {}
326
- merged_settings = deep_merge(merged_settings, yaml_secrets)
316
+ # Look for secrets files recursively up the directory tree
317
+ # but stop after finding the first one
318
+ current_dir = config_file.parent
319
+ found_secrets = False
320
+ while current_dir != current_dir.parent and not found_secrets:
321
+ for secrets_filename in [
322
+ "mcp-agent.secrets.yaml",
323
+ "mcp_agent.secrets.yaml",
324
+ "fastagent.secrets.yaml",
325
+ ]:
326
+ secrets_file = current_dir / secrets_filename
327
+ if secrets_file.exists():
328
+ with open(secrets_file, "r", encoding="utf-8") as f:
329
+ yaml_secrets = yaml.safe_load(f) or {}
330
+ merged_settings = deep_merge(merged_settings, yaml_secrets)
331
+ found_secrets = True
332
+ break
333
+ if not found_secrets:
334
+ current_dir = current_dir.parent
327
335
 
328
336
  _settings = Settings(**merged_settings)
329
337
  return _settings
@@ -3,6 +3,7 @@ Enhanced prompt functionality with advanced prompt_toolkit features.
3
3
  """
4
4
 
5
5
  from typing import List
6
+ from importlib.metadata import version
6
7
  from prompt_toolkit import PromptSession
7
8
  from prompt_toolkit.formatted_text import HTML
8
9
  from prompt_toolkit.history import InMemoryHistory
@@ -15,6 +16,12 @@ from rich import print as rich_print
15
16
 
16
17
  from mcp_agent.core.exceptions import PromptExitError
17
18
 
19
+ # Get the application version
20
+ try:
21
+ app_version = version("fast-agent-mcp")
22
+ except: # noqa: E722
23
+ app_version = "unknown"
24
+
18
25
  # Map of agent names to their history
19
26
  agent_histories = {}
20
27
 
@@ -204,7 +211,7 @@ async def get_enhanced_input(
204
211
 
205
212
  shortcut_text = " | ".join(f"{key}:{action}" for key, action in shortcuts)
206
213
  return HTML(
207
- f" <{toolbar_color}> {agent_name} </{toolbar_color}> | <b>Mode:</b> <{mode_style}> {mode_text} </{mode_style}> {newline} | {shortcut_text}"
214
+ f" <{toolbar_color}> {agent_name} </{toolbar_color}> | <b>Mode:</b> <{mode_style}> {mode_text} </{mode_style}> {newline} | {shortcut_text} | <dim>v{app_version}</dim>"
208
215
  )
209
216
 
210
217
  # Create session with history and completions
@@ -318,7 +325,8 @@ async def handle_special_commands(command, agent_app=None):
318
325
  rich_print(
319
326
  " Enter - Submit (normal mode) / New line (multiline mode)"
320
327
  )
321
- rich_print(" Ctrl+Enter - Always submit (even in multiline mode)")
328
+ rich_print(" \\ + Enter - Insert new line in normal mode")
329
+ rich_print(" Ctrl+Enter - Always submit (in any mode)")
322
330
  rich_print(" Ctrl+T - Toggle multiline mode")
323
331
  rich_print(" Ctrl+L - Clear input")
324
332
  rich_print(" Up/Down - Navigate history")
@@ -1,6 +1,7 @@
1
1
  import asyncio
2
2
 
3
3
  from mcp_agent.core.fastagent import FastAgent
4
+ from mcp_agent.workflows.llm.augmented_llm import RequestParams
4
5
 
5
6
  # Create the application
6
7
  fast = FastAgent("Data Analysis (Roots)")
@@ -16,18 +17,43 @@ Data files are accessible from the /mnt/data/ directory (this is the current wor
16
17
  Visualisations should be saved as .png files in the current working directory.
17
18
  """,
18
19
  servers=["interpreter"],
20
+ request_params=RequestParams(maxTokens=8192),
21
+ )
22
+ @fast.agent(
23
+ "evaluator",
24
+ """You are collaborating with a Data Analysis tool that has the capability to analyse data and produce visualisations.
25
+ You must make sure that the tool has:
26
+ - Considered the best way for a Human to interpret the data
27
+ - Produced insightful visualasions.
28
+ - Provided a high level summary report for the Human.
29
+ - Has had its findings challenged, and justified
30
+ """,
31
+ request_params=RequestParams(maxTokens=8192),
32
+ )
33
+ @fast.evaluator_optimizer(
34
+ "analysis_tool",
35
+ generator="data_analysis",
36
+ evaluator="evaluator",
37
+ max_refinements=3,
38
+ min_rating="EXCELLENT",
39
+ )
40
+ @fast.passthrough(
41
+ "sample",
19
42
  )
20
43
  async def main():
21
44
  # Use the app's context manager
22
45
  async with fast.run() as agent:
23
- await agent(
24
- "There is a csv file in the current directory. "
25
- "Analyse the file, produce a detailed description of the data, and any patterns it contains.",
26
- )
27
- await agent(
28
- "Consider the data, and how to usefully group it for presentation to a Human. Find insights, using the Python Interpreter as needed.\n"
29
- "Use MatPlotLib to produce insightful visualisations. Save them as '.png' files in the current directory. Be sure to run the code and save the files.\n"
30
- "Produce a summary with major insights to the data",
46
+ # await agent(
47
+ # "There is a csv file in the current directory. "
48
+ # "Analyse the file, produce a detailed description of the data, and any patterns it contains.",
49
+ # )
50
+ # await agent(
51
+ # "Consider the data, and how to usefully group it for presentation to a Human. Find insights, using the Python Interpreter as needed.\n"
52
+ # "Use MatPlotLib to produce insightful visualisations. Save them as '.png' files in the current directory. Be sure to run the code and save the files.\n"
53
+ # "Produce a summary with major insights to the data",
54
+ # )
55
+ await agent.analysis_tool.prompt(
56
+ "Analyse the CSV File in the working directory"
31
57
  )
32
58
 
33
59
 
@@ -38,8 +38,6 @@ fast = FastAgent("Evaluator-Optimizer")
38
38
  Summarize your evaluation as a structured response with:
39
39
  - Overall quality rating.
40
40
  - Specific feedback and areas for improvement.""",
41
- # instructor doesn't seem to work for sonnet37
42
- # model="sonnet35",
43
41
  )
44
42
  # Define the evaluator-optimizer workflow
45
43
  @fast.evaluator_optimizer(
@@ -60,10 +60,6 @@ and whispers of a hidden agenda linger among the villagers.
60
60
  and give an overall grade based on the feedback.""",
61
61
  model="o3-mini.low",
62
62
  )
63
- @fast.agent(
64
- name="cats-to-dogs",
65
- instruction="you should take any text, and change references about cats to dogs",
66
- )
67
63
  @fast.parallel(
68
64
  fan_out=["proofreader", "fact_checker", "style_enforcer"],
69
65
  fan_in="grader",
@@ -316,23 +316,50 @@ class EvaluatorOptimizerLLM(AugmentedLLM[MessageParamT, MessageT]):
316
316
  ) -> str:
317
317
  """Build the evaluation prompt for the evaluator"""
318
318
  return f"""
319
- Evaluate the following response based on these criteria:
320
- {self.evaluator.instruction}
321
-
322
- Original Request: {original_request}
323
- Current Response (Iteration {iteration + 1}): {current_response}
324
-
325
- Provide your evaluation as a structured response with:
326
- 1. A quality rating (EXCELLENT, GOOD, FAIR, or POOR)
327
- 2. Specific feedback and suggestions
328
- 3. Whether improvement is needed (true/false)
329
- 4. Focus areas for improvement
330
-
331
- Rate as EXCELLENT only if no improvements are needed.
332
- Rate as GOOD if only minor improvements are possible.
333
- Rate as FAIR if several improvements are needed.
334
- Rate as POOR if major improvements are needed.
335
- """
319
+ You are an expert evaluator for content quality. Your task is to evaluate a response against the user's original request.
320
+
321
+ Evaluate the response for iteration {iteration + 1} and provide structured feedback on its quality and areas for improvement.
322
+
323
+ <fastagent:data>
324
+ <fastagent:request>
325
+ {original_request}
326
+ </fastagent:request>
327
+
328
+ <fastagent:response>
329
+ {current_response}
330
+ </fastagent:response>
331
+
332
+ <fastagent:evaluation-criteria>
333
+ {self.evaluator.instruction}
334
+ </fastagent:evaluation-criteria>
335
+ </fastagent:data>
336
+
337
+ <fastagent:instruction>
338
+ Provide a structured evaluation with the following components:
339
+
340
+ <rating>
341
+ Choose one: EXCELLENT, GOOD, FAIR, or POOR
342
+ - EXCELLENT: No improvements needed
343
+ - GOOD: Only minor improvements possible
344
+ - FAIR: Several improvements needed
345
+ - POOR: Major improvements needed
346
+ </rating>
347
+
348
+ <details>
349
+ Provide specific, actionable feedback and suggestions for improvement.
350
+ Be precise about what works well and what could be improved.
351
+ </details>
352
+
353
+ <needs_improvement>
354
+ Indicate true/false whether further improvement is needed.
355
+ </needs_improvement>
356
+
357
+ <focus-areas>
358
+ List 1-3 specific areas to focus on in the next iteration.
359
+ Be concrete and actionable in your recommendations.
360
+ </focus-areas>
361
+ </fastagent:instruction>
362
+ """
336
363
 
337
364
  def _build_refinement_prompt(
338
365
  self,
@@ -342,17 +369,71 @@ class EvaluatorOptimizerLLM(AugmentedLLM[MessageParamT, MessageT]):
342
369
  iteration: int,
343
370
  ) -> str:
344
371
  """Build the refinement prompt for the optimizer"""
345
- return f"""
346
- Improve your previous response based on the evaluation feedback.
347
-
348
- Original Request: {original_request}
349
-
350
- Previous Response (Iteration {iteration + 1}):
351
- {current_response}
352
-
353
- Quality Rating: {feedback.rating}
354
- Feedback: {feedback.feedback}
355
- Areas to Focus On: {", ".join(feedback.focus_areas)}
356
-
357
- Generate an improved version addressing the feedback while maintaining accuracy and relevance.
358
- """
372
+ history_enabled = hasattr(self, "history") and self.history
373
+
374
+ # Start with clear non-delimited instructions
375
+ prompt = f"""
376
+ You are tasked with improving a response based on expert feedback. This is iteration {iteration + 1} of the refinement process.
377
+
378
+ Your goal is to address all feedback points while maintaining accuracy and relevance to the original request.
379
+ """
380
+
381
+ # Add data section with all relevant information
382
+ prompt += """
383
+ <fastagent:data>
384
+ """
385
+
386
+ # Add request
387
+ prompt += f"""
388
+ <fastagent:request>
389
+ {original_request}
390
+ </fastagent:request>
391
+ """
392
+
393
+ # Only include previous response if history is not enabled
394
+ if not history_enabled:
395
+ prompt += f"""
396
+ <fastagent:previous-response>
397
+ {current_response}
398
+ </fastagent:previous-response>
399
+ """
400
+
401
+ # Always include the feedback
402
+ prompt += f"""
403
+ <fastagent:feedback>
404
+ <rating>{feedback.rating}</rating>
405
+ <details>{feedback.feedback}</details>
406
+ <focus-areas>{", ".join(feedback.focus_areas) if feedback.focus_areas else "None specified"}</focus-areas>
407
+ </fastagent:feedback>
408
+ </fastagent:data>
409
+ """
410
+
411
+ # Customize instruction based on history availability
412
+ if not history_enabled:
413
+ prompt += """
414
+ <fastagent:instruction>
415
+ Create an improved version of the response that:
416
+ 1. Directly addresses each point in the feedback
417
+ 2. Focuses on the specific areas mentioned for improvement
418
+ 3. Maintains all the strengths of the original response
419
+ 4. Remains accurate and relevant to the original request
420
+
421
+ Provide your complete improved response without explanations or commentary.
422
+ </fastagent:instruction>
423
+ """
424
+ else:
425
+ prompt += """
426
+ <fastagent:instruction>
427
+ Your previous response is available in your conversation history.
428
+
429
+ Create an improved version that:
430
+ 1. Directly addresses each point in the feedback
431
+ 2. Focuses on the specific areas mentioned for improvement
432
+ 3. Maintains all the strengths of your original response
433
+ 4. Remains accurate and relevant to the original request
434
+
435
+ Provide your complete improved response without explanations or commentary.
436
+ </fastagent:instruction>
437
+ """
438
+
439
+ return prompt