fast-agent-mcp 0.4.7__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.
Files changed (261) hide show
  1. fast_agent/__init__.py +183 -0
  2. fast_agent/acp/__init__.py +19 -0
  3. fast_agent/acp/acp_aware_mixin.py +304 -0
  4. fast_agent/acp/acp_context.py +437 -0
  5. fast_agent/acp/content_conversion.py +136 -0
  6. fast_agent/acp/filesystem_runtime.py +427 -0
  7. fast_agent/acp/permission_store.py +269 -0
  8. fast_agent/acp/server/__init__.py +5 -0
  9. fast_agent/acp/server/agent_acp_server.py +1472 -0
  10. fast_agent/acp/slash_commands.py +1050 -0
  11. fast_agent/acp/terminal_runtime.py +408 -0
  12. fast_agent/acp/tool_permission_adapter.py +125 -0
  13. fast_agent/acp/tool_permissions.py +474 -0
  14. fast_agent/acp/tool_progress.py +814 -0
  15. fast_agent/agents/__init__.py +85 -0
  16. fast_agent/agents/agent_types.py +64 -0
  17. fast_agent/agents/llm_agent.py +350 -0
  18. fast_agent/agents/llm_decorator.py +1139 -0
  19. fast_agent/agents/mcp_agent.py +1337 -0
  20. fast_agent/agents/tool_agent.py +271 -0
  21. fast_agent/agents/workflow/agents_as_tools_agent.py +849 -0
  22. fast_agent/agents/workflow/chain_agent.py +212 -0
  23. fast_agent/agents/workflow/evaluator_optimizer.py +380 -0
  24. fast_agent/agents/workflow/iterative_planner.py +652 -0
  25. fast_agent/agents/workflow/maker_agent.py +379 -0
  26. fast_agent/agents/workflow/orchestrator_models.py +218 -0
  27. fast_agent/agents/workflow/orchestrator_prompts.py +248 -0
  28. fast_agent/agents/workflow/parallel_agent.py +250 -0
  29. fast_agent/agents/workflow/router_agent.py +353 -0
  30. fast_agent/cli/__init__.py +0 -0
  31. fast_agent/cli/__main__.py +73 -0
  32. fast_agent/cli/commands/acp.py +159 -0
  33. fast_agent/cli/commands/auth.py +404 -0
  34. fast_agent/cli/commands/check_config.py +783 -0
  35. fast_agent/cli/commands/go.py +514 -0
  36. fast_agent/cli/commands/quickstart.py +557 -0
  37. fast_agent/cli/commands/serve.py +143 -0
  38. fast_agent/cli/commands/server_helpers.py +114 -0
  39. fast_agent/cli/commands/setup.py +174 -0
  40. fast_agent/cli/commands/url_parser.py +190 -0
  41. fast_agent/cli/constants.py +40 -0
  42. fast_agent/cli/main.py +115 -0
  43. fast_agent/cli/terminal.py +24 -0
  44. fast_agent/config.py +798 -0
  45. fast_agent/constants.py +41 -0
  46. fast_agent/context.py +279 -0
  47. fast_agent/context_dependent.py +50 -0
  48. fast_agent/core/__init__.py +92 -0
  49. fast_agent/core/agent_app.py +448 -0
  50. fast_agent/core/core_app.py +137 -0
  51. fast_agent/core/direct_decorators.py +784 -0
  52. fast_agent/core/direct_factory.py +620 -0
  53. fast_agent/core/error_handling.py +27 -0
  54. fast_agent/core/exceptions.py +90 -0
  55. fast_agent/core/executor/__init__.py +0 -0
  56. fast_agent/core/executor/executor.py +280 -0
  57. fast_agent/core/executor/task_registry.py +32 -0
  58. fast_agent/core/executor/workflow_signal.py +324 -0
  59. fast_agent/core/fastagent.py +1186 -0
  60. fast_agent/core/logging/__init__.py +5 -0
  61. fast_agent/core/logging/events.py +138 -0
  62. fast_agent/core/logging/json_serializer.py +164 -0
  63. fast_agent/core/logging/listeners.py +309 -0
  64. fast_agent/core/logging/logger.py +278 -0
  65. fast_agent/core/logging/transport.py +481 -0
  66. fast_agent/core/prompt.py +9 -0
  67. fast_agent/core/prompt_templates.py +183 -0
  68. fast_agent/core/validation.py +326 -0
  69. fast_agent/event_progress.py +62 -0
  70. fast_agent/history/history_exporter.py +49 -0
  71. fast_agent/human_input/__init__.py +47 -0
  72. fast_agent/human_input/elicitation_handler.py +123 -0
  73. fast_agent/human_input/elicitation_state.py +33 -0
  74. fast_agent/human_input/form_elements.py +59 -0
  75. fast_agent/human_input/form_fields.py +256 -0
  76. fast_agent/human_input/simple_form.py +113 -0
  77. fast_agent/human_input/types.py +40 -0
  78. fast_agent/interfaces.py +310 -0
  79. fast_agent/llm/__init__.py +9 -0
  80. fast_agent/llm/cancellation.py +22 -0
  81. fast_agent/llm/fastagent_llm.py +931 -0
  82. fast_agent/llm/internal/passthrough.py +161 -0
  83. fast_agent/llm/internal/playback.py +129 -0
  84. fast_agent/llm/internal/silent.py +41 -0
  85. fast_agent/llm/internal/slow.py +38 -0
  86. fast_agent/llm/memory.py +275 -0
  87. fast_agent/llm/model_database.py +490 -0
  88. fast_agent/llm/model_factory.py +388 -0
  89. fast_agent/llm/model_info.py +102 -0
  90. fast_agent/llm/prompt_utils.py +155 -0
  91. fast_agent/llm/provider/anthropic/anthropic_utils.py +84 -0
  92. fast_agent/llm/provider/anthropic/cache_planner.py +56 -0
  93. fast_agent/llm/provider/anthropic/llm_anthropic.py +796 -0
  94. fast_agent/llm/provider/anthropic/multipart_converter_anthropic.py +462 -0
  95. fast_agent/llm/provider/bedrock/bedrock_utils.py +218 -0
  96. fast_agent/llm/provider/bedrock/llm_bedrock.py +2207 -0
  97. fast_agent/llm/provider/bedrock/multipart_converter_bedrock.py +84 -0
  98. fast_agent/llm/provider/google/google_converter.py +466 -0
  99. fast_agent/llm/provider/google/llm_google_native.py +681 -0
  100. fast_agent/llm/provider/openai/llm_aliyun.py +31 -0
  101. fast_agent/llm/provider/openai/llm_azure.py +143 -0
  102. fast_agent/llm/provider/openai/llm_deepseek.py +76 -0
  103. fast_agent/llm/provider/openai/llm_generic.py +35 -0
  104. fast_agent/llm/provider/openai/llm_google_oai.py +32 -0
  105. fast_agent/llm/provider/openai/llm_groq.py +42 -0
  106. fast_agent/llm/provider/openai/llm_huggingface.py +85 -0
  107. fast_agent/llm/provider/openai/llm_openai.py +1195 -0
  108. fast_agent/llm/provider/openai/llm_openai_compatible.py +138 -0
  109. fast_agent/llm/provider/openai/llm_openrouter.py +45 -0
  110. fast_agent/llm/provider/openai/llm_tensorzero_openai.py +128 -0
  111. fast_agent/llm/provider/openai/llm_xai.py +38 -0
  112. fast_agent/llm/provider/openai/multipart_converter_openai.py +561 -0
  113. fast_agent/llm/provider/openai/openai_multipart.py +169 -0
  114. fast_agent/llm/provider/openai/openai_utils.py +67 -0
  115. fast_agent/llm/provider/openai/responses.py +133 -0
  116. fast_agent/llm/provider_key_manager.py +139 -0
  117. fast_agent/llm/provider_types.py +34 -0
  118. fast_agent/llm/request_params.py +61 -0
  119. fast_agent/llm/sampling_converter.py +98 -0
  120. fast_agent/llm/stream_types.py +9 -0
  121. fast_agent/llm/usage_tracking.py +445 -0
  122. fast_agent/mcp/__init__.py +56 -0
  123. fast_agent/mcp/common.py +26 -0
  124. fast_agent/mcp/elicitation_factory.py +84 -0
  125. fast_agent/mcp/elicitation_handlers.py +164 -0
  126. fast_agent/mcp/gen_client.py +83 -0
  127. fast_agent/mcp/helpers/__init__.py +36 -0
  128. fast_agent/mcp/helpers/content_helpers.py +352 -0
  129. fast_agent/mcp/helpers/server_config_helpers.py +25 -0
  130. fast_agent/mcp/hf_auth.py +147 -0
  131. fast_agent/mcp/interfaces.py +92 -0
  132. fast_agent/mcp/logger_textio.py +108 -0
  133. fast_agent/mcp/mcp_agent_client_session.py +411 -0
  134. fast_agent/mcp/mcp_aggregator.py +2175 -0
  135. fast_agent/mcp/mcp_connection_manager.py +723 -0
  136. fast_agent/mcp/mcp_content.py +262 -0
  137. fast_agent/mcp/mime_utils.py +108 -0
  138. fast_agent/mcp/oauth_client.py +509 -0
  139. fast_agent/mcp/prompt.py +159 -0
  140. fast_agent/mcp/prompt_message_extended.py +155 -0
  141. fast_agent/mcp/prompt_render.py +84 -0
  142. fast_agent/mcp/prompt_serialization.py +580 -0
  143. fast_agent/mcp/prompts/__init__.py +0 -0
  144. fast_agent/mcp/prompts/__main__.py +7 -0
  145. fast_agent/mcp/prompts/prompt_constants.py +18 -0
  146. fast_agent/mcp/prompts/prompt_helpers.py +238 -0
  147. fast_agent/mcp/prompts/prompt_load.py +186 -0
  148. fast_agent/mcp/prompts/prompt_server.py +552 -0
  149. fast_agent/mcp/prompts/prompt_template.py +438 -0
  150. fast_agent/mcp/resource_utils.py +215 -0
  151. fast_agent/mcp/sampling.py +200 -0
  152. fast_agent/mcp/server/__init__.py +4 -0
  153. fast_agent/mcp/server/agent_server.py +613 -0
  154. fast_agent/mcp/skybridge.py +44 -0
  155. fast_agent/mcp/sse_tracking.py +287 -0
  156. fast_agent/mcp/stdio_tracking_simple.py +59 -0
  157. fast_agent/mcp/streamable_http_tracking.py +309 -0
  158. fast_agent/mcp/tool_execution_handler.py +137 -0
  159. fast_agent/mcp/tool_permission_handler.py +88 -0
  160. fast_agent/mcp/transport_tracking.py +634 -0
  161. fast_agent/mcp/types.py +24 -0
  162. fast_agent/mcp/ui_agent.py +48 -0
  163. fast_agent/mcp/ui_mixin.py +209 -0
  164. fast_agent/mcp_server_registry.py +89 -0
  165. fast_agent/py.typed +0 -0
  166. fast_agent/resources/examples/data-analysis/analysis-campaign.py +189 -0
  167. fast_agent/resources/examples/data-analysis/analysis.py +68 -0
  168. fast_agent/resources/examples/data-analysis/fastagent.config.yaml +41 -0
  169. fast_agent/resources/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-Attrition.csv +1471 -0
  170. fast_agent/resources/examples/mcp/elicitations/elicitation_account_server.py +88 -0
  171. fast_agent/resources/examples/mcp/elicitations/elicitation_forms_server.py +297 -0
  172. fast_agent/resources/examples/mcp/elicitations/elicitation_game_server.py +164 -0
  173. fast_agent/resources/examples/mcp/elicitations/fastagent.config.yaml +35 -0
  174. fast_agent/resources/examples/mcp/elicitations/fastagent.secrets.yaml.example +17 -0
  175. fast_agent/resources/examples/mcp/elicitations/forms_demo.py +107 -0
  176. fast_agent/resources/examples/mcp/elicitations/game_character.py +65 -0
  177. fast_agent/resources/examples/mcp/elicitations/game_character_handler.py +256 -0
  178. fast_agent/resources/examples/mcp/elicitations/tool_call.py +21 -0
  179. fast_agent/resources/examples/mcp/state-transfer/agent_one.py +18 -0
  180. fast_agent/resources/examples/mcp/state-transfer/agent_two.py +18 -0
  181. fast_agent/resources/examples/mcp/state-transfer/fastagent.config.yaml +27 -0
  182. fast_agent/resources/examples/mcp/state-transfer/fastagent.secrets.yaml.example +15 -0
  183. fast_agent/resources/examples/researcher/fastagent.config.yaml +61 -0
  184. fast_agent/resources/examples/researcher/researcher-eval.py +53 -0
  185. fast_agent/resources/examples/researcher/researcher-imp.py +189 -0
  186. fast_agent/resources/examples/researcher/researcher.py +36 -0
  187. fast_agent/resources/examples/tensorzero/.env.sample +2 -0
  188. fast_agent/resources/examples/tensorzero/Makefile +31 -0
  189. fast_agent/resources/examples/tensorzero/README.md +56 -0
  190. fast_agent/resources/examples/tensorzero/agent.py +35 -0
  191. fast_agent/resources/examples/tensorzero/demo_images/clam.jpg +0 -0
  192. fast_agent/resources/examples/tensorzero/demo_images/crab.png +0 -0
  193. fast_agent/resources/examples/tensorzero/demo_images/shrimp.png +0 -0
  194. fast_agent/resources/examples/tensorzero/docker-compose.yml +105 -0
  195. fast_agent/resources/examples/tensorzero/fastagent.config.yaml +19 -0
  196. fast_agent/resources/examples/tensorzero/image_demo.py +67 -0
  197. fast_agent/resources/examples/tensorzero/mcp_server/Dockerfile +25 -0
  198. fast_agent/resources/examples/tensorzero/mcp_server/entrypoint.sh +35 -0
  199. fast_agent/resources/examples/tensorzero/mcp_server/mcp_server.py +31 -0
  200. fast_agent/resources/examples/tensorzero/mcp_server/pyproject.toml +11 -0
  201. fast_agent/resources/examples/tensorzero/simple_agent.py +25 -0
  202. fast_agent/resources/examples/tensorzero/tensorzero_config/system_schema.json +29 -0
  203. fast_agent/resources/examples/tensorzero/tensorzero_config/system_template.minijinja +11 -0
  204. fast_agent/resources/examples/tensorzero/tensorzero_config/tensorzero.toml +35 -0
  205. fast_agent/resources/examples/workflows/agents_as_tools_extended.py +73 -0
  206. fast_agent/resources/examples/workflows/agents_as_tools_simple.py +50 -0
  207. fast_agent/resources/examples/workflows/chaining.py +37 -0
  208. fast_agent/resources/examples/workflows/evaluator.py +77 -0
  209. fast_agent/resources/examples/workflows/fastagent.config.yaml +26 -0
  210. fast_agent/resources/examples/workflows/graded_report.md +89 -0
  211. fast_agent/resources/examples/workflows/human_input.py +28 -0
  212. fast_agent/resources/examples/workflows/maker.py +156 -0
  213. fast_agent/resources/examples/workflows/orchestrator.py +70 -0
  214. fast_agent/resources/examples/workflows/parallel.py +56 -0
  215. fast_agent/resources/examples/workflows/router.py +69 -0
  216. fast_agent/resources/examples/workflows/short_story.md +13 -0
  217. fast_agent/resources/examples/workflows/short_story.txt +19 -0
  218. fast_agent/resources/setup/.gitignore +30 -0
  219. fast_agent/resources/setup/agent.py +28 -0
  220. fast_agent/resources/setup/fastagent.config.yaml +65 -0
  221. fast_agent/resources/setup/fastagent.secrets.yaml.example +38 -0
  222. fast_agent/resources/setup/pyproject.toml.tmpl +23 -0
  223. fast_agent/skills/__init__.py +9 -0
  224. fast_agent/skills/registry.py +235 -0
  225. fast_agent/tools/elicitation.py +369 -0
  226. fast_agent/tools/shell_runtime.py +402 -0
  227. fast_agent/types/__init__.py +59 -0
  228. fast_agent/types/conversation_summary.py +294 -0
  229. fast_agent/types/llm_stop_reason.py +78 -0
  230. fast_agent/types/message_search.py +249 -0
  231. fast_agent/ui/__init__.py +38 -0
  232. fast_agent/ui/console.py +59 -0
  233. fast_agent/ui/console_display.py +1080 -0
  234. fast_agent/ui/elicitation_form.py +946 -0
  235. fast_agent/ui/elicitation_style.py +59 -0
  236. fast_agent/ui/enhanced_prompt.py +1400 -0
  237. fast_agent/ui/history_display.py +734 -0
  238. fast_agent/ui/interactive_prompt.py +1199 -0
  239. fast_agent/ui/markdown_helpers.py +104 -0
  240. fast_agent/ui/markdown_truncator.py +1004 -0
  241. fast_agent/ui/mcp_display.py +857 -0
  242. fast_agent/ui/mcp_ui_utils.py +235 -0
  243. fast_agent/ui/mermaid_utils.py +169 -0
  244. fast_agent/ui/message_primitives.py +50 -0
  245. fast_agent/ui/notification_tracker.py +205 -0
  246. fast_agent/ui/plain_text_truncator.py +68 -0
  247. fast_agent/ui/progress_display.py +10 -0
  248. fast_agent/ui/rich_progress.py +195 -0
  249. fast_agent/ui/streaming.py +774 -0
  250. fast_agent/ui/streaming_buffer.py +449 -0
  251. fast_agent/ui/tool_display.py +422 -0
  252. fast_agent/ui/usage_display.py +204 -0
  253. fast_agent/utils/__init__.py +5 -0
  254. fast_agent/utils/reasoning_stream_parser.py +77 -0
  255. fast_agent/utils/time.py +22 -0
  256. fast_agent/workflow_telemetry.py +261 -0
  257. fast_agent_mcp-0.4.7.dist-info/METADATA +788 -0
  258. fast_agent_mcp-0.4.7.dist-info/RECORD +261 -0
  259. fast_agent_mcp-0.4.7.dist-info/WHEEL +4 -0
  260. fast_agent_mcp-0.4.7.dist-info/entry_points.txt +7 -0
  261. fast_agent_mcp-0.4.7.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,788 @@
1
+ Metadata-Version: 2.4
2
+ Name: fast-agent-mcp
3
+ Version: 0.4.7
4
+ Summary: Define, Prompt and Test MCP enabled Agents and Workflows
5
+ Author-email: Shaun Smith <fastagent@llmindset.co.uk>
6
+ License: Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction,
15
+ and distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by
18
+ the copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all
21
+ other entities that control, are controlled by, or are under common
22
+ control with that entity. For the purposes of this definition,
23
+ "control" means (i) the power, direct or indirect, to cause the
24
+ direction or management of such entity, whether by contract or
25
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
+ outstanding shares, or (iii) beneficial ownership of such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity
29
+ exercising permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation
33
+ source, and configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical
36
+ transformation or translation of a Source form, including but
37
+ not limited to compiled object code, generated documentation,
38
+ and conversions to other media types.
39
+
40
+ "Work" shall mean the work of authorship, whether in Source or
41
+ Object form, made available under the License, as indicated by a
42
+ copyright notice that is included in or attached to the work
43
+ (an example is provided in the Appendix below).
44
+
45
+ "Derivative Works" shall mean any work, whether in Source or Object
46
+ form, that is based on (or derived from) the Work and for which the
47
+ editorial revisions, annotations, elaborations, or other modifications
48
+ represent, as a whole, an original work of authorship. For the purposes
49
+ of this License, Derivative Works shall not include works that remain
50
+ separable from, or merely link (or bind by name) to the interfaces of,
51
+ the Work and Derivative Works thereof.
52
+
53
+ "Contribution" shall mean any work of authorship, including
54
+ the original version of the Work and any modifications or additions
55
+ to that Work or Derivative Works thereof, that is intentionally
56
+ submitted to Licensor for inclusion in the Work by the copyright owner
57
+ or by an individual or Legal Entity authorized to submit on behalf of
58
+ the copyright owner. For the purposes of this definition, "submitted"
59
+ means any form of electronic, verbal, or written communication sent
60
+ to the Licensor or its representatives, including but not limited to
61
+ communication on electronic mailing lists, source code control systems,
62
+ and issue tracking systems that are managed by, or on behalf of, the
63
+ Licensor for the purpose of discussing and improving the Work, but
64
+ excluding communication that is conspicuously marked or otherwise
65
+ designated in writing by the copyright owner as "Not a Contribution."
66
+
67
+ "Contributor" shall mean Licensor and any individual or Legal Entity
68
+ on behalf of whom a Contribution has been received by Licensor and
69
+ subsequently incorporated within the Work.
70
+
71
+ 2. Grant of Copyright License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ copyright license to reproduce, prepare Derivative Works of,
75
+ publicly display, publicly perform, sublicense, and distribute the
76
+ Work and such Derivative Works in Source or Object form.
77
+
78
+ 3. Grant of Patent License. Subject to the terms and conditions of
79
+ this License, each Contributor hereby grants to You a perpetual,
80
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
+ (except as stated in this section) patent license to make, have made,
82
+ use, offer to sell, sell, import, and otherwise transfer the Work,
83
+ where such license applies only to those patent claims licensable
84
+ by such Contributor that are necessarily infringed by their
85
+ Contribution(s) alone or by combination of their Contribution(s)
86
+ with the Work to which such Contribution(s) was submitted. If You
87
+ institute patent litigation against any entity (including a
88
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
89
+ or a Contribution incorporated within the Work constitutes direct
90
+ or contributory patent infringement, then any patent licenses
91
+ granted to You under this License for that Work shall terminate
92
+ as of the date such litigation is filed.
93
+
94
+ 4. Redistribution. You may reproduce and distribute copies of the
95
+ Work or Derivative Works thereof in any medium, with or without
96
+ modifications, and in Source or Object form, provided that You
97
+ meet the following conditions:
98
+
99
+ (a) You must give any other recipients of the Work or
100
+ Derivative Works a copy of this License; and
101
+
102
+ (b) You must cause any modified files to carry prominent notices
103
+ stating that You changed the files; and
104
+
105
+ (c) You must retain, in the Source form of any Derivative Works
106
+ that You distribute, all copyright, patent, trademark, and
107
+ attribution notices from the Source form of the Work,
108
+ excluding those notices that do not pertain to any part of
109
+ the Derivative Works; and
110
+
111
+ (d) If the Work includes a "NOTICE" text file as part of its
112
+ distribution, then any Derivative Works that You distribute must
113
+ include a readable copy of the attribution notices contained
114
+ within such NOTICE file, excluding those notices that do not
115
+ pertain to any part of the Derivative Works, in at least one
116
+ of the following places: within a NOTICE text file distributed
117
+ as part of the Derivative Works; within the Source form or
118
+ documentation, if provided along with the Derivative Works; or,
119
+ within a display generated by the Derivative Works, if and
120
+ wherever such third-party notices normally appear. The contents
121
+ of the NOTICE file are for informational purposes only and
122
+ do not modify the License. You may add Your own attribution
123
+ notices within Derivative Works that You distribute, alongside
124
+ or as an addendum to the NOTICE text from the Work, provided
125
+ that such additional attribution notices cannot be construed
126
+ as modifying the License.
127
+
128
+ You may add Your own copyright statement to Your modifications and
129
+ may provide additional or different license terms and conditions
130
+ for use, reproduction, or distribution of Your modifications, or
131
+ for any such Derivative Works as a whole, provided Your use,
132
+ reproduction, and distribution of the Work otherwise complies with
133
+ the conditions stated in this License.
134
+
135
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
136
+ any Contribution intentionally submitted for inclusion in the Work
137
+ by You to the Licensor shall be under the terms and conditions of
138
+ this License, without any additional terms or conditions.
139
+ Notwithstanding the above, nothing herein shall supersede or modify
140
+ the terms of any separate license agreement you may have executed
141
+ with Licensor regarding such Contributions.
142
+
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+
148
+ 7. Disclaimer of Warranty. Unless required by applicable law or
149
+ agreed to in writing, Licensor provides the Work (and each
150
+ Contributor provides its Contributions) on an "AS IS" BASIS,
151
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152
+ implied, including, without limitation, any warranties or conditions
153
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154
+ PARTICULAR PURPOSE. You are solely responsible for determining the
155
+ appropriateness of using or redistributing the Work and assume any
156
+ risks associated with Your exercise of permissions under this License.
157
+
158
+ 8. Limitation of Liability. In no event and under no legal theory,
159
+ whether in tort (including negligence), contract, or otherwise,
160
+ unless required by applicable law (such as deliberate and grossly
161
+ negligent acts) or agreed to in writing, shall any Contributor be
162
+ liable to You for damages, including any direct, indirect, special,
163
+ incidental, or consequential damages of any character arising as a
164
+ result of this License or out of the use or inability to use the
165
+ Work (including but not limited to damages for loss of goodwill,
166
+ work stoppage, computer failure or malfunction, or any and all
167
+ other commercial damages or losses), even if such Contributor
168
+ has been advised of the possibility of such damages.
169
+
170
+ 9. Accepting Warranty or Additional Liability. While redistributing
171
+ the Work or Derivative Works thereof, You may choose to offer,
172
+ and charge a fee for, acceptance of support, warranty, indemnity,
173
+ or other liability obligations and/or rights consistent with this
174
+ License. However, in accepting such obligations, You may act only
175
+ on Your own behalf and on Your sole responsibility, not on behalf
176
+ of any other Contributor, and only if You agree to indemnify,
177
+ defend, and hold each Contributor harmless for any liability
178
+ incurred by, or claims asserted against, such Contributor by reason
179
+ of your accepting any such warranty or additional liability.
180
+
181
+ END OF TERMS AND CONDITIONS
182
+
183
+ APPENDIX: How to apply the Apache License to your work.
184
+
185
+ To apply the Apache License to your work, attach the following
186
+ boilerplate notice, with the fields enclosed by brackets "[]"
187
+ replaced with your own identifying information. (Don't include
188
+ the brackets!) The text should be enclosed in the appropriate
189
+ comment syntax for the file format. We also recommend that a
190
+ file or class name and description of purpose be included on the
191
+ same "printed page" as the copyright notice for easier
192
+ identification within third-party archives.
193
+
194
+ Copyright 2025 llmindset.co.uk
195
+
196
+ Licensed under the Apache License, Version 2.0 (the "License");
197
+ you may not use this file except in compliance with the License.
198
+ You may obtain a copy of the License at
199
+
200
+ http://www.apache.org/licenses/LICENSE-2.0
201
+
202
+ Unless required by applicable law or agreed to in writing, software
203
+ distributed under the License is distributed on an "AS IS" BASIS,
204
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
205
+ See the License for the specific language governing permissions and
206
+ limitations under the License.
207
+ License-File: LICENSE
208
+ Classifier: License :: OSI Approved :: Apache Software License
209
+ Classifier: Operating System :: OS Independent
210
+ Classifier: Programming Language :: Python :: 3
211
+ Requires-Python: <3.14,>=3.13.5
212
+ Requires-Dist: a2a-sdk>=0.3.16
213
+ Requires-Dist: agent-client-protocol>=0.7.0
214
+ Requires-Dist: aiohttp>=3.13.2
215
+ Requires-Dist: anthropic>=0.75
216
+ Requires-Dist: deprecated>=1.2.18
217
+ Requires-Dist: email-validator>=2.2.0
218
+ Requires-Dist: fastapi>=0.121.0
219
+ Requires-Dist: google-genai>=1.52.0
220
+ Requires-Dist: keyring>=24.3.1
221
+ Requires-Dist: mcp==1.23.1
222
+ Requires-Dist: openai[aiohttp]>=2.9
223
+ Requires-Dist: opentelemetry-distro>=0.55b0
224
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.7.0
225
+ Requires-Dist: opentelemetry-instrumentation-anthropic>=0.49.5; python_version >= '3.10' and python_version < '4.0'
226
+ Requires-Dist: opentelemetry-instrumentation-google-genai>=0.4b0
227
+ Requires-Dist: opentelemetry-instrumentation-mcp>=0.49.5; python_version >= '3.10' and python_version < '4.0'
228
+ Requires-Dist: opentelemetry-instrumentation-openai>=0.49.5; python_version >= '3.10' and python_version < '4.0'
229
+ Requires-Dist: prompt-toolkit>=3.0.52
230
+ Requires-Dist: pydantic-settings>=2.7.0
231
+ Requires-Dist: pydantic>=2.10.4
232
+ Requires-Dist: pyperclip>=1.9.0
233
+ Requires-Dist: python-frontmatter>=1.1.0
234
+ Requires-Dist: pyyaml>=6.0.2
235
+ Requires-Dist: rich>=14.2.0
236
+ Requires-Dist: tiktoken>=0.12.0
237
+ Requires-Dist: typer>=0.20.0
238
+ Provides-Extra: all-providers
239
+ Requires-Dist: azure-identity>=1.14.0; extra == 'all-providers'
240
+ Requires-Dist: boto3>=1.35.0; extra == 'all-providers'
241
+ Requires-Dist: tensorzero>=2025.7.5; extra == 'all-providers'
242
+ Provides-Extra: azure
243
+ Requires-Dist: azure-identity>=1.14.0; extra == 'azure'
244
+ Provides-Extra: bedrock
245
+ Requires-Dist: boto3>=1.35.0; extra == 'bedrock'
246
+ Provides-Extra: dev
247
+ Requires-Dist: pre-commit>=4.0.1; extra == 'dev'
248
+ Requires-Dist: pydantic>=2.10.4; extra == 'dev'
249
+ Requires-Dist: pytest-asyncio>=0.21.1; extra == 'dev'
250
+ Requires-Dist: pytest-cov; extra == 'dev'
251
+ Requires-Dist: pytest>=7.4.0; extra == 'dev'
252
+ Requires-Dist: pyyaml>=6.0.2; extra == 'dev'
253
+ Requires-Dist: ruamel-yaml>=0.18.0; extra == 'dev'
254
+ Requires-Dist: ruff>=0.8.4; extra == 'dev'
255
+ Provides-Extra: tensorzero
256
+ Requires-Dist: tensorzero>=2025.7.5; extra == 'tensorzero'
257
+ Provides-Extra: textual
258
+ Requires-Dist: textual>=6.2.1; extra == 'textual'
259
+ Description-Content-Type: text/markdown
260
+
261
+ <p align="center">
262
+ <a href="https://pypi.org/project/fast-agent-mcp/"><img src="https://img.shields.io/pypi/v/fast-agent-mcp?color=%2334D058&label=pypi" /></a>
263
+ <a href="#"><img src="https://github.com/evalstate/fast-agent/actions/workflows/main-checks.yml/badge.svg" /></a>
264
+ <a href="https://github.com/evalstate/fast-agent/issues"><img src="https://img.shields.io/github/issues-raw/evalstate/fast-agent" /></a>
265
+ <a href="https://discord.gg/xg5cJ7ndN6"><img src="https://img.shields.io/discord/1358470293990936787" alt="discord" /></a>
266
+ <img alt="Pepy Total Downloads" src="https://img.shields.io/pepy/dt/fast-agent-mcp?label=pypi%20%7C%20downloads"/>
267
+ <a href="https://github.com/evalstate/fast-agent-mcp/blob/main/LICENSE"><img src="https://img.shields.io/pypi/l/fast-agent-mcp" /></a>
268
+ </p>
269
+
270
+ ## Overview
271
+
272
+ > [!TIP]
273
+ > Please see : https://fast-agent.ai for latest documentation. There is also an LLMs.txt [here](https://fast-agent.ai/llms.txt)
274
+
275
+ **`fast-agent`** enables you to create and interact with sophisticated multimodal Agents and Workflows in minutes. It is the first framework with complete, end-to-end tested MCP Feature support including Sampling and Elicitations.
276
+
277
+ <!-- ![multi_model_trim](https://github.com/user-attachments/assets/c8bf7474-2c41-4ef3-8924-06e29907d7c6) -->
278
+
279
+ 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).
280
+
281
+ Model support is comprehensive with native support for Anthropic, OpenAI and Google providers as well as Azure, Ollama, Deepseek and dozens of others via TensorZero. Structured Outputs, PDF and Vision support is simple to use and well tested. Passthrough and Playback LLMs enable rapid development and test of Python glue-code for your applications.
282
+
283
+ Recent features include:
284
+ - Agent Skills (SKILL.md)
285
+ - MCP-UI Support |
286
+ - OpenAI Apps SDK (Skybridge)
287
+ - Shell Mode
288
+ - Advanced MCP Transport Diagnsotics
289
+ - MCP Elicitations
290
+
291
+ <img width="800" alt="MCP Transport Diagnostics" src="https://github.com/user-attachments/assets/e26472de-58d9-4726-8bdd-01eb407414cf" />
292
+
293
+
294
+ `fast-agent` is the only tool that allows you to inspect Streamable HTTP Transport usage - a critical feature for ensuring reliable, compliant deployments. OAuth is supported with KeyRing storage for secrets. Use the `fast-agent auth` command to manage.
295
+
296
+
297
+
298
+
299
+
300
+ > [!IMPORTANT]
301
+ >
302
+ > `fast-agent` The fast-agent documentation repo is here: https://github.com/evalstate/fast-agent-docs. Please feel free to submit PRs for documentation, experience reports or other content you think others may find helpful. All help and feedback warmly received.
303
+
304
+ ### Agent Application Development
305
+
306
+ Prompts and configurations that define your Agent Applications are stored in simple files, with minimal boilerplate, enabling simple management and version control.
307
+
308
+ Chat with individual Agents and Components before, during and after workflow execution to tune and diagnose your application. Agents can request human input to get additional context for task completion.
309
+
310
+ 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/)
311
+
312
+ ![2025-03-23-fast-agent](https://github.com/user-attachments/assets/8f6dbb69-43e3-4633-8e12-5572e9614728)
313
+
314
+ ## Get started:
315
+
316
+ Start by installing the [uv package manager](https://docs.astral.sh/uv/) for Python. Then:
317
+
318
+ ```bash
319
+ uv pip install fast-agent-mcp # install fast-agent!
320
+ fast-agent go # start an interactive session
321
+ fast-agent go --url https://hf.co/mcp # with a remote MCP
322
+ fast-agent go --model=generic.qwen2.5 # use ollama qwen 2.5
323
+ fast-agent setup # create an example agent and config files
324
+ uv run agent.py # run your first agent
325
+ uv run agent.py --model=o3-mini.low # specify a model
326
+ uv run agent.py --transport http --port 8001 # expose as MCP server (server mode implied)
327
+ fast-agent quickstart workflow # create "building effective agents" examples
328
+ ```
329
+
330
+ `--server` remains available for backward compatibility but is deprecated; `--transport` now automatically switches an agent into server mode.
331
+
332
+ Other quickstart examples include a Researcher Agent (with Evaluator-Optimizer workflow) and Data Analysis Agent (similar to the ChatGPT experience), demonstrating MCP Roots support.
333
+
334
+ > [!TIP]
335
+ > 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.
336
+
337
+ ### Basic Agents
338
+
339
+ Defining an agent is as simple as:
340
+
341
+ ```python
342
+ @fast.agent(
343
+ instruction="Given an object, respond only with an estimate of its size."
344
+ )
345
+ ```
346
+
347
+ We can then send messages to the Agent:
348
+
349
+ ```python
350
+ async with fast.run() as agent:
351
+ moon_size = await agent("the moon")
352
+ print(moon_size)
353
+ ```
354
+
355
+ Or start an interactive chat with the Agent:
356
+
357
+ ```python
358
+ async with fast.run() as agent:
359
+ await agent.interactive()
360
+ ```
361
+
362
+ Here is the complete `sizer.py` Agent application, with boilerplate code:
363
+
364
+ ```python
365
+ import asyncio
366
+ from fast_agent import FastAgent
367
+
368
+ # Create the application
369
+ fast = FastAgent("Agent Example")
370
+
371
+ @fast.agent(
372
+ instruction="Given an object, respond only with an estimate of its size."
373
+ )
374
+ async def main():
375
+ async with fast.run() as agent:
376
+ await agent.interactive()
377
+
378
+ if __name__ == "__main__":
379
+ asyncio.run(main())
380
+ ```
381
+
382
+ The Agent can then be run with `uv run sizer.py`.
383
+
384
+ Specify a model with the `--model` switch - for example `uv run sizer.py --model sonnet`.
385
+
386
+ ### Combining Agents and using MCP Servers
387
+
388
+ _To generate examples use `fast-agent quickstart workflow`. This example can be run with `uv run workflow/chaining.py`. fast-agent looks for configuration files in the current directory before checking parent directories recursively._
389
+
390
+ Agents can be chained to build a workflow, using MCP Servers defined in the `fastagent.config.yaml` file:
391
+
392
+ ```python
393
+ @fast.agent(
394
+ "url_fetcher",
395
+ "Given a URL, provide a complete and comprehensive summary",
396
+ servers=["fetch"], # Name of an MCP Server defined in fastagent.config.yaml
397
+ )
398
+ @fast.agent(
399
+ "social_media",
400
+ """
401
+ Write a 280 character social media post for any given text.
402
+ Respond only with the post, never use hashtags.
403
+ """,
404
+ )
405
+ @fast.chain(
406
+ name="post_writer",
407
+ sequence=["url_fetcher", "social_media"],
408
+ )
409
+ async def main():
410
+ async with fast.run() as agent:
411
+ # using chain workflow
412
+ await agent.post_writer("http://llmindset.co.uk")
413
+ ```
414
+
415
+ All Agents and Workflows respond to `.send("message")` or `.prompt()` to begin a chat session.
416
+
417
+ Saved as `social.py` we can now run this workflow from the command line with:
418
+
419
+ ```bash
420
+ uv run workflow/chaining.py --agent post_writer --message "<url>"
421
+ ```
422
+
423
+ Add the `--quiet` switch to disable progress and message display and return only the final response - useful for simple automations.
424
+
425
+ ### Agents-as-Tools (child agents as tools)
426
+
427
+ Sometimes one agent needs to call other agents as tools. `fast-agent` supports
428
+ this via a hybrid *Agents-as-Tools* agent:
429
+
430
+ - You declare a BASIC agent with `agents=[...]`.
431
+ - At runtime it is instantiated as an internal `AgentsAsToolsAgent`, which:
432
+ - Inherits from `McpAgent` (keeps its own MCP servers/tools).
433
+ - Exposes each child agent as a tool (`agent__ChildName`).
434
+ - Merges MCP tools and agent-tools in a single `list_tools()` surface.
435
+ - Supports history/parallel controls:
436
+ - `history_mode` (default `fork`; `fork_and_merge` to merge clone history back)
437
+ - `max_parallel` (default unlimited), `child_timeout_sec` (default none)
438
+ - `max_display_instances` (default 20; collapse progress after top-N)
439
+
440
+ Minimal example:
441
+
442
+ ```python
443
+ @fast.agent(
444
+ name="NY-Project-Manager",
445
+ instruction="Return current time and project status.",
446
+ servers=["time"], # MCP server 'time' configured in fastagent.config.yaml
447
+ )
448
+ @fast.agent(
449
+ name="London-Project-Manager",
450
+ instruction="Return current time and news.",
451
+ servers=["time"],
452
+ )
453
+ @fast.agent(
454
+ name="PMO-orchestrator",
455
+ instruction="Get reports. Separate call per topic. NY: {OpenAI, Fast-Agent, Anthropic}, London: Economics",
456
+ default=True,
457
+ agents=[
458
+ "NY-Project-Manager",
459
+ "London-Project-Manager",
460
+ ], # children are exposed as tools: agent__NY-Project-Manager, agent__London-Project-Manager
461
+ # optional knobs:
462
+ # history_mode=HistoryMode.FORK_AND_MERGE to merge clone history back
463
+ # max_parallel=8 to cap parallel agent-tools
464
+ # child_timeout_sec=600 to bound each child call
465
+ # max_display_instances=10 to collapse progress UI after top-N
466
+ )
467
+ async def main() -> None:
468
+ async with fast.run() as agent:
469
+ result = await agent("Get PMO report")
470
+ print(result)
471
+
472
+
473
+ if __name__ == "__main__":
474
+ asyncio.run(main())
475
+ ```
476
+
477
+ Extended example is available in the repository as
478
+ `examples/workflows/agents_as_tools_extended.py`.
479
+
480
+ ## MCP OAuth (v2.1)
481
+
482
+ For SSE and HTTP MCP servers, OAuth is enabled by default with minimal configuration. A local callback server is used to capture the authorization code, with a paste-URL fallback if the port is unavailable.
483
+
484
+ - Minimal per-server settings in `fastagent.config.yaml`:
485
+
486
+ ```yaml
487
+ mcp:
488
+ servers:
489
+ myserver:
490
+ transport: http # or sse
491
+ url: http://localhost:8001/mcp # or /sse for SSE servers
492
+ auth:
493
+ oauth: true # default: true
494
+ redirect_port: 3030 # default: 3030
495
+ redirect_path: /callback # default: /callback
496
+ # scope: "user" # optional; if omitted, server defaults are used
497
+ ```
498
+
499
+ - The OAuth client uses PKCE and in-memory token storage (no tokens written to disk).
500
+ - Token persistence: by default, tokens are stored securely in your OS keychain via `keyring`. If a keychain is unavailable (e.g., headless container), in-memory storage is used for the session.
501
+ - To force in-memory only per server, set:
502
+
503
+ ```yaml
504
+ mcp:
505
+ servers:
506
+ myserver:
507
+ transport: http
508
+ url: http://localhost:8001/mcp
509
+ auth:
510
+ oauth: true
511
+ persist: memory
512
+ ```
513
+
514
+ - To disable OAuth for a specific server , set `auth.oauth: false` for that server.
515
+
516
+ ## Workflows
517
+
518
+ ### Chain
519
+
520
+ The `chain` workflow offers a more declarative approach to calling Agents in sequence:
521
+
522
+ ```python
523
+
524
+ @fast.chain(
525
+ "post_writer",
526
+ sequence=["url_fetcher","social_media"]
527
+ )
528
+
529
+ # we can them prompt it directly:
530
+ async with fast.run() as agent:
531
+ await agent.post_writer()
532
+
533
+ ```
534
+
535
+ 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`.
536
+
537
+ 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.
538
+
539
+ ### Human Input
540
+
541
+ Agents can request Human Input to assist with a task or get additional context:
542
+
543
+ ```python
544
+ @fast.agent(
545
+ instruction="An AI agent that assists with basic tasks. Request Human Input when needed.",
546
+ human_input=True,
547
+ )
548
+
549
+ await agent("print the next number in the sequence")
550
+ ```
551
+
552
+ In the example `human_input.py`, the Agent will prompt the User for additional information to complete the task.
553
+
554
+ ### Parallel
555
+
556
+ The Parallel Workflow sends the same message to multiple Agents simultaneously (`fan-out`), then uses the `fan-in` Agent to process the combined content.
557
+
558
+ ```python
559
+ @fast.agent("translate_fr", "Translate the text to French")
560
+ @fast.agent("translate_de", "Translate the text to German")
561
+ @fast.agent("translate_es", "Translate the text to Spanish")
562
+
563
+ @fast.parallel(
564
+ name="translate",
565
+ fan_out=["translate_fr","translate_de","translate_es"]
566
+ )
567
+
568
+ @fast.chain(
569
+ "post_writer",
570
+ sequence=["url_fetcher","social_media","translate"]
571
+ )
572
+ ```
573
+
574
+ If you don't specify a `fan-in` agent, the `parallel` returns the combined Agent results verbatim.
575
+
576
+ `parallel` is also useful to ensemble ideas from different LLMs.
577
+
578
+ When using `parallel` in other workflows, specify an `instruction` to describe its operation.
579
+
580
+ ### Evaluator-Optimizer
581
+
582
+ 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. The final result from the Generator is returned.
583
+
584
+ If the Generator has `use_history` off, the previous iteration is returned when asking for improvements - otherwise conversational context is used.
585
+
586
+ ```python
587
+ @fast.evaluator_optimizer(
588
+ name="researcher",
589
+ generator="web_searcher",
590
+ evaluator="quality_assurance",
591
+ min_rating="EXCELLENT",
592
+ max_refinements=3
593
+ )
594
+
595
+ async with fast.run() as agent:
596
+ await agent.researcher.send("produce a report on how to make the perfect espresso")
597
+ ```
598
+
599
+ When used in a workflow, it returns the last `generator` message as the result.
600
+
601
+ See the `evaluator.py` workflow example, or `fast-agent quickstart researcher` for a more complete example.
602
+
603
+ ### Router
604
+
605
+ 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.
606
+
607
+ ```python
608
+ @fast.router(
609
+ name="route",
610
+ agents=["agent1","agent2","agent3"]
611
+ )
612
+ ```
613
+
614
+ Look at the `router.py` workflow for an example.
615
+
616
+ ### Orchestrator
617
+
618
+ 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 (`plan_type="full"`) or iteratively (`plan_type="iterative"`).
619
+
620
+ ```python
621
+ @fast.orchestrator(
622
+ name="orchestrate",
623
+ agents=["task1","task2","task3"]
624
+ )
625
+ ```
626
+
627
+ See the `orchestrator.py` or `agent_build.py` workflow example.
628
+
629
+ ## Agent Features
630
+
631
+ ### Calling Agents
632
+
633
+ All definitions allow omitting the name and instructions arguments for brevity:
634
+
635
+ ```python
636
+ @fast.agent("You are a helpful agent") # Create an agent with a default name.
637
+ @fast.agent("greeter","Respond cheerfully!") # Create an agent with the name "greeter"
638
+
639
+ moon_size = await agent("the moon") # Call the default (first defined agent) with a message
640
+
641
+ result = await agent.greeter("Good morning!") # Send a message to an agent by name using dot notation
642
+ result = await agent.greeter.send("Hello!") # You can call 'send' explicitly
643
+
644
+ await agent.greeter() # If no message is specified, a chat session will open
645
+ await agent.greeter.prompt() # that can be made more explicit
646
+ await agent.greeter.prompt(default_prompt="OK") # and supports setting a default prompt
647
+
648
+ agent["greeter"].send("Good Evening!") # Dictionary access is supported if preferred
649
+ ```
650
+
651
+ ### Defining Agents
652
+
653
+ #### Basic Agent
654
+
655
+ ```python
656
+ @fast.agent(
657
+ name="agent", # name of the agent
658
+ instruction="You are a helpful Agent", # base instruction for the agent
659
+ servers=["filesystem"], # list of MCP Servers for the agent
660
+ model="o3-mini.high", # specify a model for the agent
661
+ use_history=True, # agent maintains chat history
662
+ request_params=RequestParams(temperature= 0.7), # additional parameters for the LLM (or RequestParams())
663
+ human_input=True, # agent can request human input
664
+ )
665
+ ```
666
+
667
+ #### Chain
668
+
669
+ ```python
670
+ @fast.chain(
671
+ name="chain", # name of the chain
672
+ sequence=["agent1", "agent2", ...], # list of agents in execution order
673
+ instruction="instruction", # instruction to describe the chain for other workflows
674
+ cumulative=False, # whether to accumulate messages through the chain
675
+ continue_with_final=True, # open chat with agent at end of chain after prompting
676
+ )
677
+ ```
678
+
679
+ #### Parallel
680
+
681
+ ```python
682
+ @fast.parallel(
683
+ name="parallel", # name of the parallel workflow
684
+ fan_out=["agent1", "agent2"], # list of agents to run in parallel
685
+ fan_in="aggregator", # name of agent that combines results (optional)
686
+ instruction="instruction", # instruction to describe the parallel for other workflows
687
+ include_request=True, # include original request in fan-in message
688
+ )
689
+ ```
690
+
691
+ #### Evaluator-Optimizer
692
+
693
+ ```python
694
+ @fast.evaluator_optimizer(
695
+ name="researcher", # name of the workflow
696
+ generator="web_searcher", # name of the content generator agent
697
+ evaluator="quality_assurance", # name of the evaluator agent
698
+ min_rating="GOOD", # minimum acceptable quality (EXCELLENT, GOOD, FAIR, POOR)
699
+ max_refinements=3, # maximum number of refinement iterations
700
+ )
701
+ ```
702
+
703
+ #### Router
704
+
705
+ ```python
706
+ @fast.router(
707
+ name="route", # name of the router
708
+ agents=["agent1", "agent2", "agent3"], # list of agent names router can delegate to
709
+ model="o3-mini.high", # specify routing model
710
+ use_history=False, # router maintains conversation history
711
+ human_input=False, # whether router can request human input
712
+ )
713
+ ```
714
+
715
+ #### Orchestrator
716
+
717
+ ```python
718
+ @fast.orchestrator(
719
+ name="orchestrator", # name of the orchestrator
720
+ instruction="instruction", # base instruction for the orchestrator
721
+ agents=["agent1", "agent2"], # list of agent names this orchestrator can use
722
+ model="o3-mini.high", # specify orchestrator planning model
723
+ use_history=False, # orchestrator doesn't maintain chat history (no effect).
724
+ human_input=False, # whether orchestrator can request human input
725
+ plan_type="full", # planning approach: "full" or "iterative"
726
+ plan_iterations=5, # maximum number of full plan attempts, or iterations
727
+ )
728
+ ```
729
+
730
+ ### Multimodal Support
731
+
732
+ Add Resources to prompts using either the inbuilt `prompt-server` or MCP Types directly. Convenience class are made available to do so simply, for example:
733
+
734
+ ```python
735
+ summary: str = await agent.with_resource(
736
+ "Summarise this PDF please",
737
+ "mcp_server",
738
+ "resource://fast-agent/sample.pdf",
739
+ )
740
+ ```
741
+
742
+ #### MCP Tool Result Conversion
743
+
744
+ LLM APIs have restrictions on the content types that can be returned as Tool Calls/Function results via their Chat Completions API's:
745
+
746
+ - OpenAI supports Text
747
+ - Anthropic supports Text and Image
748
+ - Google supports Text, Image, PDF, and Video (e.g., `video/mp4`).
749
+ > **Note**: Inline video data is limited to 20MB. For larger files, use the File API. YouTube URLs are supported directly.
750
+
751
+ For MCP Tool Results, `ImageResources` and `EmbeddedResources` are converted to User Messages and added to the conversation.
752
+
753
+ ### Prompts
754
+
755
+ MCP Prompts are supported with `apply_prompt(name,arguments)`, which always returns an Assistant Message. If the last message from the MCP Server is a 'User' message, it is sent to the LLM for processing. Prompts applied to the Agent's Context are retained - meaning that with `use_history=False`, Agents can act as finely tuned responders.
756
+
757
+ Prompts can also be applied interactively through the interactive interface by using the `/prompt` command.
758
+
759
+ ### Sampling
760
+
761
+ Sampling LLMs are configured per Client/Server pair. Specify the model name in fastagent.config.yaml as follows:
762
+
763
+ ```yaml
764
+ mcp:
765
+ servers:
766
+ sampling_resource:
767
+ command: "uv"
768
+ args: ["run", "sampling_resource_server.py"]
769
+ sampling:
770
+ model: "haiku"
771
+ ```
772
+
773
+ ### Secrets File
774
+
775
+ > [!TIP]
776
+ > 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.
777
+
778
+ ### Interactive Shell
779
+
780
+ ![fast-agent](https://github.com/user-attachments/assets/3e692103-bf97-489a-b519-2d0fee036369)
781
+
782
+ ## Project Notes
783
+
784
+ `fast-agent` builds on the [`mcp-agent`](https://github.com/lastmile-ai/mcp-agent) project by Sarmad Qadri.
785
+
786
+ ### Contributing
787
+
788
+ Contributions and PRs are welcome - feel free to raise issues to discuss. Full guidelines for contributing and roadmap coming very soon. Get in touch!