fast-agent-mcp 0.0.14__tar.gz → 0.0.16__tar.gz

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.
Files changed (125) hide show
  1. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/PKG-INFO +159 -39
  2. fast_agent_mcp-0.0.16/README.md +361 -0
  3. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/pyproject.toml +1 -1
  4. fast_agent_mcp-0.0.16/src/mcp_agent/cli/__main__.py +7 -0
  5. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/config.py +19 -11
  6. fast_agent_mcp-0.0.16/src/mcp_agent/core/agent_app.py +163 -0
  7. fast_agent_mcp-0.0.16/src/mcp_agent/core/agent_types.py +16 -0
  8. fast_agent_mcp-0.0.16/src/mcp_agent/core/agent_utils.py +65 -0
  9. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/core/enhanced_prompt.py +10 -2
  10. fast_agent_mcp-0.0.16/src/mcp_agent/core/error_handling.py +23 -0
  11. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/core/fastagent.py +220 -306
  12. fast_agent_mcp-0.0.16/src/mcp_agent/core/proxies.py +127 -0
  13. fast_agent_mcp-0.0.16/src/mcp_agent/core/types.py +22 -0
  14. fast_agent_mcp-0.0.16/src/mcp_agent/resources/examples/data-analysis/analysis.py +61 -0
  15. fast_agent_mcp-0.0.16/src/mcp_agent/resources/examples/internal/social.py +66 -0
  16. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/workflows/evaluator.py +0 -2
  17. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/evaluator_optimizer/evaluator_optimizer.py +112 -31
  18. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/llm/augmented_llm.py +75 -1
  19. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/llm/augmented_llm_anthropic.py +65 -20
  20. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/llm/augmented_llm_openai.py +13 -1
  21. fast_agent_mcp-0.0.16/src/mcp_agent/workflows/llm/prompt_utils.py +137 -0
  22. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/orchestrator/orchestrator.py +206 -52
  23. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/orchestrator/orchestrator_models.py +81 -9
  24. fast_agent_mcp-0.0.16/src/mcp_agent/workflows/orchestrator/orchestrator_prompts.py +188 -0
  25. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/parallel/parallel_llm.py +32 -7
  26. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/router/router_base.py +113 -21
  27. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/router/router_llm.py +19 -5
  28. fast_agent_mcp-0.0.14/README.md +0 -241
  29. fast_agent_mcp-0.0.14/src/mcp_agent/cli/__main__.py +0 -4
  30. fast_agent_mcp-0.0.14/src/mcp_agent/resources/examples/data-analysis/analysis.py +0 -35
  31. fast_agent_mcp-0.0.14/src/mcp_agent/workflows/orchestrator/orchestrator_prompts.py +0 -118
  32. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/.gitignore +0 -0
  33. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/LICENSE +0 -0
  34. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/__init__.py +0 -0
  35. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/agents/__init__.py +0 -0
  36. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/agents/agent.py +0 -0
  37. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/app.py +0 -0
  38. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/cli/__init__.py +0 -0
  39. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/cli/commands/bootstrap.py +0 -0
  40. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/cli/commands/config.py +0 -0
  41. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/cli/commands/setup.py +0 -0
  42. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/cli/main.py +0 -0
  43. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/cli/terminal.py +0 -0
  44. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/console.py +0 -0
  45. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/context.py +0 -0
  46. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/context_dependent.py +0 -0
  47. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/core/__init__.py +0 -0
  48. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/core/exceptions.py +0 -0
  49. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/core/server_validation.py +0 -0
  50. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/eval/__init__.py +0 -0
  51. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/event_progress.py +0 -0
  52. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/executor/__init__.py +0 -0
  53. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/executor/decorator_registry.py +0 -0
  54. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/executor/executor.py +0 -0
  55. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/executor/task_registry.py +0 -0
  56. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/executor/temporal.py +0 -0
  57. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/executor/workflow.py +0 -0
  58. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/executor/workflow_signal.py +0 -0
  59. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/human_input/__init__.py +0 -0
  60. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/human_input/handler.py +0 -0
  61. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/human_input/types.py +0 -0
  62. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/logging/__init__.py +0 -0
  63. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/logging/events.py +0 -0
  64. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/logging/json_serializer.py +0 -0
  65. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/logging/listeners.py +0 -0
  66. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/logging/logger.py +0 -0
  67. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/logging/rich_progress.py +0 -0
  68. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/logging/tracing.py +0 -0
  69. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/logging/transport.py +0 -0
  70. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/mcp/__init__.py +0 -0
  71. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/mcp/gen_client.py +0 -0
  72. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/mcp/mcp_activity.py +0 -0
  73. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/mcp/mcp_agent_client_session.py +0 -0
  74. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/mcp/mcp_agent_server.py +0 -0
  75. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/mcp/mcp_aggregator.py +0 -0
  76. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/mcp/mcp_connection_manager.py +0 -0
  77. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/mcp/stdio.py +0 -0
  78. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/mcp_server_registry.py +0 -0
  79. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/progress_display.py +0 -0
  80. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/data-analysis/fastagent.config.yaml +0 -0
  81. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-Attrition.csv +0 -0
  82. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/internal/agent.py +0 -0
  83. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/internal/job.py +0 -0
  84. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/mcp_researcher/researcher-eval.py +0 -0
  85. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/researcher/fastagent.config.yaml +0 -0
  86. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/researcher/researcher-eval.py +0 -0
  87. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/researcher/researcher.py +0 -0
  88. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/workflows/agent_build.py +0 -0
  89. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/workflows/chaining.py +0 -0
  90. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/workflows/fastagent.config.yaml +0 -0
  91. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/workflows/human_input.py +0 -0
  92. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/workflows/orchestrator.py +0 -0
  93. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/workflows/parallel.py +0 -0
  94. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/resources/examples/workflows/router.py +0 -0
  95. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/telemetry/__init__.py +0 -0
  96. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/telemetry/usage_tracking.py +0 -0
  97. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/__init__.py +0 -0
  98. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/embedding/__init__.py +0 -0
  99. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/embedding/embedding_base.py +0 -0
  100. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/embedding/embedding_cohere.py +0 -0
  101. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/embedding/embedding_openai.py +0 -0
  102. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/evaluator_optimizer/__init__.py +0 -0
  103. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/intent_classifier/__init__.py +0 -0
  104. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/intent_classifier/intent_classifier_base.py +0 -0
  105. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/intent_classifier/intent_classifier_embedding.py +0 -0
  106. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/intent_classifier/intent_classifier_embedding_cohere.py +0 -0
  107. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/intent_classifier/intent_classifier_embedding_openai.py +0 -0
  108. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/intent_classifier/intent_classifier_llm.py +0 -0
  109. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/intent_classifier/intent_classifier_llm_anthropic.py +0 -0
  110. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/intent_classifier/intent_classifier_llm_openai.py +0 -0
  111. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/llm/__init__.py +0 -0
  112. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/llm/llm_selector.py +0 -0
  113. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/llm/model_factory.py +0 -0
  114. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/orchestrator/__init__.py +0 -0
  115. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/parallel/__init__.py +0 -0
  116. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/parallel/fan_in.py +0 -0
  117. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/parallel/fan_out.py +0 -0
  118. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/router/__init__.py +0 -0
  119. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/router/router_embedding.py +0 -0
  120. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/router/router_embedding_cohere.py +0 -0
  121. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/router/router_embedding_openai.py +0 -0
  122. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/swarm/__init__.py +0 -0
  123. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/swarm/swarm.py +0 -0
  124. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/swarm/swarm_anthropic.py +0 -0
  125. {fast_agent_mcp-0.0.14 → fast_agent_mcp-0.0.16}/src/mcp_agent/workflows/swarm/swarm_openai.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fast-agent-mcp
3
- Version: 0.0.14
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
@@ -247,7 +247,7 @@ Description-Content-Type: text/markdown
247
247
 
248
248
  ## Overview
249
249
 
250
- **`fast-agent`** lets you build and interact with Agents and Workflows in minutes.
250
+ **`fast-agent`** enables you to create and interact with sophisticated Agents and Workflows in minutes.
251
251
 
252
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
 
@@ -257,14 +257,19 @@ Evaluate how different models handle Agent and MCP Server calling tasks, then bu
257
257
 
258
258
  Prompts and configurations that define your Agent Applications are stored in simple files, with minimal boilerplate, enabling simple management and version control.
259
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.
260
+ Chat with individual Agents and Components before, during and after workflow execution to tune and diagnose your application.
261
+
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)
261
265
 
262
266
  ## Get started:
263
267
 
264
268
  Start by installing the [uv package manager](https://docs.astral.sh/uv/) for Python. Then:
265
269
 
266
270
  ```bash
267
- uv pip install fast-agent-mcp # install fast-agent
271
+ uv pip install fast-agent-mcp # install fast-agent!
272
+
268
273
  fast-agent setup # create an example agent and config files
269
274
  uv run agent.py # run your first agent
270
275
  uv run agent.py --model=o3-mini.low # specify a model
@@ -273,6 +278,7 @@ fast-agent bootstrap workflow # create "building effective agents" example
273
278
 
274
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.
275
280
 
281
+ > [!TIP]
276
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.
277
283
 
278
284
  ### Basic Agents
@@ -294,12 +300,14 @@ async with fast.run() as agent:
294
300
  ```
295
301
 
296
302
  Or start an interactive chat with the Agent:
303
+
297
304
  ```python
298
- async with fast.run() as agent:
305
+ async with fast.run() as agent:
299
306
  await agent()
300
307
  ```
301
308
 
302
309
  Here is the complete `sizer.py` Agent application, with boilerplate code:
310
+
303
311
  ```python
304
312
  import asyncio
305
313
  from mcp_agent.core.fastagent import FastAgent
@@ -319,22 +327,25 @@ if __name__ == "__main__":
319
327
  asyncio.run(main())
320
328
  ```
321
329
 
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`.
330
+ The Agent can then be run with `uv run sizer.py`.
331
+
332
+ Specify a model with the `--model` switch - for example `uv run sizer.py --model sonnet`.
323
333
 
324
334
  ### Combining Agents and using MCP Servers
325
335
 
326
336
  _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
337
 
328
- Agents can be chained to build a workflow:
338
+ Agents can be chained to build a workflow, using MCP Servers defined in the `fastagent.config.yaml` file:
339
+
329
340
  ```python
330
341
  @fast.agent(
331
342
  "url_fetcher",
332
- instruction="Given a URL, provide a complete and comprehensive summary",
343
+ "Given a URL, provide a complete and comprehensive summary",
333
344
  servers=["fetch"], # Name of an MCP Server defined in fastagent.config.yaml
334
345
  )
335
346
  @fast.agent(
336
347
  "social_media",
337
- instruction="""
348
+ """
338
349
  Write a 280 character social media post for any given text.
339
350
  Respond only with the post, never use hashtags.
340
351
  """,
@@ -347,53 +358,66 @@ async def main():
347
358
  )
348
359
  ```
349
360
 
350
- All Agents and Workflows respond to `.send("message")` to send a message and `.prompt()` to begin a chat session.
361
+ All Agents and Workflows respond to `.send("message")` or `.prompt()` to begin a chat session.
362
+
363
+ Saved as `social.py` we can now run this workflow from the command line with:
364
+
365
+ ```bash
366
+ uv run social.py --agent social_media --message "<url>"
367
+ ```
368
+
369
+ Add the `--quiet` switch to only return the final response, which is useful for simple automations.
351
370
 
352
371
  ## Workflows
353
372
 
354
373
  ### Chain
355
374
 
356
- Alternatively, use the `chain` workflow type and the `prompt()` method to capture user input:
375
+ The `chain` workflow offers a more declarative approach to calling Agents in sequence:
376
+
357
377
  ```python
358
378
 
359
379
  @fast.chain(
360
380
  "post_writer",
361
- sequence=["url_fetcher","social_media"]
381
+ sequence=["url_fetcher","social_media"]
362
382
  )
363
383
 
364
384
  # we can them prompt it directly:
365
385
  async with fast.run() as agent:
366
- await agent.post_writer.prompt()
386
+ await agent.post_writer()
367
387
 
368
388
  ```
389
+
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`.
391
+
369
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.
370
393
 
371
394
  ### Parallel
372
395
 
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.
396
+ 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
397
 
375
398
  ```python
376
-
377
- @fast.agent(
378
- name="consolidator"
379
- instruction="combine the lists, remove duplicates"
380
- )
399
+ @fast.agent("translate_fr", "Translate the text to French")
400
+ @fast.agent("translate_de", "Translate the text to German")
401
+ @fast.agent("translate_es", "Translate the text to Spanish")
381
402
 
382
403
  @fast.parallel(
383
- name="ensemble"
384
- fan_out=["agent_o3-mini","agent_sonnet37",...]
385
- fan_in="consolidator"
404
+ name="translate",
405
+ fan_out=["translate_fr","translate_de","translate_es"]
386
406
  )
387
407
 
388
- async with fast.run() as agent:
389
- result = agent.ensemble.send("what are the 10 most important aspects of project management")
408
+ @fast.chain(
409
+ "post_writer",
410
+ sequence=["url_fetcher","social_media","translate"]
411
+ )
390
412
  ```
391
413
 
392
- Look at the `parallel.py` workflow example for more details.
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.
415
+
416
+ `parallel` is also useful to ensemble ideas from different LLMs.
393
417
 
394
418
  ### Evaluator-Optimizer
395
419
 
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.
420
+ Evaluator-Optimizers combine 2 agents: one to generate content (the `generator`), and the other to judge that 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
421
 
398
422
  ```python
399
423
  @fast.evaluator_optimizer(
@@ -408,11 +432,11 @@ async with fast.run() as agent:
408
432
  await agent.researcher.send("produce a report on how to make the perfect espresso")
409
433
  ```
410
434
 
411
- See the `evaluator.py` workflow example, or `fast-agent bootstrap researcher` for a more complete example.
435
+ See the `evaluator.py` workflow example, or `fast-agent bootstrap researcher` for a more complete example.
412
436
 
413
437
  ### Router
414
438
 
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.
439
+ Routers use an LLM to assess a message, and route it to the most appropriate Agent. The routing prompt is automatically generated based on the Agent instructions and available Servers.
416
440
 
417
441
  ```python
418
442
  @fast.router(
@@ -425,7 +449,7 @@ Look at the `router.py` workflow for an example.
425
449
 
426
450
  ### Orchestrator
427
451
 
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"`).
452
+ Given a complex task, the Orchestrator uses an LLM to generate a plan to divide the task amongst the available Agents. 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
453
 
430
454
  ```python
431
455
  @fast.orchestrator(
@@ -434,22 +458,111 @@ Given a task, an Orchestrator uses an LLM to generate a plan to divide the task
434
458
  )
435
459
  ```
436
460
 
461
+ See `orchestrator.py` in the workflow examples.
462
+
437
463
  ## Agent Features
438
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
+
439
489
  ```python
440
490
  @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
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
509
+ )
510
+ ```
511
+
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
+ ```
523
+
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
447
533
  )
448
534
  ```
449
535
 
450
- ### Human Input
536
+ #### Router
451
537
 
452
- When `human_input` is set to true for an Agent, it is presented with the option to prompt the User for input.
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.
453
566
 
454
567
  ## Project Notes
455
568
 
@@ -457,8 +570,11 @@ When `human_input` is set to true for an Agent, it is presented with the option
457
570
 
458
571
  ### llmindset.co.uk fork:
459
572
 
573
+ - Remove instructor use for Orchestrator
574
+ - Improved handling of Parallel/Fan-In and respose option
575
+ - XML based generated prompts
460
576
  - "FastAgent" style prototyping, with per-agent models
461
- - Api keys through Environment Variables
577
+ - API keys through Environment Variables
462
578
  - Warm-up / Post-Workflow Agent Interactions
463
579
  - Quick Setup
464
580
  - Interactive Prompt Mode
@@ -471,8 +587,12 @@ When `human_input` is set to true for an Agent, it is presented with the option
471
587
  - OpenAI o1/o3-mini support with reasoning level
472
588
  - Enhanced Human Input Messaging and Handling
473
589
  - Declarative workflows
590
+ - Numerous defect fixes
474
591
 
475
592
  ### Features to add.
476
593
 
477
- - Chat History Clear.
594
+ - Chat History Clear.
595
+
596
+ ```
478
597
 
598
+ ```