fast-agent-mcp 0.2.58__py3-none-any.whl → 0.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fast-agent-mcp might be problematic. Click here for more details.

Files changed (234) hide show
  1. fast_agent/__init__.py +127 -0
  2. fast_agent/agents/__init__.py +36 -0
  3. {mcp_agent/core → fast_agent/agents}/agent_types.py +2 -1
  4. fast_agent/agents/llm_agent.py +217 -0
  5. fast_agent/agents/llm_decorator.py +486 -0
  6. mcp_agent/agents/base_agent.py → fast_agent/agents/mcp_agent.py +377 -385
  7. fast_agent/agents/tool_agent.py +168 -0
  8. {mcp_agent → fast_agent}/agents/workflow/chain_agent.py +43 -33
  9. {mcp_agent → fast_agent}/agents/workflow/evaluator_optimizer.py +31 -35
  10. {mcp_agent → fast_agent}/agents/workflow/iterative_planner.py +56 -47
  11. {mcp_agent → fast_agent}/agents/workflow/orchestrator_models.py +4 -4
  12. {mcp_agent → fast_agent}/agents/workflow/parallel_agent.py +34 -41
  13. {mcp_agent → fast_agent}/agents/workflow/router_agent.py +54 -39
  14. {mcp_agent → fast_agent}/cli/__main__.py +5 -3
  15. {mcp_agent → fast_agent}/cli/commands/check_config.py +95 -66
  16. {mcp_agent → fast_agent}/cli/commands/go.py +20 -11
  17. {mcp_agent → fast_agent}/cli/commands/quickstart.py +4 -4
  18. {mcp_agent → fast_agent}/cli/commands/server_helpers.py +1 -1
  19. {mcp_agent → fast_agent}/cli/commands/setup.py +75 -134
  20. {mcp_agent → fast_agent}/cli/commands/url_parser.py +9 -8
  21. {mcp_agent → fast_agent}/cli/main.py +36 -16
  22. {mcp_agent → fast_agent}/cli/terminal.py +2 -2
  23. {mcp_agent → fast_agent}/config.py +10 -2
  24. fast_agent/constants.py +8 -0
  25. {mcp_agent → fast_agent}/context.py +24 -19
  26. {mcp_agent → fast_agent}/context_dependent.py +9 -5
  27. fast_agent/core/__init__.py +52 -0
  28. {mcp_agent → fast_agent}/core/agent_app.py +39 -36
  29. fast_agent/core/core_app.py +135 -0
  30. {mcp_agent → fast_agent}/core/direct_decorators.py +12 -26
  31. {mcp_agent → fast_agent}/core/direct_factory.py +95 -73
  32. {mcp_agent → fast_agent/core}/executor/executor.py +4 -5
  33. {mcp_agent → fast_agent}/core/fastagent.py +32 -32
  34. fast_agent/core/logging/__init__.py +5 -0
  35. {mcp_agent → fast_agent/core}/logging/events.py +3 -3
  36. {mcp_agent → fast_agent/core}/logging/json_serializer.py +1 -1
  37. {mcp_agent → fast_agent/core}/logging/listeners.py +85 -7
  38. {mcp_agent → fast_agent/core}/logging/logger.py +7 -7
  39. {mcp_agent → fast_agent/core}/logging/transport.py +10 -11
  40. fast_agent/core/prompt.py +9 -0
  41. {mcp_agent → fast_agent}/core/validation.py +4 -4
  42. fast_agent/event_progress.py +61 -0
  43. fast_agent/history/history_exporter.py +44 -0
  44. {mcp_agent → fast_agent}/human_input/__init__.py +9 -12
  45. {mcp_agent → fast_agent}/human_input/elicitation_handler.py +26 -8
  46. {mcp_agent → fast_agent}/human_input/elicitation_state.py +7 -7
  47. {mcp_agent → fast_agent}/human_input/simple_form.py +6 -4
  48. {mcp_agent → fast_agent}/human_input/types.py +1 -18
  49. fast_agent/interfaces.py +228 -0
  50. fast_agent/llm/__init__.py +9 -0
  51. mcp_agent/llm/augmented_llm.py → fast_agent/llm/fastagent_llm.py +127 -218
  52. fast_agent/llm/internal/passthrough.py +137 -0
  53. mcp_agent/llm/augmented_llm_playback.py → fast_agent/llm/internal/playback.py +29 -25
  54. mcp_agent/llm/augmented_llm_silent.py → fast_agent/llm/internal/silent.py +10 -17
  55. fast_agent/llm/internal/slow.py +38 -0
  56. {mcp_agent → fast_agent}/llm/memory.py +40 -30
  57. {mcp_agent → fast_agent}/llm/model_database.py +35 -2
  58. {mcp_agent → fast_agent}/llm/model_factory.py +103 -77
  59. fast_agent/llm/model_info.py +126 -0
  60. {mcp_agent/llm/providers → fast_agent/llm/provider/anthropic}/anthropic_utils.py +7 -7
  61. fast_agent/llm/provider/anthropic/llm_anthropic.py +603 -0
  62. {mcp_agent/llm/providers → fast_agent/llm/provider/anthropic}/multipart_converter_anthropic.py +79 -86
  63. {mcp_agent/llm/providers → fast_agent/llm/provider/bedrock}/bedrock_utils.py +3 -1
  64. mcp_agent/llm/providers/augmented_llm_bedrock.py → fast_agent/llm/provider/bedrock/llm_bedrock.py +833 -717
  65. {mcp_agent/llm/providers → fast_agent/llm/provider/google}/google_converter.py +66 -14
  66. fast_agent/llm/provider/google/llm_google_native.py +431 -0
  67. mcp_agent/llm/providers/augmented_llm_aliyun.py → fast_agent/llm/provider/openai/llm_aliyun.py +6 -7
  68. mcp_agent/llm/providers/augmented_llm_azure.py → fast_agent/llm/provider/openai/llm_azure.py +4 -4
  69. mcp_agent/llm/providers/augmented_llm_deepseek.py → fast_agent/llm/provider/openai/llm_deepseek.py +10 -11
  70. mcp_agent/llm/providers/augmented_llm_generic.py → fast_agent/llm/provider/openai/llm_generic.py +4 -4
  71. mcp_agent/llm/providers/augmented_llm_google_oai.py → fast_agent/llm/provider/openai/llm_google_oai.py +4 -4
  72. mcp_agent/llm/providers/augmented_llm_groq.py → fast_agent/llm/provider/openai/llm_groq.py +14 -16
  73. mcp_agent/llm/providers/augmented_llm_openai.py → fast_agent/llm/provider/openai/llm_openai.py +133 -207
  74. mcp_agent/llm/providers/augmented_llm_openrouter.py → fast_agent/llm/provider/openai/llm_openrouter.py +6 -6
  75. mcp_agent/llm/providers/augmented_llm_tensorzero_openai.py → fast_agent/llm/provider/openai/llm_tensorzero_openai.py +17 -16
  76. mcp_agent/llm/providers/augmented_llm_xai.py → fast_agent/llm/provider/openai/llm_xai.py +6 -6
  77. {mcp_agent/llm/providers → fast_agent/llm/provider/openai}/multipart_converter_openai.py +125 -63
  78. {mcp_agent/llm/providers → fast_agent/llm/provider/openai}/openai_multipart.py +12 -12
  79. {mcp_agent/llm/providers → fast_agent/llm/provider/openai}/openai_utils.py +18 -16
  80. {mcp_agent → fast_agent}/llm/provider_key_manager.py +2 -2
  81. {mcp_agent → fast_agent}/llm/provider_types.py +2 -0
  82. {mcp_agent → fast_agent}/llm/sampling_converter.py +15 -12
  83. {mcp_agent → fast_agent}/llm/usage_tracking.py +23 -5
  84. fast_agent/mcp/__init__.py +54 -0
  85. {mcp_agent → fast_agent}/mcp/elicitation_factory.py +3 -3
  86. {mcp_agent → fast_agent}/mcp/elicitation_handlers.py +19 -10
  87. {mcp_agent → fast_agent}/mcp/gen_client.py +3 -3
  88. fast_agent/mcp/helpers/__init__.py +36 -0
  89. fast_agent/mcp/helpers/content_helpers.py +183 -0
  90. {mcp_agent → fast_agent}/mcp/helpers/server_config_helpers.py +8 -8
  91. {mcp_agent → fast_agent}/mcp/hf_auth.py +25 -23
  92. fast_agent/mcp/interfaces.py +93 -0
  93. {mcp_agent → fast_agent}/mcp/logger_textio.py +4 -4
  94. {mcp_agent → fast_agent}/mcp/mcp_agent_client_session.py +49 -44
  95. {mcp_agent → fast_agent}/mcp/mcp_aggregator.py +66 -115
  96. {mcp_agent → fast_agent}/mcp/mcp_connection_manager.py +16 -23
  97. {mcp_agent/core → fast_agent/mcp}/mcp_content.py +23 -15
  98. {mcp_agent → fast_agent}/mcp/mime_utils.py +39 -0
  99. fast_agent/mcp/prompt.py +159 -0
  100. mcp_agent/mcp/prompt_message_multipart.py → fast_agent/mcp/prompt_message_extended.py +27 -20
  101. {mcp_agent → fast_agent}/mcp/prompt_render.py +21 -19
  102. {mcp_agent → fast_agent}/mcp/prompt_serialization.py +46 -46
  103. fast_agent/mcp/prompts/__main__.py +7 -0
  104. {mcp_agent → fast_agent}/mcp/prompts/prompt_helpers.py +31 -30
  105. {mcp_agent → fast_agent}/mcp/prompts/prompt_load.py +8 -8
  106. {mcp_agent → fast_agent}/mcp/prompts/prompt_server.py +11 -19
  107. {mcp_agent → fast_agent}/mcp/prompts/prompt_template.py +18 -18
  108. {mcp_agent → fast_agent}/mcp/resource_utils.py +1 -1
  109. {mcp_agent → fast_agent}/mcp/sampling.py +31 -26
  110. {mcp_agent/mcp_server → fast_agent/mcp/server}/__init__.py +1 -1
  111. {mcp_agent/mcp_server → fast_agent/mcp/server}/agent_server.py +5 -6
  112. fast_agent/mcp/ui_agent.py +48 -0
  113. fast_agent/mcp/ui_mixin.py +209 -0
  114. fast_agent/mcp_server_registry.py +90 -0
  115. {mcp_agent → fast_agent}/resources/examples/data-analysis/analysis-campaign.py +5 -4
  116. {mcp_agent → fast_agent}/resources/examples/data-analysis/analysis.py +1 -1
  117. {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/forms_demo.py +3 -3
  118. {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/game_character.py +2 -2
  119. {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/game_character_handler.py +1 -1
  120. {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/tool_call.py +1 -1
  121. {mcp_agent → fast_agent}/resources/examples/mcp/state-transfer/agent_one.py +1 -1
  122. {mcp_agent → fast_agent}/resources/examples/mcp/state-transfer/agent_two.py +1 -1
  123. {mcp_agent → fast_agent}/resources/examples/researcher/researcher-eval.py +1 -1
  124. {mcp_agent → fast_agent}/resources/examples/researcher/researcher-imp.py +1 -1
  125. {mcp_agent → fast_agent}/resources/examples/researcher/researcher.py +1 -1
  126. {mcp_agent → fast_agent}/resources/examples/tensorzero/agent.py +2 -2
  127. {mcp_agent → fast_agent}/resources/examples/tensorzero/image_demo.py +3 -3
  128. {mcp_agent → fast_agent}/resources/examples/tensorzero/simple_agent.py +1 -1
  129. {mcp_agent → fast_agent}/resources/examples/workflows/chaining.py +1 -1
  130. {mcp_agent → fast_agent}/resources/examples/workflows/evaluator.py +3 -3
  131. {mcp_agent → fast_agent}/resources/examples/workflows/human_input.py +5 -3
  132. {mcp_agent → fast_agent}/resources/examples/workflows/orchestrator.py +1 -1
  133. {mcp_agent → fast_agent}/resources/examples/workflows/parallel.py +2 -2
  134. {mcp_agent → fast_agent}/resources/examples/workflows/router.py +5 -2
  135. fast_agent/resources/setup/.gitignore +24 -0
  136. fast_agent/resources/setup/agent.py +18 -0
  137. fast_agent/resources/setup/fastagent.config.yaml +44 -0
  138. fast_agent/resources/setup/fastagent.secrets.yaml.example +38 -0
  139. fast_agent/resources/setup/pyproject.toml.tmpl +17 -0
  140. fast_agent/tools/elicitation.py +369 -0
  141. fast_agent/types/__init__.py +32 -0
  142. fast_agent/types/llm_stop_reason.py +77 -0
  143. fast_agent/ui/__init__.py +38 -0
  144. fast_agent/ui/console_display.py +1005 -0
  145. {mcp_agent/human_input → fast_agent/ui}/elicitation_form.py +17 -12
  146. mcp_agent/human_input/elicitation_forms.py → fast_agent/ui/elicitation_style.py +1 -1
  147. {mcp_agent/core → fast_agent/ui}/enhanced_prompt.py +96 -25
  148. {mcp_agent/core → fast_agent/ui}/interactive_prompt.py +330 -125
  149. fast_agent/ui/mcp_ui_utils.py +224 -0
  150. {mcp_agent → fast_agent/ui}/progress_display.py +2 -2
  151. {mcp_agent/logging → fast_agent/ui}/rich_progress.py +4 -4
  152. {mcp_agent/core → fast_agent/ui}/usage_display.py +3 -8
  153. {fast_agent_mcp-0.2.58.dist-info → fast_agent_mcp-0.3.1.dist-info}/METADATA +7 -7
  154. fast_agent_mcp-0.3.1.dist-info/RECORD +203 -0
  155. fast_agent_mcp-0.3.1.dist-info/entry_points.txt +5 -0
  156. fast_agent_mcp-0.2.58.dist-info/RECORD +0 -193
  157. fast_agent_mcp-0.2.58.dist-info/entry_points.txt +0 -6
  158. mcp_agent/__init__.py +0 -114
  159. mcp_agent/agents/agent.py +0 -92
  160. mcp_agent/agents/workflow/__init__.py +0 -1
  161. mcp_agent/agents/workflow/orchestrator_agent.py +0 -597
  162. mcp_agent/app.py +0 -175
  163. mcp_agent/core/__init__.py +0 -26
  164. mcp_agent/core/prompt.py +0 -191
  165. mcp_agent/event_progress.py +0 -134
  166. mcp_agent/human_input/handler.py +0 -81
  167. mcp_agent/llm/__init__.py +0 -2
  168. mcp_agent/llm/augmented_llm_passthrough.py +0 -232
  169. mcp_agent/llm/augmented_llm_slow.py +0 -53
  170. mcp_agent/llm/providers/__init__.py +0 -8
  171. mcp_agent/llm/providers/augmented_llm_anthropic.py +0 -718
  172. mcp_agent/llm/providers/augmented_llm_google_native.py +0 -496
  173. mcp_agent/llm/providers/sampling_converter_anthropic.py +0 -57
  174. mcp_agent/llm/providers/sampling_converter_openai.py +0 -26
  175. mcp_agent/llm/sampling_format_converter.py +0 -37
  176. mcp_agent/logging/__init__.py +0 -0
  177. mcp_agent/mcp/__init__.py +0 -50
  178. mcp_agent/mcp/helpers/__init__.py +0 -25
  179. mcp_agent/mcp/helpers/content_helpers.py +0 -187
  180. mcp_agent/mcp/interfaces.py +0 -266
  181. mcp_agent/mcp/prompts/__init__.py +0 -0
  182. mcp_agent/mcp/prompts/__main__.py +0 -10
  183. mcp_agent/mcp_server_registry.py +0 -343
  184. mcp_agent/tools/tool_definition.py +0 -14
  185. mcp_agent/ui/console_display.py +0 -790
  186. mcp_agent/ui/console_display_legacy.py +0 -401
  187. {mcp_agent → fast_agent}/agents/workflow/orchestrator_prompts.py +0 -0
  188. {mcp_agent/agents → fast_agent/cli}/__init__.py +0 -0
  189. {mcp_agent → fast_agent}/cli/constants.py +0 -0
  190. {mcp_agent → fast_agent}/core/error_handling.py +0 -0
  191. {mcp_agent → fast_agent}/core/exceptions.py +0 -0
  192. {mcp_agent/cli → fast_agent/core/executor}/__init__.py +0 -0
  193. {mcp_agent → fast_agent/core}/executor/task_registry.py +0 -0
  194. {mcp_agent → fast_agent/core}/executor/workflow_signal.py +0 -0
  195. {mcp_agent → fast_agent}/human_input/form_fields.py +0 -0
  196. {mcp_agent → fast_agent}/llm/prompt_utils.py +0 -0
  197. {mcp_agent/core → fast_agent/llm}/request_params.py +0 -0
  198. {mcp_agent → fast_agent}/mcp/common.py +0 -0
  199. {mcp_agent/executor → fast_agent/mcp/prompts}/__init__.py +0 -0
  200. {mcp_agent → fast_agent}/mcp/prompts/prompt_constants.py +0 -0
  201. {mcp_agent → fast_agent}/py.typed +0 -0
  202. {mcp_agent → fast_agent}/resources/examples/data-analysis/fastagent.config.yaml +0 -0
  203. {mcp_agent → fast_agent}/resources/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-Attrition.csv +0 -0
  204. {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/elicitation_account_server.py +0 -0
  205. {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/elicitation_forms_server.py +0 -0
  206. {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/elicitation_game_server.py +0 -0
  207. {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/fastagent.config.yaml +0 -0
  208. {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/fastagent.secrets.yaml.example +0 -0
  209. {mcp_agent → fast_agent}/resources/examples/mcp/state-transfer/fastagent.config.yaml +0 -0
  210. {mcp_agent → fast_agent}/resources/examples/mcp/state-transfer/fastagent.secrets.yaml.example +0 -0
  211. {mcp_agent → fast_agent}/resources/examples/researcher/fastagent.config.yaml +0 -0
  212. {mcp_agent → fast_agent}/resources/examples/tensorzero/.env.sample +0 -0
  213. {mcp_agent → fast_agent}/resources/examples/tensorzero/Makefile +0 -0
  214. {mcp_agent → fast_agent}/resources/examples/tensorzero/README.md +0 -0
  215. {mcp_agent → fast_agent}/resources/examples/tensorzero/demo_images/clam.jpg +0 -0
  216. {mcp_agent → fast_agent}/resources/examples/tensorzero/demo_images/crab.png +0 -0
  217. {mcp_agent → fast_agent}/resources/examples/tensorzero/demo_images/shrimp.png +0 -0
  218. {mcp_agent → fast_agent}/resources/examples/tensorzero/docker-compose.yml +0 -0
  219. {mcp_agent → fast_agent}/resources/examples/tensorzero/fastagent.config.yaml +0 -0
  220. {mcp_agent → fast_agent}/resources/examples/tensorzero/mcp_server/Dockerfile +0 -0
  221. {mcp_agent → fast_agent}/resources/examples/tensorzero/mcp_server/entrypoint.sh +0 -0
  222. {mcp_agent → fast_agent}/resources/examples/tensorzero/mcp_server/mcp_server.py +0 -0
  223. {mcp_agent → fast_agent}/resources/examples/tensorzero/mcp_server/pyproject.toml +0 -0
  224. {mcp_agent → fast_agent}/resources/examples/tensorzero/tensorzero_config/system_schema.json +0 -0
  225. {mcp_agent → fast_agent}/resources/examples/tensorzero/tensorzero_config/system_template.minijinja +0 -0
  226. {mcp_agent → fast_agent}/resources/examples/tensorzero/tensorzero_config/tensorzero.toml +0 -0
  227. {mcp_agent → fast_agent}/resources/examples/workflows/fastagent.config.yaml +0 -0
  228. {mcp_agent → fast_agent}/resources/examples/workflows/graded_report.md +0 -0
  229. {mcp_agent → fast_agent}/resources/examples/workflows/short_story.md +0 -0
  230. {mcp_agent → fast_agent}/resources/examples/workflows/short_story.txt +0 -0
  231. {mcp_agent → fast_agent/ui}/console.py +0 -0
  232. {mcp_agent/core → fast_agent/ui}/mermaid_utils.py +0 -0
  233. {fast_agent_mcp-0.2.58.dist-info → fast_agent_mcp-0.3.1.dist-info}/WHEEL +0 -0
  234. {fast_agent_mcp-0.2.58.dist-info → fast_agent_mcp-0.3.1.dist-info}/licenses/LICENSE +0 -0
fast_agent/__init__.py ADDED
@@ -0,0 +1,127 @@
1
+ """fast-agent - An MCP native agent application framework"""
2
+
3
+ # Configuration and settings (safe - pure Pydantic models)
4
+ from fast_agent.config import (
5
+ AnthropicSettings,
6
+ AzureSettings,
7
+ BedrockSettings,
8
+ DeepSeekSettings,
9
+ GenericSettings,
10
+ GoogleSettings,
11
+ GroqSettings,
12
+ HuggingFaceSettings,
13
+ LoggerSettings,
14
+ MCPElicitationSettings,
15
+ MCPRootSettings,
16
+ MCPSamplingSettings,
17
+ MCPServerAuthSettings,
18
+ MCPServerSettings,
19
+ MCPSettings,
20
+ OpenAISettings,
21
+ OpenRouterSettings,
22
+ OpenTelemetrySettings,
23
+ Settings,
24
+ TensorZeroSettings,
25
+ XAISettings,
26
+ )
27
+
28
+ # Type definitions and enums (safe - no dependencies)
29
+ from fast_agent.types import LlmStopReason, RequestParams
30
+
31
+
32
+ def __getattr__(name: str):
33
+ """Lazy import heavy modules to avoid circular imports during package initialization."""
34
+ if name == "Core":
35
+ from fast_agent.core import Core
36
+
37
+ return Core
38
+ elif name == "Context":
39
+ from fast_agent.context import Context
40
+
41
+ return Context
42
+ elif name == "ContextDependent":
43
+ from fast_agent.context_dependent import ContextDependent
44
+
45
+ return ContextDependent
46
+ elif name == "ServerRegistry":
47
+ from fast_agent.mcp_server_registry import ServerRegistry
48
+
49
+ return ServerRegistry
50
+ elif name == "ProgressAction":
51
+ from fast_agent.event_progress import ProgressAction
52
+
53
+ return ProgressAction
54
+ elif name == "ProgressEvent":
55
+ from fast_agent.event_progress import ProgressEvent
56
+
57
+ return ProgressEvent
58
+ elif name == "ToolAgentSynchronous":
59
+ from fast_agent.agents.tool_agent import ToolAgent
60
+
61
+ return ToolAgent
62
+ elif name == "LlmAgent":
63
+ from fast_agent.agents.llm_agent import LlmAgent
64
+
65
+ return LlmAgent
66
+ elif name == "LlmDecorator":
67
+ from fast_agent.agents.llm_decorator import LlmDecorator
68
+
69
+ return LlmDecorator
70
+ elif name == "ToolAgent":
71
+ from fast_agent.agents.tool_agent import ToolAgent
72
+
73
+ return ToolAgent
74
+ elif name == "McpAgent":
75
+ from fast_agent.agents.mcp_agent import McpAgent
76
+
77
+ return McpAgent
78
+ elif name == "FastAgent":
79
+ from fast_agent.core.fastagent import FastAgent
80
+
81
+ return FastAgent
82
+ else:
83
+ raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
84
+
85
+
86
+ __all__ = [
87
+ # Core fast-agent components (lazy loaded)
88
+ "Core",
89
+ "Context",
90
+ "ContextDependent",
91
+ "ServerRegistry",
92
+ # Configuration and settings (eagerly loaded)
93
+ "Settings",
94
+ "MCPSettings",
95
+ "MCPServerSettings",
96
+ "MCPServerAuthSettings",
97
+ "MCPSamplingSettings",
98
+ "MCPElicitationSettings",
99
+ "MCPRootSettings",
100
+ "AnthropicSettings",
101
+ "OpenAISettings",
102
+ "DeepSeekSettings",
103
+ "GoogleSettings",
104
+ "XAISettings",
105
+ "GenericSettings",
106
+ "OpenRouterSettings",
107
+ "AzureSettings",
108
+ "GroqSettings",
109
+ "OpenTelemetrySettings",
110
+ "TensorZeroSettings",
111
+ "BedrockSettings",
112
+ "HuggingFaceSettings",
113
+ "LoggerSettings",
114
+ # Progress and event tracking (lazy loaded)
115
+ "ProgressAction",
116
+ "ProgressEvent",
117
+ # Type definitions and enums (eagerly loaded)
118
+ "LlmStopReason",
119
+ "RequestParams",
120
+ # Agents (lazy loaded)
121
+ "ToolAgentSynchronous",
122
+ "LlmAgent",
123
+ "LlmDecorator",
124
+ "ToolAgent",
125
+ "McpAgent",
126
+ "FastAgent",
127
+ ]
@@ -0,0 +1,36 @@
1
+ """
2
+ Fast Agent - Agent implementations and workflow patterns.
3
+
4
+ This module exports all agent classes from the fast_agent.agents package,
5
+ providing a single import point for both core agents and workflow agents.
6
+ """
7
+
8
+ # Core agents
9
+ from fast_agent.agents.agent_types import AgentConfig
10
+ from fast_agent.agents.llm_agent import LlmAgent
11
+ from fast_agent.agents.llm_decorator import LlmDecorator
12
+ from fast_agent.agents.mcp_agent import McpAgent
13
+ from fast_agent.agents.tool_agent import ToolAgent
14
+
15
+ # Workflow agents
16
+ from fast_agent.agents.workflow.chain_agent import ChainAgent
17
+ from fast_agent.agents.workflow.evaluator_optimizer import EvaluatorOptimizerAgent
18
+ from fast_agent.agents.workflow.iterative_planner import IterativePlanner
19
+ from fast_agent.agents.workflow.parallel_agent import ParallelAgent
20
+ from fast_agent.agents.workflow.router_agent import RouterAgent
21
+
22
+ __all__ = [
23
+ # Core agents
24
+ "LlmAgent",
25
+ "LlmDecorator",
26
+ "ToolAgent",
27
+ "McpAgent",
28
+ # Workflow agents
29
+ "ChainAgent",
30
+ "EvaluatorOptimizerAgent",
31
+ "IterativePlanner",
32
+ "ParallelAgent",
33
+ "RouterAgent",
34
+ # Types
35
+ "AgentConfig",
36
+ ]
@@ -9,12 +9,13 @@ from typing import Dict, List, Optional
9
9
  from mcp.client.session import ElicitationFnT
10
10
 
11
11
  # Forward imports to avoid circular dependencies
12
- from mcp_agent.core.request_params import RequestParams
12
+ from fast_agent.types import RequestParams
13
13
 
14
14
 
15
15
  class AgentType(Enum):
16
16
  """Enumeration of supported agent types."""
17
17
 
18
+ LLM = "llm" # simple llm delegator
18
19
  BASIC = "agent"
19
20
  CUSTOM = "custom"
20
21
  ORCHESTRATOR = "orchestrator"
@@ -0,0 +1,217 @@
1
+ """
2
+ LLM Agent class that adds interaction behaviors to LlmDecorator.
3
+
4
+ This class extends LlmDecorator with LLM-specific interaction behaviors including:
5
+ - UI display methods for messages, tools, and prompts
6
+ - Stop reason handling
7
+ - Tool call tracking
8
+ - Chat display integration
9
+ """
10
+
11
+ from typing import List, Optional, Tuple
12
+
13
+ try:
14
+ from a2a.types import AgentCapabilities # type: ignore
15
+ except Exception: # pragma: no cover - optional dependency fallback
16
+ from dataclasses import dataclass
17
+
18
+ @dataclass
19
+ class AgentCapabilities: # minimal fallback
20
+ streaming: bool = False
21
+ push_notifications: bool = False
22
+ state_transition_history: bool = False
23
+
24
+
25
+ from mcp import Tool
26
+ from rich.text import Text
27
+
28
+ from fast_agent.agents.agent_types import AgentConfig
29
+ from fast_agent.agents.llm_decorator import LlmDecorator, ModelT
30
+ from fast_agent.context import Context
31
+ from fast_agent.types import PromptMessageExtended, RequestParams
32
+ from fast_agent.types.llm_stop_reason import LlmStopReason
33
+ from fast_agent.ui.console_display import ConsoleDisplay
34
+
35
+ # TODO -- decide what to do with type safety for model/chat_turn()
36
+
37
+ DEFAULT_CAPABILITIES = AgentCapabilities(
38
+ streaming=False, push_notifications=False, state_transition_history=False
39
+ )
40
+
41
+
42
+ class LlmAgent(LlmDecorator):
43
+ """
44
+ An LLM agent that adds interaction behaviors to the base LlmDecorator.
45
+
46
+ This class provides LLM-specific functionality including UI display methods,
47
+ tool call tracking, and chat interaction patterns while delegating core
48
+ LLM operations to the attached AugmentedLLMProtocol.
49
+ """
50
+
51
+ def __init__(
52
+ self,
53
+ config: AgentConfig,
54
+ context: Context | None = None,
55
+ ) -> None:
56
+ super().__init__(config=config, context=context)
57
+
58
+ # Initialize display component
59
+ self.display = ConsoleDisplay(config=self._context.config if self._context else None)
60
+
61
+ async def show_assistant_message(
62
+ self,
63
+ message: PromptMessageExtended,
64
+ bottom_items: List[str] | None = None,
65
+ highlight_items: str | List[str] | None = None,
66
+ max_item_length: int | None = None,
67
+ name: str | None = None,
68
+ model: str | None = None,
69
+ additional_message: Optional[Text] = None,
70
+ ) -> None:
71
+ """Display an assistant message with appropriate styling based on stop reason.
72
+
73
+ Args:
74
+ message: The message to display
75
+ bottom_items: Optional items for bottom bar (e.g., servers, destinations)
76
+ highlight_items: Items to highlight in bottom bar
77
+ max_item_length: Max length for bottom items
78
+ name: Optional agent name to display
79
+ model: Optional model name to display
80
+ additional_message: Optional additional message to display
81
+ """
82
+
83
+ # Determine display content based on stop reason if not provided
84
+ if additional_message is None:
85
+ # Generate additional message based on stop reason
86
+ match message.stop_reason:
87
+ case LlmStopReason.END_TURN:
88
+ # No additional message needed for normal end turn
89
+ additional_message_text = None
90
+
91
+ case LlmStopReason.MAX_TOKENS:
92
+ additional_message_text = Text(
93
+ "\n\nMaximum output tokens reached - generation stopped.",
94
+ style="dim red italic",
95
+ )
96
+
97
+ case LlmStopReason.SAFETY:
98
+ additional_message_text = Text(
99
+ "\n\nContent filter activated - generation stopped.", style="dim red italic"
100
+ )
101
+
102
+ case LlmStopReason.PAUSE:
103
+ additional_message_text = Text(
104
+ "\n\nLLM has requested a pause.", style="dim green italic"
105
+ )
106
+
107
+ case LlmStopReason.STOP_SEQUENCE:
108
+ additional_message_text = Text(
109
+ "\n\nStop Sequence activated - generation stopped.", style="dim red italic"
110
+ )
111
+
112
+ case LlmStopReason.TOOL_USE:
113
+ if None is message.last_text():
114
+ additional_message_text = Text(
115
+ "The assistant requested tool calls", style="dim green italic"
116
+ )
117
+ else:
118
+ additional_message_text = None
119
+
120
+ case _:
121
+ if message.stop_reason:
122
+ additional_message_text = Text(
123
+ f"\n\nGeneration stopped for an unhandled reason ({message.stop_reason})",
124
+ style="dim red italic",
125
+ )
126
+ else:
127
+ additional_message_text = None
128
+ else:
129
+ # Use provided additional message
130
+ additional_message_text = (
131
+ additional_message if isinstance(additional_message, Text) else None
132
+ )
133
+
134
+ message_text = message.last_text() or ""
135
+
136
+ # Use provided name/model or fall back to defaults
137
+ display_name = name if name is not None else self.name
138
+ display_model = model if model is not None else (self.llm.model_name if self._llm else None)
139
+
140
+ await self.display.show_assistant_message(
141
+ message_text,
142
+ bottom_items=bottom_items,
143
+ highlight_items=highlight_items,
144
+ max_item_length=max_item_length,
145
+ name=display_name,
146
+ model=display_model,
147
+ additional_message=additional_message_text,
148
+ )
149
+
150
+ def show_user_message(self, message: PromptMessageExtended) -> None:
151
+ """Display a user message in a formatted panel."""
152
+ model = self.llm.model_name
153
+ chat_turn = self._llm.chat_turn()
154
+ self.display.show_user_message(message.last_text() or "", model, chat_turn, name=self.name)
155
+
156
+ async def generate_impl(
157
+ self,
158
+ messages: List[PromptMessageExtended],
159
+ request_params: RequestParams | None = None,
160
+ tools: List[Tool] | None = None,
161
+ ) -> PromptMessageExtended:
162
+ """
163
+ Enhanced generate implementation that resets tool call tracking.
164
+ Messages are already normalized to List[PromptMessageExtended].
165
+ """
166
+ if "user" == messages[-1].role:
167
+ self.show_user_message(message=messages[-1])
168
+
169
+ # TODO -- we should merge the request parameters here with the LLM defaults?
170
+ # TODO - manage error catch, recovery, pause
171
+ result = await super().generate_impl(messages, request_params, tools)
172
+
173
+ await self.show_assistant_message(result)
174
+ return result
175
+
176
+ async def structured_impl(
177
+ self,
178
+ messages: List[PromptMessageExtended],
179
+ model: type[ModelT],
180
+ request_params: RequestParams | None = None,
181
+ ) -> Tuple[ModelT | None, PromptMessageExtended]:
182
+ if "user" == messages[-1].role:
183
+ self.show_user_message(message=messages[-1])
184
+
185
+ result, message = await super().structured_impl(messages, model, request_params)
186
+ await self.show_assistant_message(message=message)
187
+ return result, message
188
+
189
+ # async def show_prompt_loaded(
190
+ # self,
191
+ # prompt_name: str,
192
+ # description: Optional[str] = None,
193
+ # message_count: int = 0,
194
+ # arguments: Optional[dict[str, str]] = None,
195
+ # ) -> None:
196
+ # """
197
+ # Display information about a loaded prompt template.
198
+
199
+ # Args:
200
+ # prompt_name: The name of the prompt
201
+ # description: Optional description of the prompt
202
+ # message_count: Number of messages in the prompt
203
+ # arguments: Optional dictionary of arguments passed to the prompt
204
+ # """
205
+ # # Get aggregator from attached LLM if available
206
+ # aggregator = None
207
+ # if self._llm and hasattr(self._llm, "aggregator"):
208
+ # aggregator = self._llm.aggregator
209
+
210
+ # await self.display.show_prompt_loaded(
211
+ # prompt_name=prompt_name,
212
+ # description=description,
213
+ # message_count=message_count,
214
+ # agent_name=self.name,
215
+ # aggregator=aggregator,
216
+ # arguments=arguments,
217
+ # )