fast-agent-mcp 0.1.13__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/.gitignore +2 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/PKG-INFO +3 -4
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/data-analysis/analysis-campaign.py +1 -1
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/data-analysis/analysis.py +1 -1
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/researcher/researcher-eval.py +1 -1
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/researcher/researcher-imp.py +1 -1
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/researcher/researcher.py +0 -3
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/workflows/chaining.py +1 -10
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/workflows/evaluator.py +0 -2
- fast_agent_mcp-0.2.0/examples/workflows/graded_report.md +89 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/workflows/human_input.py +1 -1
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/workflows/orchestrator.py +3 -8
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/workflows/parallel.py +6 -27
- fast_agent_mcp-0.2.0/examples/workflows/short_story.md +13 -0
- fast_agent_mcp-0.2.0/examples/workflows/short_story.txt +19 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/pyproject.toml +13 -18
- fast_agent_mcp-0.2.0/src/mcp_agent/__init__.py +75 -0
- fast_agent_mcp-0.2.0/src/mcp_agent/agents/agent.py +96 -0
- fast_agent_mcp-0.1.13/src/mcp_agent/agents/agent.py → fast_agent_mcp-0.2.0/src/mcp_agent/agents/base_agent.py +224 -110
- fast_agent_mcp-0.2.0/src/mcp_agent/agents/workflow/__init__.py +1 -0
- fast_agent_mcp-0.2.0/src/mcp_agent/agents/workflow/chain_agent.py +173 -0
- fast_agent_mcp-0.2.0/src/mcp_agent/agents/workflow/evaluator_optimizer.py +362 -0
- fast_agent_mcp-0.2.0/src/mcp_agent/agents/workflow/orchestrator_agent.py +591 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows/orchestrator → fast_agent_mcp-0.2.0/src/mcp_agent/agents/workflow}/orchestrator_models.py +27 -11
- fast_agent_mcp-0.2.0/src/mcp_agent/agents/workflow/parallel_agent.py +182 -0
- fast_agent_mcp-0.2.0/src/mcp_agent/agents/workflow/router_agent.py +307 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/app.py +3 -1
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/cli/commands/bootstrap.py +18 -7
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/cli/commands/setup.py +12 -4
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/cli/main.py +1 -1
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/cli/terminal.py +1 -1
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/config.py +24 -35
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/context.py +3 -1
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/context_dependent.py +3 -1
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/core/agent_types.py +10 -7
- fast_agent_mcp-0.2.0/src/mcp_agent/core/direct_agent_app.py +179 -0
- fast_agent_mcp-0.2.0/src/mcp_agent/core/direct_decorators.py +443 -0
- fast_agent_mcp-0.2.0/src/mcp_agent/core/direct_factory.py +476 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/core/enhanced_prompt.py +15 -20
- fast_agent_mcp-0.2.0/src/mcp_agent/core/fastagent.py +343 -0
- fast_agent_mcp-0.2.0/src/mcp_agent/core/interactive_prompt.py +424 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/core/mcp_content.py +19 -11
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/core/prompt.py +6 -2
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/core/validation.py +89 -16
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/executor/decorator_registry.py +6 -2
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/executor/temporal.py +35 -11
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/executor/workflow_signal.py +8 -2
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/human_input/handler.py +3 -1
- fast_agent_mcp-0.2.0/src/mcp_agent/llm/__init__.py +2 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows → fast_agent_mcp-0.2.0/src/mcp_agent}/llm/augmented_llm.py +131 -256
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows → fast_agent_mcp-0.2.0/src/mcp_agent}/llm/augmented_llm_passthrough.py +35 -107
- fast_agent_mcp-0.2.0/src/mcp_agent/llm/augmented_llm_playback.py +83 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows → fast_agent_mcp-0.2.0/src/mcp_agent}/llm/model_factory.py +26 -8
- fast_agent_mcp-0.2.0/src/mcp_agent/llm/providers/__init__.py +8 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows/llm → fast_agent_mcp-0.2.0/src/mcp_agent/llm/providers}/anthropic_utils.py +5 -1
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows/llm → fast_agent_mcp-0.2.0/src/mcp_agent/llm/providers}/augmented_llm_anthropic.py +37 -141
- fast_agent_mcp-0.2.0/src/mcp_agent/llm/providers/augmented_llm_deepseek.py +53 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows/llm → fast_agent_mcp-0.2.0/src/mcp_agent/llm/providers}/augmented_llm_openai.py +112 -148
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows → fast_agent_mcp-0.2.0/src/mcp_agent}/llm/providers/multipart_converter_anthropic.py +78 -35
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows → fast_agent_mcp-0.2.0/src/mcp_agent}/llm/providers/multipart_converter_openai.py +73 -44
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows → fast_agent_mcp-0.2.0/src/mcp_agent}/llm/providers/openai_multipart.py +18 -4
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows/llm → fast_agent_mcp-0.2.0/src/mcp_agent/llm/providers}/openai_utils.py +3 -3
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows → fast_agent_mcp-0.2.0/src/mcp_agent}/llm/providers/sampling_converter_anthropic.py +3 -3
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows → fast_agent_mcp-0.2.0/src/mcp_agent}/llm/providers/sampling_converter_openai.py +3 -3
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows → fast_agent_mcp-0.2.0/src/mcp_agent}/llm/sampling_converter.py +0 -21
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows → fast_agent_mcp-0.2.0/src/mcp_agent}/llm/sampling_format_converter.py +16 -1
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/logging/logger.py +2 -2
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/gen_client.py +9 -3
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/interfaces.py +67 -45
- fast_agent_mcp-0.2.0/src/mcp_agent/mcp/logger_textio.py +97 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/mcp_agent_client_session.py +12 -4
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/mcp_agent_server.py +3 -1
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/mcp_aggregator.py +124 -93
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/mcp_connection_manager.py +21 -7
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/prompt_message_multipart.py +59 -1
- fast_agent_mcp-0.2.0/src/mcp_agent/mcp/prompt_render.py +77 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/prompt_serialization.py +20 -13
- fast_agent_mcp-0.2.0/src/mcp_agent/mcp/prompts/prompt_constants.py +18 -0
- fast_agent_mcp-0.2.0/src/mcp_agent/mcp/prompts/prompt_helpers.py +327 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/prompts/prompt_load.py +15 -5
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/prompts/prompt_server.py +154 -87
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/prompts/prompt_template.py +26 -35
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/resource_utils.py +3 -1
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/sampling.py +24 -15
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp_server/agent_server.py +8 -5
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp_server_registry.py +22 -9
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources/examples/workflows → fast_agent_mcp-0.2.0/src/mcp_agent/resources/examples/in_dev}/agent_build.py +1 -1
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources/examples/data-analysis → fast_agent_mcp-0.2.0/src/mcp_agent/resources/examples/in_dev}/slides.py +1 -1
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/resources/examples/internal/agent.py +4 -2
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/resources/examples/internal/fastagent.config.yaml +8 -2
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/resources/examples/prompting/image_server.py +3 -1
- fast_agent_mcp-0.2.0/src/mcp_agent/resources/examples/prompting/work_with_image.py +19 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/ui/console_display.py +27 -7
- fast_agent_mcp-0.1.13/src/mcp_agent/core/agent_app.py +0 -570
- fast_agent_mcp-0.1.13/src/mcp_agent/core/agent_utils.py +0 -69
- fast_agent_mcp-0.1.13/src/mcp_agent/core/decorators.py +0 -448
- fast_agent_mcp-0.1.13/src/mcp_agent/core/factory.py +0 -422
- fast_agent_mcp-0.1.13/src/mcp_agent/core/fastagent.py +0 -529
- fast_agent_mcp-0.1.13/src/mcp_agent/core/proxies.py +0 -278
- fast_agent_mcp-0.1.13/src/mcp_agent/core/types.py +0 -22
- fast_agent_mcp-0.1.13/src/mcp_agent/mcp/__init__.py +0 -0
- fast_agent_mcp-0.1.13/src/mcp_agent/mcp/prompts/__init__.py +0 -0
- fast_agent_mcp-0.1.13/src/mcp_agent/mcp/stdio.py +0 -114
- fast_agent_mcp-0.1.13/src/mcp_agent/resources/examples/mcp_researcher/researcher-eval.py +0 -53
- fast_agent_mcp-0.1.13/src/mcp_agent/resources/examples/workflows/sse.py +0 -23
- fast_agent_mcp-0.1.13/src/mcp_agent/telemetry/__init__.py +0 -0
- fast_agent_mcp-0.1.13/src/mcp_agent/telemetry/usage_tracking.py +0 -19
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/__init__.py +0 -0
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/embedding/__init__.py +0 -0
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/embedding/embedding_base.py +0 -58
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/embedding/embedding_cohere.py +0 -49
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/embedding/embedding_openai.py +0 -37
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/evaluator_optimizer/__init__.py +0 -0
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/evaluator_optimizer/evaluator_optimizer.py +0 -447
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/intent_classifier/__init__.py +0 -0
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/intent_classifier/intent_classifier_base.py +0 -117
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/intent_classifier/intent_classifier_embedding.py +0 -130
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/intent_classifier/intent_classifier_embedding_cohere.py +0 -41
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/intent_classifier/intent_classifier_embedding_openai.py +0 -41
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/intent_classifier/intent_classifier_llm.py +0 -150
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/intent_classifier/intent_classifier_llm_anthropic.py +0 -60
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/intent_classifier/intent_classifier_llm_openai.py +0 -58
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/llm/__init__.py +0 -0
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/llm/augmented_llm_playback.py +0 -111
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/llm/providers/__init__.py +0 -8
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/orchestrator/__init__.py +0 -0
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/orchestrator/orchestrator.py +0 -535
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/parallel/__init__.py +0 -0
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/parallel/fan_in.py +0 -320
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/parallel/fan_out.py +0 -181
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/parallel/parallel_llm.py +0 -149
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/router/__init__.py +0 -0
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/router/router_base.py +0 -338
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/router/router_embedding.py +0 -226
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/router/router_embedding_cohere.py +0 -59
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/router/router_embedding_openai.py +0 -59
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/router/router_llm.py +0 -304
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/swarm/__init__.py +0 -0
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/swarm/swarm.py +0 -292
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/swarm/swarm_anthropic.py +0 -42
- fast_agent_mcp-0.1.13/src/mcp_agent/workflows/swarm/swarm_openai.py +0 -41
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/LICENSE +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/README.md +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/data-analysis/fastagent.config.yaml +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-Attrition.csv +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/researcher/fastagent.config.yaml +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/workflows/fastagent.config.yaml +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/resources → fast_agent_mcp-0.2.0}/examples/workflows/router.py +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent → fast_agent_mcp-0.2.0/src/mcp_agent/agents}/__init__.py +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows/orchestrator → fast_agent_mcp-0.2.0/src/mcp_agent/agents/workflow}/orchestrator_prompts.py +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/agents → fast_agent_mcp-0.2.0/src/mcp_agent/cli}/__init__.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/cli/__main__.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/cli/commands/config.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/console.py +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/cli → fast_agent_mcp-0.2.0/src/mcp_agent/core}/__init__.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/core/error_handling.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/core/exceptions.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/core/request_params.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/event_progress.py +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/core → fast_agent_mcp-0.2.0/src/mcp_agent/executor}/__init__.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/executor/executor.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/executor/task_registry.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/executor/workflow.py +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/eval → fast_agent_mcp-0.2.0/src/mcp_agent/human_input}/__init__.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/human_input/types.py +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows → fast_agent_mcp-0.2.0/src/mcp_agent}/llm/memory.py +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/workflows → fast_agent_mcp-0.2.0/src/mcp_agent}/llm/prompt_utils.py +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/executor → fast_agent_mcp-0.2.0/src/mcp_agent/logging}/__init__.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/logging/events.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/logging/json_serializer.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/logging/listeners.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/logging/rich_progress.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/logging/tracing.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/logging/transport.py +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/human_input → fast_agent_mcp-0.2.0/src/mcp_agent/mcp}/__init__.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/mcp_activity.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/mime_utils.py +0 -0
- {fast_agent_mcp-0.1.13/src/mcp_agent/logging → fast_agent_mcp-0.2.0/src/mcp_agent/mcp/prompts}/__init__.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp/prompts/__main__.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/mcp_server/__init__.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/progress_display.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/resources/examples/internal/job.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/resources/examples/internal/prompt_category.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/resources/examples/internal/prompt_sizing.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/resources/examples/internal/sizer.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/resources/examples/internal/social.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/resources/examples/prompting/__init__.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/resources/examples/prompting/agent.py +0 -0
- {fast_agent_mcp-0.1.13 → fast_agent_mcp-0.2.0}/src/mcp_agent/resources/examples/prompting/fastagent.config.yaml +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fast-agent-mcp
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0
|
4
4
|
Summary: Define, Prompt and Test MCP enabled Agents and Workflows
|
5
5
|
Author-email: Shaun Smith <fastagent@llmindset.co.uk>, Sarmad Qadri <sarmad@lastmileai.dev>
|
6
6
|
License: Apache License
|
@@ -212,7 +212,7 @@ Requires-Python: >=3.10
|
|
212
212
|
Requires-Dist: aiohttp>=3.11.13
|
213
213
|
Requires-Dist: anthropic>=0.49.0
|
214
214
|
Requires-Dist: fastapi>=0.115.6
|
215
|
-
Requires-Dist: mcp
|
215
|
+
Requires-Dist: mcp==1.6.0
|
216
216
|
Requires-Dist: numpy>=2.2.1
|
217
217
|
Requires-Dist: openai>=1.63.2
|
218
218
|
Requires-Dist: opentelemetry-distro>=0.50b0
|
@@ -224,13 +224,12 @@ Requires-Dist: pyyaml>=6.0.2
|
|
224
224
|
Requires-Dist: rich>=13.9.4
|
225
225
|
Requires-Dist: scikit-learn>=1.6.0
|
226
226
|
Requires-Dist: typer>=0.15.1
|
227
|
-
Provides-Extra: cohere
|
228
|
-
Requires-Dist: cohere>=5.13.4; extra == 'cohere'
|
229
227
|
Provides-Extra: dev
|
230
228
|
Requires-Dist: anthropic>=0.42.0; extra == 'dev'
|
231
229
|
Requires-Dist: pre-commit>=4.0.1; extra == 'dev'
|
232
230
|
Requires-Dist: pydantic>=2.10.4; extra == 'dev'
|
233
231
|
Requires-Dist: pytest-asyncio>=0.21.1; extra == 'dev'
|
232
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
234
233
|
Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
235
234
|
Requires-Dist: pyyaml>=6.0.2; extra == 'dev'
|
236
235
|
Requires-Dist: ruff>=0.8.4; extra == 'dev'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import asyncio
|
2
2
|
|
3
3
|
from mcp_agent.core.fastagent import FastAgent
|
4
|
-
from mcp_agent.
|
4
|
+
from mcp_agent.llm.augmented_llm import RequestParams
|
5
5
|
|
6
6
|
# Create the application
|
7
7
|
fast = FastAgent("Data Analysis & Campaign Generator")
|
@@ -46,7 +46,7 @@ async def main() -> None:
|
|
46
46
|
await agent.prompt("Researcher_Evaluator")
|
47
47
|
|
48
48
|
print("Ask follow up quesions to the Researcher?")
|
49
|
-
await agent.prompt("Researcher",
|
49
|
+
await agent.prompt("Researcher", default_prompt="STOP")
|
50
50
|
|
51
51
|
|
52
52
|
if __name__ == "__main__":
|
@@ -182,7 +182,7 @@ async def main() -> None:
|
|
182
182
|
await agent.prompt("EnhancedResearcher")
|
183
183
|
|
184
184
|
print("\nWould you like to ask follow-up questions to the Researcher? (Type 'STOP' to end)")
|
185
|
-
await agent.prompt("Researcher",
|
185
|
+
await agent.prompt("Researcher", default_prompt="STOP")
|
186
186
|
|
187
187
|
|
188
188
|
if __name__ == "__main__":
|
@@ -31,9 +31,6 @@ Todays date is 15 February 2025. Include the main data sources consulted in pres
|
|
31
31
|
async with agents.run() as agent:
|
32
32
|
await agent.prompt()
|
33
33
|
|
34
|
-
# await agent.prompt(default="STOP")
|
35
|
-
# await agent.prompt(default=research_prompt)
|
36
|
-
|
37
34
|
|
38
35
|
if __name__ == "__main__":
|
39
36
|
asyncio.run(main())
|
@@ -25,16 +25,7 @@ fast = FastAgent("Agent Chaining")
|
|
25
25
|
async def main() -> None:
|
26
26
|
async with fast.run() as agent:
|
27
27
|
# using chain workflow
|
28
|
-
await agent.post_writer.
|
29
|
-
|
30
|
-
# calling directly
|
31
|
-
# await agent.url_fetcher("http://llmindset.co.uk/resources/mcp-hfspace/")
|
32
|
-
# await agent.social_media(
|
33
|
-
# await agent.url_fetcher("http://llmindset.co.uk/resources/mcp-hfspace/")
|
34
|
-
# )
|
35
|
-
|
36
|
-
# agents can also be accessed like dictionaries:
|
37
|
-
# awwait agent["post_writer"].prompt()
|
28
|
+
await agent.post_writer.send("https://llmindset.co.uk")
|
38
29
|
|
39
30
|
|
40
31
|
# alternative syntax for above is result = agent["post_writer"].send(message)
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# Graded Report: "The Kittens Castle Adventure"
|
2
|
+
|
3
|
+
## Proofreading Feedback
|
4
|
+
|
5
|
+
### Spelling Errors
|
6
|
+
1. "Adventuer" → "Adventure"
|
7
|
+
2. "lil" → "little"
|
8
|
+
3. "name" → "named"
|
9
|
+
4. "threw" → "through"
|
10
|
+
5. "mystirus" → "mysterious"
|
11
|
+
6. "forrest" → "forest"
|
12
|
+
7. "was" → "were"
|
13
|
+
8. "an" → "and"
|
14
|
+
9. "Suddenlee" → "Suddenly"
|
15
|
+
10. "sawd" → "saw"
|
16
|
+
11. "somthing" → "something"
|
17
|
+
12. "chese" → "cheese"
|
18
|
+
13. "windos" → "windows"
|
19
|
+
14. "turrits" → "turrets"
|
20
|
+
15. "tuch" → "touch"
|
21
|
+
16. "clowds" → "clouds"
|
22
|
+
17. "doars" → "doors"
|
23
|
+
18. "enuff" → "enough"
|
24
|
+
19. "elefant" → "elephant"
|
25
|
+
20. "sed" → "said"
|
26
|
+
21. "tale" → "tail"
|
27
|
+
22. "poofy" → "puffy"
|
28
|
+
23. "fowned" → "found"
|
29
|
+
24. "meowed" → added missing period
|
30
|
+
25. "smallist" → "smallest"
|
31
|
+
26. "rond" → "round"
|
32
|
+
27. "climed" → "climbed"
|
33
|
+
28. "slip-slidin" → "slip-sliding"
|
34
|
+
29. "smoth" → "smooth"
|
35
|
+
30. "surfase" → "surface"
|
36
|
+
31. "ful" → "full"
|
37
|
+
32. "dangling" → added missing period
|
38
|
+
33. "JINGEL" → "jingle"
|
39
|
+
34. "paradyse" → "paradise"
|
40
|
+
35. "figur" → "figure"
|
41
|
+
36. "gaurd" → "guard"
|
42
|
+
37. "sumthing" → "something"
|
43
|
+
38. "mor" → "more"
|
44
|
+
39. "hudeld" → "huddled"
|
45
|
+
40. "togethar" → "together"
|
46
|
+
41. "there" → "their"
|
47
|
+
42. "happan" → "happen"
|
48
|
+
43. "amazeing" → "amazing"
|
49
|
+
|
50
|
+
### Grammar and Syntax Errors
|
51
|
+
1. Inconsistent verb tenses throughout the story
|
52
|
+
2. Improper use of articles (a/an)
|
53
|
+
3. Missing punctuation
|
54
|
+
4. Lack of subject-verb agreement
|
55
|
+
5. Incorrect capitalization
|
56
|
+
|
57
|
+
### Style and Formatting Recommendations
|
58
|
+
1. Use standard capitalization for proper nouns
|
59
|
+
2. Maintain consistent verb tense (past tense recommended)
|
60
|
+
3. Use proper punctuation
|
61
|
+
4. Avoid excessive use of exclamation points
|
62
|
+
5. Use standard spelling for all words
|
63
|
+
|
64
|
+
## Factuality and Logical Consistency
|
65
|
+
- The story is a fictional narrative about three kittens, so traditional factual constraints do not strictly apply
|
66
|
+
- The narrative maintains internal logical consistency
|
67
|
+
- The cliffhanger ending leaves room for imagination
|
68
|
+
|
69
|
+
## Style Adherence
|
70
|
+
### APA Formatting Guidelines
|
71
|
+
- Title should be centered and in title case
|
72
|
+
- Use 12-point Times New Roman font (not applicable in markdown)
|
73
|
+
- Double-spacing recommended (not applicable in markdown)
|
74
|
+
- 1-inch margins (not applicable in markdown)
|
75
|
+
|
76
|
+
### Recommendations for Improvement
|
77
|
+
1. Proofread and correct all spelling errors
|
78
|
+
2. Maintain consistent grammar and syntax
|
79
|
+
3. Use standard English spelling
|
80
|
+
4. Add more descriptive language
|
81
|
+
5. Develop a more structured narrative arc
|
82
|
+
|
83
|
+
## Overall Assessment
|
84
|
+
**Writing Quality**: Needs Significant Improvement
|
85
|
+
**Creativity**: Excellent
|
86
|
+
**Potential**: High
|
87
|
+
|
88
|
+
### Suggested Revision
|
89
|
+
Revise the text to correct spelling, grammar, and syntax while preserving the original creative narrative and imaginative elements.
|
@@ -19,7 +19,7 @@ async def main() -> None:
|
|
19
19
|
async with fast.run() as agent:
|
20
20
|
# this usually causes the LLM to request the Human Input Tool
|
21
21
|
await agent("print the next number in the sequence")
|
22
|
-
await agent.prompt(
|
22
|
+
await agent.prompt(default_prompt="STOP")
|
23
23
|
|
24
24
|
|
25
25
|
if __name__ == "__main__":
|
@@ -46,28 +46,23 @@ fast = FastAgent("Orchestrator-Workers")
|
|
46
46
|
@fast.orchestrator(
|
47
47
|
name="orchestrate",
|
48
48
|
agents=["finder", "writer", "proofreader"],
|
49
|
-
plan_type="
|
49
|
+
plan_type="full",
|
50
50
|
)
|
51
51
|
async def main() -> None:
|
52
52
|
async with fast.run() as agent:
|
53
|
-
await agent()
|
54
53
|
await agent.author(
|
55
54
|
"write a 250 word short story about kittens discovering a castle, and save it to short_story.md"
|
56
55
|
)
|
57
56
|
|
58
57
|
# The orchestrator can be used just like any other agent
|
59
|
-
task =
|
60
|
-
"""Load the student's short story from short_story.md,
|
58
|
+
task = """Load the student's short story from short_story.md,
|
61
59
|
and generate a report with feedback across proofreading,
|
62
60
|
factuality/logical consistency and style adherence. Use the style rules from
|
63
61
|
https://apastyle.apa.org/learn/quick-guide-on-formatting and
|
64
62
|
https://apastyle.apa.org/learn/quick-guide-on-references.
|
65
|
-
Write the graded report to graded_report.md in the same directory as short_story.md"""
|
66
|
-
)
|
63
|
+
Write the graded report to graded_report.md in the same directory as short_story.md"""
|
67
64
|
|
68
|
-
# Send the task
|
69
65
|
await agent.orchestrate(task)
|
70
|
-
await agent()
|
71
66
|
|
72
67
|
|
73
68
|
if __name__ == "__main__":
|
@@ -3,34 +3,15 @@ Parallel Workflow showing Fan Out and Fan In agents, using different models
|
|
3
3
|
"""
|
4
4
|
|
5
5
|
import asyncio
|
6
|
+
from pathlib import Path
|
6
7
|
|
7
8
|
from mcp_agent.core.fastagent import FastAgent
|
9
|
+
from mcp_agent.core.prompt import Prompt
|
8
10
|
|
9
11
|
# Create the application
|
10
12
|
fast = FastAgent(
|
11
13
|
"Parallel Workflow",
|
12
14
|
)
|
13
|
-
SHORT_STORY = """
|
14
|
-
The Battle of Glimmerwood
|
15
|
-
|
16
|
-
In the heart of Glimmerwood, a mystical forest knowed for its radiant trees, a small village thrived.
|
17
|
-
The villagers, who were live peacefully, shared their home with the forest's magical creatures,
|
18
|
-
especially the Glimmerfoxes whose fur shimmer like moonlight.
|
19
|
-
|
20
|
-
One fateful evening, the peace was shaterred when the infamous Dark Marauders attack.
|
21
|
-
Lead by the cunning Captain Thorn, the bandits aim to steal the precious Glimmerstones which was believed to grant immortality.
|
22
|
-
|
23
|
-
Amidst the choas, a young girl named Elara stood her ground, she rallied the villagers and devised a clever plan.
|
24
|
-
Using the forests natural defenses they lured the marauders into a trap.
|
25
|
-
As the bandits aproached the village square, a herd of Glimmerfoxes emerged, blinding them with their dazzling light,
|
26
|
-
the villagers seized the opportunity to captured the invaders.
|
27
|
-
|
28
|
-
Elara's bravery was celebrated and she was hailed as the "Guardian of Glimmerwood".
|
29
|
-
The Glimmerstones were secured in a hidden grove protected by an ancient spell.
|
30
|
-
|
31
|
-
However, not all was as it seemed. The Glimmerstones true power was never confirm,
|
32
|
-
and whispers of a hidden agenda linger among the villagers.
|
33
|
-
"""
|
34
15
|
|
35
16
|
|
36
17
|
@fast.agent(
|
@@ -67,13 +48,11 @@ and whispers of a hidden agenda linger among the villagers.
|
|
67
48
|
name="parallel",
|
68
49
|
)
|
69
50
|
async def main() -> None:
|
70
|
-
# Use the app's context manager
|
71
51
|
async with fast.run() as agent:
|
72
|
-
await agent.parallel(
|
73
|
-
|
74
|
-
|
75
|
-
await agent.style_enforcer.prompt(default_prompt="STOP")
|
52
|
+
await agent.parallel.send(
|
53
|
+
Prompt.user("Student short story submission", Path("short_story.txt"))
|
54
|
+
)
|
76
55
|
|
77
56
|
|
78
57
|
if __name__ == "__main__":
|
79
|
-
asyncio.run(main())
|
58
|
+
asyncio.run(main()) # type: ignore
|
@@ -0,0 +1,13 @@
|
|
1
|
+
The Kittens Castle Adventuer
|
2
|
+
|
3
|
+
One sunny day, three lil kittens name Whiskers, Socks, and Mittens was walkin threw a mystirus forrest. They hadnt never seen such a big forrest before! The trees was tall an spooky, an the ground was coverd in moss an stikks.
|
4
|
+
|
5
|
+
Suddenlee, thru the trees, they sawd somthing HUUUUGE! It was a castell, but not just eny castell. This castell was made of sparkling chese an glittery windos. The turrits was so high they tuch the clowds, an the doars was big enuff for a elefant to walk threw!
|
6
|
+
|
7
|
+
"Lookk!" sed Whiskers, his tale all poofy wit exsitement. "We fowned a castell!" Socks meowed loudly an jumped up an down. Mittens, who was the smallist kitten, just stared wit her big rond eyes.
|
8
|
+
|
9
|
+
They climed up the cheesy walls, slip-slidin on the smoth surfase. Inside, they discoverd rooms ful of soft pillows an dangling strings an shiny things that went JINGEL when they tuch them. It was like a kitten paradyse!
|
10
|
+
|
11
|
+
But then, a big shadowy figur apeared... was it the castell gaurd? Or sumthing mor mystirus? The kittens hudeld togethar, there lil hearts beating fast. What wud happan next in there amazeing adventuer?
|
12
|
+
|
13
|
+
THE END??
|
@@ -0,0 +1,19 @@
|
|
1
|
+
The Battle of Glimmerwood
|
2
|
+
|
3
|
+
In the heart of Glimmerwood, a mystical forest knowed for its radiant trees, a small village thrived.
|
4
|
+
The villagers, who were live peacefully, shared their home with the forest's magical creatures,
|
5
|
+
especially the Glimmerfoxes whose fur shimmer like moonlight.
|
6
|
+
|
7
|
+
One fateful evening, the peace was shaterred when the infamous Dark Marauders attack.
|
8
|
+
Lead by the cunning Captain Thorn, the bandits aim to steal the precious Glimmerstones which was believed to grant immortality.
|
9
|
+
|
10
|
+
Amidst the choas, a young girl named Elara stood her ground, she rallied the villagers and devised a clever plan.
|
11
|
+
Using the forests natural defenses they lured the marauders into a trap.
|
12
|
+
As the bandits aproached the village square, a herd of Glimmerfoxes emerged, blinding them with their dazzling light,
|
13
|
+
the villagers seized the opportunity to captured the invaders.
|
14
|
+
|
15
|
+
Elara's bravery was celebrated and she was hailed as the "Guardian of Glimmerwood".
|
16
|
+
The Glimmerstones were secured in a hidden grove protected by an ancient spell.
|
17
|
+
|
18
|
+
However, not all was as it seemed. The Glimmerstones true power was never confirm,
|
19
|
+
and whispers of a hidden agenda linger among the villagers.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "fast-agent-mcp"
|
3
|
-
version = "0.
|
3
|
+
version = "0.2.0"
|
4
4
|
description = "Define, Prompt and Test MCP enabled Agents and Workflows"
|
5
5
|
readme = "README.md"
|
6
6
|
license = { file = "LICENSE" }
|
@@ -16,7 +16,7 @@ classifiers = [
|
|
16
16
|
requires-python = ">=3.10"
|
17
17
|
dependencies = [
|
18
18
|
"fastapi>=0.115.6",
|
19
|
-
"mcp
|
19
|
+
"mcp==1.6.0",
|
20
20
|
"opentelemetry-distro>=0.50b0",
|
21
21
|
"opentelemetry-exporter-otlp-proto-http>=1.29.0",
|
22
22
|
"pydantic-settings>=2.7.0",
|
@@ -39,9 +39,6 @@ temporal = [
|
|
39
39
|
openai = [
|
40
40
|
"openai>=1.58.1",
|
41
41
|
]
|
42
|
-
cohere = [
|
43
|
-
"cohere>=5.13.4",
|
44
|
-
]
|
45
42
|
dev = [
|
46
43
|
"anthropic>=0.42.0",
|
47
44
|
"pre-commit>=4.0.1",
|
@@ -51,6 +48,7 @@ dev = [
|
|
51
48
|
"tomli>=2.2.1",
|
52
49
|
"pytest>=7.4.0",
|
53
50
|
"pytest-asyncio>=0.21.1",
|
51
|
+
"pytest-cov",
|
54
52
|
]
|
55
53
|
|
56
54
|
[build-system]
|
@@ -66,10 +64,14 @@ include = [
|
|
66
64
|
"src/mcp_agent/**/*.yaml",
|
67
65
|
"src/mcp_agent/**/*.yml",
|
68
66
|
"src/mcp_agent/**/*.csv",
|
69
|
-
"
|
70
|
-
"
|
71
|
-
"
|
72
|
-
"
|
67
|
+
"examples/**/*.py",
|
68
|
+
"examples/**/*.yaml",
|
69
|
+
"examples/**/*.yml",
|
70
|
+
"examples/**/*.txt",
|
71
|
+
"examples/**/*.csv",
|
72
|
+
"examples/**/*.md",
|
73
|
+
"examples/**/*.css",
|
74
|
+
"examples/**/mount-point/*.csv",
|
73
75
|
]
|
74
76
|
|
75
77
|
[tool.pytest.ini_options]
|
@@ -103,17 +105,10 @@ silsila = "mcp_agent.cli.__main__:app"
|
|
103
105
|
prompt-server = "mcp_agent.mcp.prompts.__main__:main"
|
104
106
|
|
105
107
|
[tool.setuptools.package-data]
|
106
|
-
mcp_agent = [
|
107
|
-
"data/*.json",
|
108
|
-
"resources/examples/**/*.py",
|
109
|
-
"resources/examples/**/*.yaml",
|
110
|
-
"resources/examples/**/*.yml",
|
111
|
-
"resources/examples/**/*.csv",
|
112
|
-
"resources/examples/**/mount-point/*.csv"
|
113
|
-
]
|
108
|
+
mcp_agent = []
|
114
109
|
|
115
110
|
[tool.ruff]
|
116
|
-
line-length =
|
111
|
+
line-length = 100
|
117
112
|
target-version = "py310"
|
118
113
|
|
119
114
|
[tool.ruff.lint]
|
@@ -0,0 +1,75 @@
|
|
1
|
+
"""fast-agent - (fast-agent-mcp) An MCP native agent application framework"""
|
2
|
+
|
3
|
+
# Import important MCP types
|
4
|
+
from mcp.types import (
|
5
|
+
CallToolResult,
|
6
|
+
EmbeddedResource,
|
7
|
+
GetPromptResult,
|
8
|
+
ImageContent,
|
9
|
+
Prompt,
|
10
|
+
PromptMessage,
|
11
|
+
ReadResourceResult,
|
12
|
+
Role,
|
13
|
+
TextContent,
|
14
|
+
Tool,
|
15
|
+
)
|
16
|
+
|
17
|
+
# Core agent components
|
18
|
+
from mcp_agent.agents.agent import Agent, AgentConfig
|
19
|
+
from mcp_agent.core.direct_agent_app import DirectAgentApp
|
20
|
+
|
21
|
+
# Workflow decorators
|
22
|
+
from mcp_agent.core.direct_decorators import (
|
23
|
+
agent,
|
24
|
+
chain,
|
25
|
+
evaluator_optimizer,
|
26
|
+
orchestrator,
|
27
|
+
parallel,
|
28
|
+
router,
|
29
|
+
)
|
30
|
+
|
31
|
+
# FastAgent components
|
32
|
+
from mcp_agent.core.fastagent import FastAgent
|
33
|
+
|
34
|
+
# Request configuration
|
35
|
+
from mcp_agent.core.request_params import RequestParams
|
36
|
+
|
37
|
+
# Core protocol interfaces
|
38
|
+
from mcp_agent.mcp.interfaces import AgentProtocol, AugmentedLLMProtocol
|
39
|
+
from mcp_agent.mcp.mcp_aggregator import MCPAggregator, MCPCompoundServer
|
40
|
+
from mcp_agent.mcp.prompt_message_multipart import PromptMessageMultipart
|
41
|
+
|
42
|
+
__all__ = [
|
43
|
+
# MCP types
|
44
|
+
"Prompt",
|
45
|
+
"Tool",
|
46
|
+
"CallToolResult",
|
47
|
+
"TextContent",
|
48
|
+
"ImageContent",
|
49
|
+
"PromptMessage",
|
50
|
+
"GetPromptResult",
|
51
|
+
"ReadResourceResult",
|
52
|
+
"EmbeddedResource",
|
53
|
+
"Role",
|
54
|
+
# Core protocols
|
55
|
+
"AgentProtocol",
|
56
|
+
"AugmentedLLMProtocol",
|
57
|
+
# Core agent components
|
58
|
+
"Agent",
|
59
|
+
"AgentConfig",
|
60
|
+
"MCPAggregator",
|
61
|
+
"MCPCompoundServer",
|
62
|
+
"PromptMessageMultipart",
|
63
|
+
# FastAgent components
|
64
|
+
"FastAgent",
|
65
|
+
"DirectAgentApp",
|
66
|
+
# Workflow decorators
|
67
|
+
"agent",
|
68
|
+
"orchestrator",
|
69
|
+
"router",
|
70
|
+
"chain",
|
71
|
+
"parallel",
|
72
|
+
"evaluator_optimizer",
|
73
|
+
# Request configuration
|
74
|
+
"RequestParams",
|
75
|
+
]
|
@@ -0,0 +1,96 @@
|
|
1
|
+
"""
|
2
|
+
Agent implementation using the clean BaseAgent adapter.
|
3
|
+
|
4
|
+
This provides a streamlined implementation that adheres to AgentProtocol
|
5
|
+
while delegating LLM operations to an attached AugmentedLLMProtocol instance.
|
6
|
+
"""
|
7
|
+
|
8
|
+
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, TypeVar
|
9
|
+
|
10
|
+
from mcp_agent.agents.base_agent import BaseAgent
|
11
|
+
from mcp_agent.core.agent_types import AgentConfig
|
12
|
+
from mcp_agent.core.interactive_prompt import InteractivePrompt
|
13
|
+
from mcp_agent.human_input.types import HumanInputCallback
|
14
|
+
from mcp_agent.logging.logger import get_logger
|
15
|
+
from mcp_agent.mcp.interfaces import AugmentedLLMProtocol
|
16
|
+
|
17
|
+
if TYPE_CHECKING:
|
18
|
+
from mcp_agent.context import Context
|
19
|
+
|
20
|
+
logger = get_logger(__name__)
|
21
|
+
|
22
|
+
# Define a TypeVar for AugmentedLLM and its subclasses
|
23
|
+
LLM = TypeVar("LLM", bound=AugmentedLLMProtocol)
|
24
|
+
|
25
|
+
|
26
|
+
class Agent(BaseAgent):
|
27
|
+
"""
|
28
|
+
An Agent is an entity that has access to a set of MCP servers and can interact with them.
|
29
|
+
Each agent should have a purpose defined by its instruction.
|
30
|
+
|
31
|
+
This implementation provides a clean adapter that adheres to AgentProtocol
|
32
|
+
while delegating LLM operations to an attached AugmentedLLMProtocol instance.
|
33
|
+
"""
|
34
|
+
|
35
|
+
def __init__(
|
36
|
+
self,
|
37
|
+
config: AgentConfig, # Can be AgentConfig or backward compatible str name
|
38
|
+
functions: Optional[List[Callable]] = None,
|
39
|
+
connection_persistence: bool = True,
|
40
|
+
human_input_callback: Optional[HumanInputCallback] = None,
|
41
|
+
context: Optional["Context"] = None,
|
42
|
+
**kwargs: Dict[str, Any],
|
43
|
+
) -> None:
|
44
|
+
# Initialize with BaseAgent constructor
|
45
|
+
super().__init__(
|
46
|
+
config=config,
|
47
|
+
functions=functions,
|
48
|
+
connection_persistence=connection_persistence,
|
49
|
+
human_input_callback=human_input_callback,
|
50
|
+
context=context,
|
51
|
+
**kwargs,
|
52
|
+
)
|
53
|
+
|
54
|
+
async def prompt(self, default_prompt: str = "", agent_name: Optional[str] = None) -> str:
|
55
|
+
"""
|
56
|
+
Start an interactive prompt session with this agent.
|
57
|
+
|
58
|
+
Args:
|
59
|
+
default: Default message to use when user presses enter
|
60
|
+
agent_name: Ignored for single agents, included for API compatibility
|
61
|
+
|
62
|
+
Returns:
|
63
|
+
The result of the interactive session
|
64
|
+
"""
|
65
|
+
# Use the agent name as a string - ensure it's not the object itself
|
66
|
+
agent_name_str = str(self.name)
|
67
|
+
|
68
|
+
# Create agent_types dictionary with just this agent
|
69
|
+
agent_types = {agent_name_str: getattr(self.config, "agent_type", "Agent")}
|
70
|
+
|
71
|
+
# Create the interactive prompt
|
72
|
+
prompt = InteractivePrompt(agent_types=agent_types)
|
73
|
+
|
74
|
+
# Define wrapper for send function
|
75
|
+
async def send_wrapper(message, agent_name):
|
76
|
+
return await self.send(message)
|
77
|
+
|
78
|
+
# Define wrapper for apply_prompt function
|
79
|
+
async def apply_prompt_wrapper(prompt_name, args, agent_name):
|
80
|
+
# Just apply the prompt directly
|
81
|
+
return await self.apply_prompt(prompt_name, args)
|
82
|
+
|
83
|
+
# Define wrapper for list_prompts function
|
84
|
+
async def list_prompts_wrapper(agent_name):
|
85
|
+
# Always call list_prompts on this agent regardless of agent_name
|
86
|
+
return await self.list_prompts()
|
87
|
+
|
88
|
+
# Start the prompt loop with just this agent
|
89
|
+
return await prompt.prompt_loop(
|
90
|
+
send_func=send_wrapper,
|
91
|
+
default_agent=agent_name_str,
|
92
|
+
available_agents=[agent_name_str], # Only this agent
|
93
|
+
apply_prompt_func=apply_prompt_wrapper,
|
94
|
+
list_prompts_func=list_prompts_wrapper,
|
95
|
+
default=default_prompt,
|
96
|
+
)
|