fast-agent-mcp 0.2.57__py3-none-any.whl → 0.3.0__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.
- fast_agent/__init__.py +127 -0
- fast_agent/agents/__init__.py +36 -0
- {mcp_agent/core → fast_agent/agents}/agent_types.py +2 -1
- fast_agent/agents/llm_agent.py +217 -0
- fast_agent/agents/llm_decorator.py +486 -0
- mcp_agent/agents/base_agent.py → fast_agent/agents/mcp_agent.py +377 -385
- fast_agent/agents/tool_agent.py +168 -0
- {mcp_agent → fast_agent}/agents/workflow/chain_agent.py +43 -33
- {mcp_agent → fast_agent}/agents/workflow/evaluator_optimizer.py +31 -35
- {mcp_agent → fast_agent}/agents/workflow/iterative_planner.py +56 -47
- {mcp_agent → fast_agent}/agents/workflow/orchestrator_models.py +4 -4
- {mcp_agent → fast_agent}/agents/workflow/parallel_agent.py +34 -41
- {mcp_agent → fast_agent}/agents/workflow/router_agent.py +54 -39
- {mcp_agent → fast_agent}/cli/__main__.py +5 -3
- {mcp_agent → fast_agent}/cli/commands/check_config.py +95 -66
- {mcp_agent → fast_agent}/cli/commands/go.py +20 -11
- {mcp_agent → fast_agent}/cli/commands/quickstart.py +4 -4
- {mcp_agent → fast_agent}/cli/commands/server_helpers.py +1 -1
- {mcp_agent → fast_agent}/cli/commands/setup.py +64 -134
- {mcp_agent → fast_agent}/cli/commands/url_parser.py +9 -8
- {mcp_agent → fast_agent}/cli/main.py +36 -16
- {mcp_agent → fast_agent}/cli/terminal.py +2 -2
- {mcp_agent → fast_agent}/config.py +13 -2
- fast_agent/constants.py +8 -0
- {mcp_agent → fast_agent}/context.py +24 -19
- {mcp_agent → fast_agent}/context_dependent.py +9 -5
- fast_agent/core/__init__.py +17 -0
- {mcp_agent → fast_agent}/core/agent_app.py +39 -36
- fast_agent/core/core_app.py +135 -0
- {mcp_agent → fast_agent}/core/direct_decorators.py +12 -26
- {mcp_agent → fast_agent}/core/direct_factory.py +95 -73
- {mcp_agent → fast_agent/core}/executor/executor.py +4 -5
- {mcp_agent → fast_agent}/core/fastagent.py +32 -32
- fast_agent/core/logging/__init__.py +5 -0
- {mcp_agent → fast_agent/core}/logging/events.py +3 -3
- {mcp_agent → fast_agent/core}/logging/json_serializer.py +1 -1
- {mcp_agent → fast_agent/core}/logging/listeners.py +85 -7
- {mcp_agent → fast_agent/core}/logging/logger.py +7 -7
- {mcp_agent → fast_agent/core}/logging/transport.py +10 -11
- fast_agent/core/prompt.py +9 -0
- {mcp_agent → fast_agent}/core/validation.py +4 -4
- fast_agent/event_progress.py +61 -0
- fast_agent/history/history_exporter.py +44 -0
- {mcp_agent → fast_agent}/human_input/__init__.py +9 -12
- {mcp_agent → fast_agent}/human_input/elicitation_handler.py +26 -8
- {mcp_agent → fast_agent}/human_input/elicitation_state.py +7 -7
- {mcp_agent → fast_agent}/human_input/simple_form.py +6 -4
- {mcp_agent → fast_agent}/human_input/types.py +1 -18
- fast_agent/interfaces.py +228 -0
- fast_agent/llm/__init__.py +9 -0
- mcp_agent/llm/augmented_llm.py → fast_agent/llm/fastagent_llm.py +128 -218
- fast_agent/llm/internal/passthrough.py +137 -0
- mcp_agent/llm/augmented_llm_playback.py → fast_agent/llm/internal/playback.py +29 -25
- mcp_agent/llm/augmented_llm_silent.py → fast_agent/llm/internal/silent.py +10 -17
- fast_agent/llm/internal/slow.py +38 -0
- {mcp_agent → fast_agent}/llm/memory.py +40 -30
- {mcp_agent → fast_agent}/llm/model_database.py +35 -2
- {mcp_agent → fast_agent}/llm/model_factory.py +103 -77
- fast_agent/llm/model_info.py +126 -0
- {mcp_agent/llm/providers → fast_agent/llm/provider/anthropic}/anthropic_utils.py +7 -7
- fast_agent/llm/provider/anthropic/llm_anthropic.py +603 -0
- {mcp_agent/llm/providers → fast_agent/llm/provider/anthropic}/multipart_converter_anthropic.py +79 -86
- fast_agent/llm/provider/bedrock/bedrock_utils.py +218 -0
- fast_agent/llm/provider/bedrock/llm_bedrock.py +2192 -0
- {mcp_agent/llm/providers → fast_agent/llm/provider/google}/google_converter.py +66 -14
- fast_agent/llm/provider/google/llm_google_native.py +431 -0
- mcp_agent/llm/providers/augmented_llm_aliyun.py → fast_agent/llm/provider/openai/llm_aliyun.py +6 -7
- mcp_agent/llm/providers/augmented_llm_azure.py → fast_agent/llm/provider/openai/llm_azure.py +4 -4
- mcp_agent/llm/providers/augmented_llm_deepseek.py → fast_agent/llm/provider/openai/llm_deepseek.py +10 -11
- mcp_agent/llm/providers/augmented_llm_generic.py → fast_agent/llm/provider/openai/llm_generic.py +4 -4
- mcp_agent/llm/providers/augmented_llm_google_oai.py → fast_agent/llm/provider/openai/llm_google_oai.py +4 -4
- mcp_agent/llm/providers/augmented_llm_groq.py → fast_agent/llm/provider/openai/llm_groq.py +14 -16
- mcp_agent/llm/providers/augmented_llm_openai.py → fast_agent/llm/provider/openai/llm_openai.py +133 -206
- mcp_agent/llm/providers/augmented_llm_openrouter.py → fast_agent/llm/provider/openai/llm_openrouter.py +6 -6
- mcp_agent/llm/providers/augmented_llm_tensorzero_openai.py → fast_agent/llm/provider/openai/llm_tensorzero_openai.py +17 -16
- mcp_agent/llm/providers/augmented_llm_xai.py → fast_agent/llm/provider/openai/llm_xai.py +6 -6
- {mcp_agent/llm/providers → fast_agent/llm/provider/openai}/multipart_converter_openai.py +125 -63
- {mcp_agent/llm/providers → fast_agent/llm/provider/openai}/openai_multipart.py +12 -12
- {mcp_agent/llm/providers → fast_agent/llm/provider/openai}/openai_utils.py +18 -16
- {mcp_agent → fast_agent}/llm/provider_key_manager.py +2 -2
- {mcp_agent → fast_agent}/llm/provider_types.py +2 -0
- {mcp_agent → fast_agent}/llm/sampling_converter.py +15 -12
- {mcp_agent → fast_agent}/llm/usage_tracking.py +23 -5
- fast_agent/mcp/__init__.py +43 -0
- {mcp_agent → fast_agent}/mcp/elicitation_factory.py +3 -3
- {mcp_agent → fast_agent}/mcp/elicitation_handlers.py +19 -10
- {mcp_agent → fast_agent}/mcp/gen_client.py +3 -3
- fast_agent/mcp/helpers/__init__.py +36 -0
- fast_agent/mcp/helpers/content_helpers.py +183 -0
- {mcp_agent → fast_agent}/mcp/helpers/server_config_helpers.py +8 -8
- {mcp_agent → fast_agent}/mcp/hf_auth.py +25 -23
- fast_agent/mcp/interfaces.py +93 -0
- {mcp_agent → fast_agent}/mcp/logger_textio.py +4 -4
- {mcp_agent → fast_agent}/mcp/mcp_agent_client_session.py +49 -44
- {mcp_agent → fast_agent}/mcp/mcp_aggregator.py +66 -115
- {mcp_agent → fast_agent}/mcp/mcp_connection_manager.py +16 -23
- {mcp_agent/core → fast_agent/mcp}/mcp_content.py +23 -15
- {mcp_agent → fast_agent}/mcp/mime_utils.py +39 -0
- fast_agent/mcp/prompt.py +159 -0
- mcp_agent/mcp/prompt_message_multipart.py → fast_agent/mcp/prompt_message_extended.py +27 -20
- {mcp_agent → fast_agent}/mcp/prompt_render.py +21 -19
- {mcp_agent → fast_agent}/mcp/prompt_serialization.py +46 -46
- fast_agent/mcp/prompts/__main__.py +7 -0
- {mcp_agent → fast_agent}/mcp/prompts/prompt_helpers.py +31 -30
- {mcp_agent → fast_agent}/mcp/prompts/prompt_load.py +8 -8
- {mcp_agent → fast_agent}/mcp/prompts/prompt_server.py +11 -19
- {mcp_agent → fast_agent}/mcp/prompts/prompt_template.py +18 -18
- {mcp_agent → fast_agent}/mcp/resource_utils.py +1 -1
- {mcp_agent → fast_agent}/mcp/sampling.py +31 -26
- {mcp_agent/mcp_server → fast_agent/mcp/server}/__init__.py +1 -1
- {mcp_agent/mcp_server → fast_agent/mcp/server}/agent_server.py +5 -6
- fast_agent/mcp/ui_agent.py +48 -0
- fast_agent/mcp/ui_mixin.py +209 -0
- fast_agent/mcp_server_registry.py +90 -0
- {mcp_agent → fast_agent}/resources/examples/data-analysis/analysis-campaign.py +5 -4
- {mcp_agent → fast_agent}/resources/examples/data-analysis/analysis.py +1 -1
- {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/elicitation_forms_server.py +25 -3
- {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/forms_demo.py +3 -3
- {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/game_character.py +2 -2
- {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/game_character_handler.py +1 -1
- {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/tool_call.py +1 -1
- {mcp_agent → fast_agent}/resources/examples/mcp/state-transfer/agent_one.py +1 -1
- {mcp_agent → fast_agent}/resources/examples/mcp/state-transfer/agent_two.py +1 -1
- {mcp_agent → fast_agent}/resources/examples/researcher/researcher-eval.py +1 -1
- {mcp_agent → fast_agent}/resources/examples/researcher/researcher-imp.py +1 -1
- {mcp_agent → fast_agent}/resources/examples/researcher/researcher.py +1 -1
- {mcp_agent → fast_agent}/resources/examples/tensorzero/agent.py +2 -2
- {mcp_agent → fast_agent}/resources/examples/tensorzero/image_demo.py +3 -3
- {mcp_agent → fast_agent}/resources/examples/tensorzero/simple_agent.py +1 -1
- {mcp_agent → fast_agent}/resources/examples/workflows/chaining.py +1 -1
- {mcp_agent → fast_agent}/resources/examples/workflows/evaluator.py +3 -3
- {mcp_agent → fast_agent}/resources/examples/workflows/human_input.py +5 -3
- {mcp_agent → fast_agent}/resources/examples/workflows/orchestrator.py +1 -1
- {mcp_agent → fast_agent}/resources/examples/workflows/parallel.py +2 -2
- {mcp_agent → fast_agent}/resources/examples/workflows/router.py +5 -2
- fast_agent/resources/setup/.gitignore +24 -0
- fast_agent/resources/setup/agent.py +18 -0
- fast_agent/resources/setup/fastagent.config.yaml +44 -0
- fast_agent/resources/setup/fastagent.secrets.yaml.example +38 -0
- fast_agent/tools/elicitation.py +369 -0
- fast_agent/types/__init__.py +32 -0
- fast_agent/types/llm_stop_reason.py +77 -0
- fast_agent/ui/__init__.py +38 -0
- fast_agent/ui/console_display.py +1005 -0
- {mcp_agent/human_input → fast_agent/ui}/elicitation_form.py +56 -39
- mcp_agent/human_input/elicitation_forms.py → fast_agent/ui/elicitation_style.py +1 -1
- {mcp_agent/core → fast_agent/ui}/enhanced_prompt.py +96 -25
- {mcp_agent/core → fast_agent/ui}/interactive_prompt.py +330 -125
- fast_agent/ui/mcp_ui_utils.py +224 -0
- {mcp_agent → fast_agent/ui}/progress_display.py +2 -2
- {mcp_agent/logging → fast_agent/ui}/rich_progress.py +4 -4
- {mcp_agent/core → fast_agent/ui}/usage_display.py +3 -8
- {fast_agent_mcp-0.2.57.dist-info → fast_agent_mcp-0.3.0.dist-info}/METADATA +7 -7
- fast_agent_mcp-0.3.0.dist-info/RECORD +202 -0
- fast_agent_mcp-0.3.0.dist-info/entry_points.txt +5 -0
- fast_agent_mcp-0.2.57.dist-info/RECORD +0 -192
- fast_agent_mcp-0.2.57.dist-info/entry_points.txt +0 -6
- mcp_agent/__init__.py +0 -114
- mcp_agent/agents/agent.py +0 -92
- mcp_agent/agents/workflow/__init__.py +0 -1
- mcp_agent/agents/workflow/orchestrator_agent.py +0 -597
- mcp_agent/app.py +0 -175
- mcp_agent/core/__init__.py +0 -26
- mcp_agent/core/prompt.py +0 -191
- mcp_agent/event_progress.py +0 -134
- mcp_agent/human_input/handler.py +0 -81
- mcp_agent/llm/__init__.py +0 -2
- mcp_agent/llm/augmented_llm_passthrough.py +0 -232
- mcp_agent/llm/augmented_llm_slow.py +0 -53
- mcp_agent/llm/providers/__init__.py +0 -8
- mcp_agent/llm/providers/augmented_llm_anthropic.py +0 -717
- mcp_agent/llm/providers/augmented_llm_bedrock.py +0 -1788
- mcp_agent/llm/providers/augmented_llm_google_native.py +0 -495
- mcp_agent/llm/providers/sampling_converter_anthropic.py +0 -57
- mcp_agent/llm/providers/sampling_converter_openai.py +0 -26
- mcp_agent/llm/sampling_format_converter.py +0 -37
- mcp_agent/logging/__init__.py +0 -0
- mcp_agent/mcp/__init__.py +0 -50
- mcp_agent/mcp/helpers/__init__.py +0 -25
- mcp_agent/mcp/helpers/content_helpers.py +0 -187
- mcp_agent/mcp/interfaces.py +0 -266
- mcp_agent/mcp/prompts/__init__.py +0 -0
- mcp_agent/mcp/prompts/__main__.py +0 -10
- mcp_agent/mcp_server_registry.py +0 -343
- mcp_agent/tools/tool_definition.py +0 -14
- mcp_agent/ui/console_display.py +0 -790
- mcp_agent/ui/console_display_legacy.py +0 -401
- {mcp_agent → fast_agent}/agents/workflow/orchestrator_prompts.py +0 -0
- {mcp_agent/agents → fast_agent/cli}/__init__.py +0 -0
- {mcp_agent → fast_agent}/cli/constants.py +0 -0
- {mcp_agent → fast_agent}/core/error_handling.py +0 -0
- {mcp_agent → fast_agent}/core/exceptions.py +0 -0
- {mcp_agent/cli → fast_agent/core/executor}/__init__.py +0 -0
- {mcp_agent → fast_agent/core}/executor/task_registry.py +0 -0
- {mcp_agent → fast_agent/core}/executor/workflow_signal.py +0 -0
- {mcp_agent → fast_agent}/human_input/form_fields.py +0 -0
- {mcp_agent → fast_agent}/llm/prompt_utils.py +0 -0
- {mcp_agent/core → fast_agent/llm}/request_params.py +0 -0
- {mcp_agent → fast_agent}/mcp/common.py +0 -0
- {mcp_agent/executor → fast_agent/mcp/prompts}/__init__.py +0 -0
- {mcp_agent → fast_agent}/mcp/prompts/prompt_constants.py +0 -0
- {mcp_agent → fast_agent}/py.typed +0 -0
- {mcp_agent → fast_agent}/resources/examples/data-analysis/fastagent.config.yaml +0 -0
- {mcp_agent → fast_agent}/resources/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-Attrition.csv +0 -0
- {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/elicitation_account_server.py +0 -0
- {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/elicitation_game_server.py +0 -0
- {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/fastagent.config.yaml +0 -0
- {mcp_agent → fast_agent}/resources/examples/mcp/elicitations/fastagent.secrets.yaml.example +0 -0
- {mcp_agent → fast_agent}/resources/examples/mcp/state-transfer/fastagent.config.yaml +0 -0
- {mcp_agent → fast_agent}/resources/examples/mcp/state-transfer/fastagent.secrets.yaml.example +0 -0
- {mcp_agent → fast_agent}/resources/examples/researcher/fastagent.config.yaml +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/.env.sample +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/Makefile +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/README.md +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/demo_images/clam.jpg +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/demo_images/crab.png +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/demo_images/shrimp.png +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/docker-compose.yml +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/fastagent.config.yaml +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/mcp_server/Dockerfile +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/mcp_server/entrypoint.sh +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/mcp_server/mcp_server.py +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/mcp_server/pyproject.toml +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/tensorzero_config/system_schema.json +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/tensorzero_config/system_template.minijinja +0 -0
- {mcp_agent → fast_agent}/resources/examples/tensorzero/tensorzero_config/tensorzero.toml +0 -0
- {mcp_agent → fast_agent}/resources/examples/workflows/fastagent.config.yaml +0 -0
- {mcp_agent → fast_agent}/resources/examples/workflows/graded_report.md +0 -0
- {mcp_agent → fast_agent}/resources/examples/workflows/short_story.md +0 -0
- {mcp_agent → fast_agent}/resources/examples/workflows/short_story.txt +0 -0
- {mcp_agent → fast_agent/ui}/console.py +0 -0
- {mcp_agent/core → fast_agent/ui}/mermaid_utils.py +0 -0
- {fast_agent_mcp-0.2.57.dist-info → fast_agent_mcp-0.3.0.dist-info}/WHEEL +0 -0
- {fast_agent_mcp-0.2.57.dist-info → fast_agent_mcp-0.3.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -100,11 +100,25 @@ async def product_review() -> ReadResourceResult:
|
|
|
100
100
|
},
|
|
101
101
|
)
|
|
102
102
|
review_text: str = Field(
|
|
103
|
-
description="Tell us about your experience",
|
|
103
|
+
description="Tell us about your experience",
|
|
104
|
+
default="""Great product!
|
|
105
|
+
Here's what I loved:
|
|
106
|
+
|
|
107
|
+
- Excellent build quality
|
|
108
|
+
- Fast shipping
|
|
109
|
+
- Works as advertised
|
|
110
|
+
|
|
111
|
+
One minor issue:
|
|
112
|
+
- Instructions could be clearer
|
|
113
|
+
|
|
114
|
+
Overall, highly recommended!""",
|
|
115
|
+
min_length=10,
|
|
116
|
+
max_length=1000
|
|
104
117
|
)
|
|
105
118
|
|
|
106
119
|
result = await mcp.get_context().elicit(
|
|
107
|
-
"Share your product review - Help others make informed decisions!",
|
|
120
|
+
"Share your product review - Help others make informed decisions!",
|
|
121
|
+
schema=ProductReview,
|
|
108
122
|
)
|
|
109
123
|
|
|
110
124
|
match result:
|
|
@@ -140,6 +154,7 @@ async def account_settings() -> ReadResourceResult:
|
|
|
140
154
|
email_notifications: bool = Field(True, description="Receive email notifications?")
|
|
141
155
|
marketing_emails: bool = Field(False, description="Subscribe to marketing emails?")
|
|
142
156
|
theme: str = Field(
|
|
157
|
+
"dark",
|
|
143
158
|
description="Choose your preferred theme",
|
|
144
159
|
json_schema_extra={
|
|
145
160
|
"enum": ["light", "dark", "auto"],
|
|
@@ -147,7 +162,9 @@ async def account_settings() -> ReadResourceResult:
|
|
|
147
162
|
},
|
|
148
163
|
)
|
|
149
164
|
privacy_public: bool = Field(False, description="Make your profile public?")
|
|
150
|
-
items_per_page: int = Field(
|
|
165
|
+
items_per_page: int = Field(
|
|
166
|
+
25, description="Items to show per page (10-100)", ge=10, le=100
|
|
167
|
+
)
|
|
151
168
|
|
|
152
169
|
result = await mcp.get_context().elicit("Update your account settings", schema=AccountSettings)
|
|
153
170
|
|
|
@@ -182,7 +199,11 @@ async def service_appointment() -> ReadResourceResult:
|
|
|
182
199
|
|
|
183
200
|
class ServiceAppointment(BaseModel):
|
|
184
201
|
customer_name: str = Field(description="Your full name", min_length=2, max_length=50)
|
|
202
|
+
phone_number: str = Field(
|
|
203
|
+
"555-", description="Contact phone number", min_length=10, max_length=20
|
|
204
|
+
)
|
|
185
205
|
vehicle_type: str = Field(
|
|
206
|
+
default="sedan",
|
|
186
207
|
description="What type of vehicle do you have?",
|
|
187
208
|
json_schema_extra={
|
|
188
209
|
"enum": ["sedan", "suv", "truck", "motorcycle", "other"],
|
|
@@ -205,6 +226,7 @@ async def service_appointment() -> ReadResourceResult:
|
|
|
205
226
|
lines = [
|
|
206
227
|
"🔧 Service Appointment Scheduled!",
|
|
207
228
|
f"👤 Customer: {data.customer_name}",
|
|
229
|
+
f"📞 Phone: {data.phone_number}",
|
|
208
230
|
f"🚗 Vehicle: {data.vehicle_type.title()}",
|
|
209
231
|
f"🚙 Loaner needed: {'Yes' if data.needs_loaner else 'No'}",
|
|
210
232
|
f"📅 Appointment: {data.appointment_time}",
|
|
@@ -13,8 +13,8 @@ import asyncio
|
|
|
13
13
|
from rich.console import Console
|
|
14
14
|
from rich.panel import Panel
|
|
15
15
|
|
|
16
|
-
from
|
|
17
|
-
from
|
|
16
|
+
from fast_agent.core.fastagent import FastAgent
|
|
17
|
+
from fast_agent.mcp.helpers.content_helpers import get_resource_text
|
|
18
18
|
|
|
19
19
|
fast = FastAgent("Elicitation Forms Demo", quiet=True)
|
|
20
20
|
console = Console()
|
|
@@ -38,7 +38,7 @@ async def main():
|
|
|
38
38
|
console.print(
|
|
39
39
|
"[dim]Demonstrates: string validation, email format, URL format, date format[/dim]"
|
|
40
40
|
)
|
|
41
|
-
result = await agent.get_resource("elicitation://event-registration")
|
|
41
|
+
result = await agent["forms-demo"].get_resource("elicitation://event-registration")
|
|
42
42
|
|
|
43
43
|
if result_text := get_resource_text(result):
|
|
44
44
|
panel = Panel(
|
|
@@ -14,8 +14,8 @@ from game_character_handler import game_character_elicitation_handler
|
|
|
14
14
|
from rich.console import Console
|
|
15
15
|
from rich.panel import Panel
|
|
16
16
|
|
|
17
|
-
from
|
|
18
|
-
from
|
|
17
|
+
from fast_agent.core.fastagent import FastAgent
|
|
18
|
+
from fast_agent.mcp.helpers.content_helpers import get_resource_text
|
|
19
19
|
|
|
20
20
|
fast = FastAgent("Game Character Creator", quiet=True)
|
|
21
21
|
console = Console()
|
|
@@ -17,7 +17,7 @@ from rich.progress import BarColumn, Progress, TextColumn
|
|
|
17
17
|
from rich.prompt import Confirm
|
|
18
18
|
from rich.table import Table
|
|
19
19
|
|
|
20
|
-
from
|
|
20
|
+
from fast_agent.core.logging.logger import get_logger
|
|
21
21
|
|
|
22
22
|
if TYPE_CHECKING:
|
|
23
23
|
from mcp import ClientSession
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from
|
|
3
|
+
from fast_agent.core.fastagent import FastAgent
|
|
4
|
+
from fast_agent.llm.request_params import RequestParams
|
|
5
5
|
|
|
6
6
|
# Explicitly provide the path to the config file in the current directory
|
|
7
7
|
CONFIG_FILE = "fastagent.config.yaml"
|
|
@@ -6,9 +6,9 @@ from typing import List, Union
|
|
|
6
6
|
|
|
7
7
|
from mcp.types import ImageContent, TextContent
|
|
8
8
|
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
9
|
+
from fast_agent.core.fastagent import FastAgent
|
|
10
|
+
from fast_agent.core.prompt import Prompt
|
|
11
|
+
from fast_agent.llm.request_params import RequestParams
|
|
12
12
|
|
|
13
13
|
AGENT_NAME = "tensorzero_image_tester"
|
|
14
14
|
TENSORZERO_MODEL = "tensorzero.test_chat"
|
|
@@ -4,7 +4,7 @@ This demonstrates creating an optimizer and evaluator to iteratively improve con
|
|
|
4
4
|
|
|
5
5
|
import asyncio
|
|
6
6
|
|
|
7
|
-
from
|
|
7
|
+
from fast_agent.core.fastagent import FastAgent
|
|
8
8
|
|
|
9
9
|
# Create the application
|
|
10
10
|
fast = FastAgent("Evaluator-Optimizer")
|
|
@@ -18,7 +18,7 @@ fast = FastAgent("Evaluator-Optimizer")
|
|
|
18
18
|
candidate details, and company information. Tailor the response to the company and job requirements.
|
|
19
19
|
""",
|
|
20
20
|
servers=["fetch"],
|
|
21
|
-
model="gpt-
|
|
21
|
+
model="gpt-5-nano.low",
|
|
22
22
|
use_history=True,
|
|
23
23
|
)
|
|
24
24
|
# Define evaluator agent
|
|
@@ -40,7 +40,7 @@ fast = FastAgent("Evaluator-Optimizer")
|
|
|
40
40
|
Summarize your evaluation as a structured response with:
|
|
41
41
|
- Overall quality rating.
|
|
42
42
|
- Specific feedback and areas for improvement.""",
|
|
43
|
-
model="
|
|
43
|
+
model="o3-mini.medium",
|
|
44
44
|
)
|
|
45
45
|
# Define the evaluator-optimizer workflow
|
|
46
46
|
@fast.evaluator_optimizer(
|
|
@@ -4,7 +4,7 @@ Agent which demonstrates Human Input tool
|
|
|
4
4
|
|
|
5
5
|
import asyncio
|
|
6
6
|
|
|
7
|
-
from
|
|
7
|
+
from fast_agent.core.fastagent import FastAgent
|
|
8
8
|
|
|
9
9
|
# Create the application
|
|
10
10
|
fast = FastAgent("Human Input")
|
|
@@ -12,14 +12,16 @@ fast = FastAgent("Human Input")
|
|
|
12
12
|
|
|
13
13
|
# Define the agent
|
|
14
14
|
@fast.agent(
|
|
15
|
-
instruction="An AI agent that assists with basic tasks. Request Human Input when needed
|
|
15
|
+
instruction="An AI agent that assists with basic tasks. Request Human Input when needed - for example"
|
|
16
|
+
"if being asked to predict a number sequence or pretending to take pizza orders.",
|
|
16
17
|
human_input=True,
|
|
17
18
|
)
|
|
18
19
|
async def main() -> None:
|
|
19
20
|
async with fast.run() as agent:
|
|
20
21
|
# this usually causes the LLM to request the Human Input Tool
|
|
21
22
|
await agent("print the next number in the sequence")
|
|
22
|
-
await agent
|
|
23
|
+
await agent("pretend to be a pizza restaurant and take the users order")
|
|
24
|
+
await agent.interactive(default_prompt="STOP")
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
if __name__ == "__main__":
|
|
@@ -4,7 +4,7 @@ This demonstrates creating multiple agents and an orchestrator to coordinate the
|
|
|
4
4
|
|
|
5
5
|
import asyncio
|
|
6
6
|
|
|
7
|
-
from
|
|
7
|
+
from fast_agent.core.fastagent import FastAgent
|
|
8
8
|
|
|
9
9
|
# Create the application
|
|
10
10
|
fast = FastAgent("Orchestrator-Workers")
|
|
@@ -5,8 +5,8 @@ Parallel Workflow showing Fan Out and Fan In agents, using different models
|
|
|
5
5
|
import asyncio
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
|
|
8
|
-
from
|
|
9
|
-
from
|
|
8
|
+
from fast_agent.core.fastagent import FastAgent
|
|
9
|
+
from fast_agent.core.prompt import Prompt
|
|
10
10
|
|
|
11
11
|
# Create the application
|
|
12
12
|
fast = FastAgent(
|
|
@@ -9,7 +9,7 @@ import asyncio
|
|
|
9
9
|
|
|
10
10
|
from rich.console import Console
|
|
11
11
|
|
|
12
|
-
from
|
|
12
|
+
from fast_agent.core.fastagent import FastAgent
|
|
13
13
|
|
|
14
14
|
# Create the application
|
|
15
15
|
fast = FastAgent(
|
|
@@ -26,11 +26,13 @@ SAMPLE_REQUESTS = [
|
|
|
26
26
|
|
|
27
27
|
@fast.agent(
|
|
28
28
|
name="fetcher",
|
|
29
|
+
model="haiku",
|
|
29
30
|
instruction="""You are an agent, with a tool enabling you to fetch URLs.""",
|
|
30
31
|
servers=["fetch"],
|
|
31
32
|
)
|
|
32
33
|
@fast.agent(
|
|
33
34
|
name="code_expert",
|
|
35
|
+
model="haiku",
|
|
34
36
|
instruction="""You are an expert in code analysis and software engineering.
|
|
35
37
|
When asked about code, architecture, or development practices,
|
|
36
38
|
you provide thorough and practical insights.""",
|
|
@@ -38,12 +40,13 @@ SAMPLE_REQUESTS = [
|
|
|
38
40
|
)
|
|
39
41
|
@fast.agent(
|
|
40
42
|
name="general_assistant",
|
|
43
|
+
model="haiku",
|
|
41
44
|
instruction="""You are a knowledgeable assistant that provides clear,
|
|
42
45
|
well-reasoned responses about general topics, concepts, and principles.""",
|
|
43
46
|
)
|
|
44
47
|
@fast.router(
|
|
45
48
|
name="route",
|
|
46
|
-
model="
|
|
49
|
+
model="sonnet",
|
|
47
50
|
agents=["code_expert", "general_assistant", "fetcher"],
|
|
48
51
|
)
|
|
49
52
|
async def main() -> None:
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Secrets
|
|
2
|
+
fastagent.secrets.yaml
|
|
3
|
+
|
|
4
|
+
# Python cache/bytecode
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
|
|
8
|
+
# Local env and virtualenvs
|
|
9
|
+
.env
|
|
10
|
+
.venv/
|
|
11
|
+
venv/
|
|
12
|
+
env/
|
|
13
|
+
|
|
14
|
+
# OS cruft
|
|
15
|
+
.DS_Store
|
|
16
|
+
Thumbs.db
|
|
17
|
+
|
|
18
|
+
# Logs/artifacts
|
|
19
|
+
fastagent.jsonl
|
|
20
|
+
*.jsonl
|
|
21
|
+
|
|
22
|
+
# Editors (optional)
|
|
23
|
+
.idea/
|
|
24
|
+
.vscode/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
|
|
3
|
+
from fast_agent.core.fastagent import FastAgent
|
|
4
|
+
|
|
5
|
+
# Create the application
|
|
6
|
+
fast = FastAgent("fast-agent example")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Define the agent
|
|
10
|
+
@fast.agent(instruction="You are a helpful AI Agent")
|
|
11
|
+
async def main():
|
|
12
|
+
# use the --model command line switch or agent arguments to change model
|
|
13
|
+
async with fast.run() as agent:
|
|
14
|
+
await agent.interactive()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
if __name__ == "__main__":
|
|
18
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# FastAgent Configuration File
|
|
2
|
+
|
|
3
|
+
# Default Model Configuration:
|
|
4
|
+
#
|
|
5
|
+
# Takes format:
|
|
6
|
+
# <provider>.<model_string>.<reasoning_effort?> (e.g. anthropic.claude-3-5-sonnet-20241022 or openai.o3-mini.low)
|
|
7
|
+
# Accepts aliases for Anthropic Models: haiku, haiku3, sonnet, sonnet35, opus, opus3
|
|
8
|
+
# and OpenAI Models: gpt-4.1, gpt-4.1-mini, o1, o1-mini, o3-mini
|
|
9
|
+
#
|
|
10
|
+
# If not specified, defaults to "haiku".
|
|
11
|
+
# Can be overriden with a command line switch --model=<model>, or within the Agent constructor.
|
|
12
|
+
|
|
13
|
+
default_model: haiku
|
|
14
|
+
# mcp-ui support: disabled, enabled or auto. "auto" opens the web browser on the asset automatically
|
|
15
|
+
# mcp_ui_mode: enabled
|
|
16
|
+
|
|
17
|
+
# Logging and Console Configuration:
|
|
18
|
+
logger:
|
|
19
|
+
# level: "debug" | "info" | "warning" | "error"
|
|
20
|
+
# type: "none" | "console" | "file" | "http"
|
|
21
|
+
# path: "/path/to/logfile.jsonl"
|
|
22
|
+
|
|
23
|
+
# Switch the progress display on or off
|
|
24
|
+
progress_display: true
|
|
25
|
+
|
|
26
|
+
# Show chat User/Assistant messages on the console
|
|
27
|
+
show_chat: true
|
|
28
|
+
# Show tool calls on the console
|
|
29
|
+
show_tools: true
|
|
30
|
+
# Truncate long tool responses on the console
|
|
31
|
+
truncate_tools: true
|
|
32
|
+
|
|
33
|
+
# MCP Servers
|
|
34
|
+
mcp:
|
|
35
|
+
servers:
|
|
36
|
+
fetch:
|
|
37
|
+
command: "uvx"
|
|
38
|
+
args: ["mcp-server-fetch"]
|
|
39
|
+
filesystem:
|
|
40
|
+
command: "npx"
|
|
41
|
+
args: ["-y", "@modelcontextprotocol/server-filesystem", "."]
|
|
42
|
+
huggingface:
|
|
43
|
+
transport: "http"
|
|
44
|
+
url: "https://huggingface.co/mcp"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# FastAgent Secrets Configuration
|
|
2
|
+
# WARNING: Keep this file secure and never commit to version control
|
|
3
|
+
|
|
4
|
+
# Alternatively set OPENAI_API_KEY, ANTHROPIC_API_KEY or other environment variables.
|
|
5
|
+
# Keys in the configuration file override environment variables.
|
|
6
|
+
|
|
7
|
+
openai:
|
|
8
|
+
api_key: <your-api-key-here>
|
|
9
|
+
anthropic:
|
|
10
|
+
api_key: <your-api-key-here>
|
|
11
|
+
deepseek:
|
|
12
|
+
api_key: <your-api-key-here>
|
|
13
|
+
openrouter:
|
|
14
|
+
api_key: <your-api-key-here>
|
|
15
|
+
deepseek:
|
|
16
|
+
api_key: <your-api-key-here>
|
|
17
|
+
google:
|
|
18
|
+
api_key: <your-api-key-here>
|
|
19
|
+
googleoai:
|
|
20
|
+
api_key: <your-api-key-here>
|
|
21
|
+
azure:
|
|
22
|
+
api_key: <your-api-key-here>
|
|
23
|
+
base_url: "https://...resource_name....openai.azure.com/" # Resource name (do NOT include if using base_url)
|
|
24
|
+
azure_deployment: "gpt-4.1" # Required - the model deployment name
|
|
25
|
+
# api_version: "2024-10-21"
|
|
26
|
+
xai:
|
|
27
|
+
api_key: <your-api-key-here>
|
|
28
|
+
hf:
|
|
29
|
+
api_key: <your-HF_TOKEN-here>
|
|
30
|
+
groq:
|
|
31
|
+
api_key: <your-api-key-here>
|
|
32
|
+
|
|
33
|
+
# Example of setting an MCP Server environment variable
|
|
34
|
+
mcp:
|
|
35
|
+
servers:
|
|
36
|
+
brave:
|
|
37
|
+
env:
|
|
38
|
+
BRAVE_API_KEY: <your-api-key-here>
|