fast-agent-mcp 0.1.12__py3-none-any.whl → 0.2.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.
- {fast_agent_mcp-0.1.12.dist-info → fast_agent_mcp-0.2.0.dist-info}/METADATA +3 -4
- fast_agent_mcp-0.2.0.dist-info/RECORD +123 -0
- mcp_agent/__init__.py +75 -0
- mcp_agent/agents/agent.py +61 -415
- mcp_agent/agents/base_agent.py +522 -0
- mcp_agent/agents/workflow/__init__.py +1 -0
- mcp_agent/agents/workflow/chain_agent.py +173 -0
- mcp_agent/agents/workflow/evaluator_optimizer.py +362 -0
- mcp_agent/agents/workflow/orchestrator_agent.py +591 -0
- mcp_agent/{workflows/orchestrator → agents/workflow}/orchestrator_models.py +11 -21
- mcp_agent/agents/workflow/parallel_agent.py +182 -0
- mcp_agent/agents/workflow/router_agent.py +307 -0
- mcp_agent/app.py +15 -19
- mcp_agent/cli/commands/bootstrap.py +19 -38
- mcp_agent/cli/commands/config.py +4 -4
- mcp_agent/cli/commands/setup.py +7 -14
- mcp_agent/cli/main.py +7 -10
- mcp_agent/cli/terminal.py +3 -3
- mcp_agent/config.py +25 -40
- mcp_agent/context.py +12 -21
- mcp_agent/context_dependent.py +3 -5
- mcp_agent/core/agent_types.py +10 -7
- mcp_agent/core/direct_agent_app.py +179 -0
- mcp_agent/core/direct_decorators.py +443 -0
- mcp_agent/core/direct_factory.py +476 -0
- mcp_agent/core/enhanced_prompt.py +23 -55
- mcp_agent/core/exceptions.py +8 -8
- mcp_agent/core/fastagent.py +145 -371
- mcp_agent/core/interactive_prompt.py +424 -0
- mcp_agent/core/mcp_content.py +17 -17
- mcp_agent/core/prompt.py +6 -9
- mcp_agent/core/request_params.py +6 -3
- mcp_agent/core/validation.py +92 -18
- mcp_agent/executor/decorator_registry.py +9 -17
- mcp_agent/executor/executor.py +8 -17
- mcp_agent/executor/task_registry.py +2 -4
- mcp_agent/executor/temporal.py +19 -41
- mcp_agent/executor/workflow.py +3 -5
- mcp_agent/executor/workflow_signal.py +15 -21
- mcp_agent/human_input/handler.py +4 -7
- mcp_agent/human_input/types.py +2 -3
- mcp_agent/llm/__init__.py +2 -0
- mcp_agent/llm/augmented_llm.py +450 -0
- mcp_agent/llm/augmented_llm_passthrough.py +162 -0
- mcp_agent/llm/augmented_llm_playback.py +83 -0
- mcp_agent/llm/memory.py +103 -0
- mcp_agent/{workflows/llm → llm}/model_factory.py +22 -16
- mcp_agent/{workflows/llm → llm}/prompt_utils.py +1 -3
- mcp_agent/llm/providers/__init__.py +8 -0
- mcp_agent/{workflows/llm → llm/providers}/anthropic_utils.py +8 -25
- mcp_agent/{workflows/llm → llm/providers}/augmented_llm_anthropic.py +56 -194
- mcp_agent/llm/providers/augmented_llm_deepseek.py +53 -0
- mcp_agent/{workflows/llm → llm/providers}/augmented_llm_openai.py +99 -190
- mcp_agent/{workflows/llm → llm}/providers/multipart_converter_anthropic.py +72 -71
- mcp_agent/{workflows/llm → llm}/providers/multipart_converter_openai.py +65 -71
- mcp_agent/{workflows/llm → llm}/providers/openai_multipart.py +16 -44
- mcp_agent/{workflows/llm → llm/providers}/openai_utils.py +4 -4
- mcp_agent/{workflows/llm → llm}/providers/sampling_converter_anthropic.py +9 -11
- mcp_agent/{workflows/llm → llm}/providers/sampling_converter_openai.py +8 -12
- mcp_agent/{workflows/llm → llm}/sampling_converter.py +3 -31
- mcp_agent/llm/sampling_format_converter.py +37 -0
- mcp_agent/logging/events.py +1 -5
- mcp_agent/logging/json_serializer.py +7 -6
- mcp_agent/logging/listeners.py +20 -23
- mcp_agent/logging/logger.py +17 -19
- mcp_agent/logging/rich_progress.py +10 -8
- mcp_agent/logging/tracing.py +4 -6
- mcp_agent/logging/transport.py +22 -22
- mcp_agent/mcp/gen_client.py +1 -3
- mcp_agent/mcp/interfaces.py +117 -110
- mcp_agent/mcp/logger_textio.py +97 -0
- mcp_agent/mcp/mcp_agent_client_session.py +7 -7
- mcp_agent/mcp/mcp_agent_server.py +8 -8
- mcp_agent/mcp/mcp_aggregator.py +102 -143
- mcp_agent/mcp/mcp_connection_manager.py +20 -27
- mcp_agent/mcp/prompt_message_multipart.py +68 -16
- mcp_agent/mcp/prompt_render.py +77 -0
- mcp_agent/mcp/prompt_serialization.py +30 -48
- mcp_agent/mcp/prompts/prompt_constants.py +18 -0
- mcp_agent/mcp/prompts/prompt_helpers.py +327 -0
- mcp_agent/mcp/prompts/prompt_load.py +109 -0
- mcp_agent/mcp/prompts/prompt_server.py +155 -195
- mcp_agent/mcp/prompts/prompt_template.py +35 -66
- mcp_agent/mcp/resource_utils.py +7 -14
- mcp_agent/mcp/sampling.py +17 -17
- mcp_agent/mcp_server/agent_server.py +13 -17
- mcp_agent/mcp_server_registry.py +13 -22
- mcp_agent/resources/examples/{workflows → in_dev}/agent_build.py +3 -2
- mcp_agent/resources/examples/in_dev/slides.py +110 -0
- mcp_agent/resources/examples/internal/agent.py +6 -3
- mcp_agent/resources/examples/internal/fastagent.config.yaml +8 -2
- mcp_agent/resources/examples/internal/job.py +2 -1
- mcp_agent/resources/examples/internal/prompt_category.py +1 -1
- mcp_agent/resources/examples/internal/prompt_sizing.py +3 -5
- mcp_agent/resources/examples/internal/sizer.py +2 -1
- mcp_agent/resources/examples/internal/social.py +2 -1
- mcp_agent/resources/examples/prompting/agent.py +2 -1
- mcp_agent/resources/examples/prompting/image_server.py +4 -8
- mcp_agent/resources/examples/prompting/work_with_image.py +19 -0
- mcp_agent/ui/console_display.py +16 -20
- fast_agent_mcp-0.1.12.dist-info/RECORD +0 -161
- mcp_agent/core/agent_app.py +0 -646
- mcp_agent/core/agent_utils.py +0 -71
- mcp_agent/core/decorators.py +0 -455
- mcp_agent/core/factory.py +0 -463
- mcp_agent/core/proxies.py +0 -269
- mcp_agent/core/types.py +0 -24
- mcp_agent/eval/__init__.py +0 -0
- mcp_agent/mcp/stdio.py +0 -111
- mcp_agent/resources/examples/data-analysis/analysis-campaign.py +0 -188
- mcp_agent/resources/examples/data-analysis/analysis.py +0 -65
- mcp_agent/resources/examples/data-analysis/fastagent.config.yaml +0 -41
- mcp_agent/resources/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-Attrition.csv +0 -1471
- mcp_agent/resources/examples/mcp_researcher/researcher-eval.py +0 -53
- mcp_agent/resources/examples/researcher/fastagent.config.yaml +0 -66
- mcp_agent/resources/examples/researcher/researcher-eval.py +0 -53
- mcp_agent/resources/examples/researcher/researcher-imp.py +0 -190
- mcp_agent/resources/examples/researcher/researcher.py +0 -38
- mcp_agent/resources/examples/workflows/chaining.py +0 -44
- mcp_agent/resources/examples/workflows/evaluator.py +0 -78
- mcp_agent/resources/examples/workflows/fastagent.config.yaml +0 -24
- mcp_agent/resources/examples/workflows/human_input.py +0 -25
- mcp_agent/resources/examples/workflows/orchestrator.py +0 -73
- mcp_agent/resources/examples/workflows/parallel.py +0 -78
- mcp_agent/resources/examples/workflows/router.py +0 -53
- mcp_agent/resources/examples/workflows/sse.py +0 -23
- mcp_agent/telemetry/__init__.py +0 -0
- mcp_agent/telemetry/usage_tracking.py +0 -18
- mcp_agent/workflows/__init__.py +0 -0
- mcp_agent/workflows/embedding/__init__.py +0 -0
- mcp_agent/workflows/embedding/embedding_base.py +0 -61
- mcp_agent/workflows/embedding/embedding_cohere.py +0 -49
- mcp_agent/workflows/embedding/embedding_openai.py +0 -46
- mcp_agent/workflows/evaluator_optimizer/__init__.py +0 -0
- mcp_agent/workflows/evaluator_optimizer/evaluator_optimizer.py +0 -481
- mcp_agent/workflows/intent_classifier/__init__.py +0 -0
- mcp_agent/workflows/intent_classifier/intent_classifier_base.py +0 -120
- mcp_agent/workflows/intent_classifier/intent_classifier_embedding.py +0 -134
- mcp_agent/workflows/intent_classifier/intent_classifier_embedding_cohere.py +0 -45
- mcp_agent/workflows/intent_classifier/intent_classifier_embedding_openai.py +0 -45
- mcp_agent/workflows/intent_classifier/intent_classifier_llm.py +0 -161
- mcp_agent/workflows/intent_classifier/intent_classifier_llm_anthropic.py +0 -60
- mcp_agent/workflows/intent_classifier/intent_classifier_llm_openai.py +0 -60
- mcp_agent/workflows/llm/__init__.py +0 -0
- mcp_agent/workflows/llm/augmented_llm.py +0 -753
- mcp_agent/workflows/llm/augmented_llm_passthrough.py +0 -241
- mcp_agent/workflows/llm/augmented_llm_playback.py +0 -109
- mcp_agent/workflows/llm/providers/__init__.py +0 -8
- mcp_agent/workflows/llm/sampling_format_converter.py +0 -22
- mcp_agent/workflows/orchestrator/__init__.py +0 -0
- mcp_agent/workflows/orchestrator/orchestrator.py +0 -578
- mcp_agent/workflows/parallel/__init__.py +0 -0
- mcp_agent/workflows/parallel/fan_in.py +0 -350
- mcp_agent/workflows/parallel/fan_out.py +0 -187
- mcp_agent/workflows/parallel/parallel_llm.py +0 -166
- mcp_agent/workflows/router/__init__.py +0 -0
- mcp_agent/workflows/router/router_base.py +0 -368
- mcp_agent/workflows/router/router_embedding.py +0 -240
- mcp_agent/workflows/router/router_embedding_cohere.py +0 -59
- mcp_agent/workflows/router/router_embedding_openai.py +0 -59
- mcp_agent/workflows/router/router_llm.py +0 -320
- mcp_agent/workflows/swarm/__init__.py +0 -0
- mcp_agent/workflows/swarm/swarm.py +0 -320
- mcp_agent/workflows/swarm/swarm_anthropic.py +0 -42
- mcp_agent/workflows/swarm/swarm_openai.py +0 -41
- {fast_agent_mcp-0.1.12.dist-info → fast_agent_mcp-0.2.0.dist-info}/WHEEL +0 -0
- {fast_agent_mcp-0.1.12.dist-info → fast_agent_mcp-0.2.0.dist-info}/entry_points.txt +0 -0
- {fast_agent_mcp-0.1.12.dist-info → fast_agent_mcp-0.2.0.dist-info}/licenses/LICENSE +0 -0
- /mcp_agent/{workflows/orchestrator → agents/workflow}/orchestrator_prompts.py +0 -0
@@ -1,53 +0,0 @@
|
|
1
|
-
import asyncio
|
2
|
-
|
3
|
-
from mcp_agent.core.fastagent import FastAgent
|
4
|
-
|
5
|
-
agents = FastAgent(name="Researcher")
|
6
|
-
|
7
|
-
|
8
|
-
@agents.agent(
|
9
|
-
name="Researcher",
|
10
|
-
instruction="""
|
11
|
-
You are a research assistant, with access to internet search (via Brave),
|
12
|
-
website fetch, a python interpreter (you can install packages with uv) and a filesystem.
|
13
|
-
Use the current working directory to save and create files with both the Interpreter and Filesystem tools.
|
14
|
-
The interpreter has numpy, pandas, matplotlib and seaborn already installed.
|
15
|
-
|
16
|
-
You must always provide a summary of the specific sources you have used in your research.
|
17
|
-
""",
|
18
|
-
servers=["brave", "interpreter", "filesystem", "fetch"],
|
19
|
-
)
|
20
|
-
@agents.agent(
|
21
|
-
name="Evaluator",
|
22
|
-
model="sonnet",
|
23
|
-
instruction="""
|
24
|
-
Evaluate the response from the researcher based on the criteria:
|
25
|
-
- Sources cited. Has the researcher provided a summary of the specific sources used in the research?
|
26
|
-
- Validity. Has the researcher cross-checked and validated data and assumptions.
|
27
|
-
- Alignment. Has the researher acted and addressed feedback from any previous assessments?
|
28
|
-
|
29
|
-
For each criterion:
|
30
|
-
- Provide a rating (EXCELLENT, GOOD, FAIR, or POOR).
|
31
|
-
- Offer specific feedback or suggestions for improvement.
|
32
|
-
|
33
|
-
Summarize your evaluation as a structured response with:
|
34
|
-
- Overall quality rating.
|
35
|
-
- Specific feedback and areas for improvement.""",
|
36
|
-
)
|
37
|
-
@agents.evaluator_optimizer(
|
38
|
-
generator="Researcher",
|
39
|
-
evaluator="Evaluator",
|
40
|
-
max_refinements=5,
|
41
|
-
min_rating="EXCELLENT",
|
42
|
-
name="Researcher_Evaluator",
|
43
|
-
)
|
44
|
-
async def main():
|
45
|
-
async with agents.run() as agent:
|
46
|
-
await agent.prompt("Researcher_Evaluator")
|
47
|
-
|
48
|
-
print("Ask follow up quesions to the Researcher?")
|
49
|
-
await agent.prompt("Researcher", default="STOP")
|
50
|
-
|
51
|
-
|
52
|
-
if __name__ == "__main__":
|
53
|
-
asyncio.run(main())
|
@@ -1,66 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Please edit this configuration file to match your environment (on Windows).
|
3
|
-
# Examples in comments below - check/change the paths.
|
4
|
-
#
|
5
|
-
#
|
6
|
-
|
7
|
-
execution_engine: asyncio
|
8
|
-
logger:
|
9
|
-
type: console
|
10
|
-
level: error
|
11
|
-
truncate_tools: true
|
12
|
-
|
13
|
-
mcp:
|
14
|
-
servers:
|
15
|
-
brave:
|
16
|
-
# On windows replace the command and args line to use `node` and the absolute path to the server.
|
17
|
-
# Use `npm i -g @modelcontextprotocol/server-brave-search` to install the server globally.
|
18
|
-
# Use `npm -g root` to find the global node_modules path.`
|
19
|
-
# command: "node"
|
20
|
-
# args: ["c:/Program Files/nodejs/node_modules/@modelcontextprotocol/server-brave-search/dist/index.js"]
|
21
|
-
command: "npx"
|
22
|
-
args: ["-y", "@modelcontextprotocol/server-brave-search"]
|
23
|
-
env:
|
24
|
-
# You can also place your BRAVE_API_KEY in the fastagent.secrets.yaml file.
|
25
|
-
BRAVE_API_KEY: <your_brave_api_key>
|
26
|
-
filesystem:
|
27
|
-
# On windows update the command and arguments to use `node` and the absolute path to the server.
|
28
|
-
# Use `npm i -g @modelcontextprotocol/server-filesystem` to install the server globally.
|
29
|
-
# Use `npm -g root` to find the global node_modules path.`
|
30
|
-
# command: "node"
|
31
|
-
# args: ["c:/Program Files/nodejs/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js","./agent_folder"]
|
32
|
-
command: "npx"
|
33
|
-
args: ["-y", "@modelcontextprotocol/server-filesystem", "./agent_folder/"]
|
34
|
-
interpreter:
|
35
|
-
command: "docker"
|
36
|
-
args: [
|
37
|
-
"run",
|
38
|
-
"-i",
|
39
|
-
"--rm",
|
40
|
-
"--pull=always",
|
41
|
-
"-v",
|
42
|
-
"./agent_folder:/mnt/data/",
|
43
|
-
# Docker needs the absolute path on Windows (e.g. "x:/fastagent/agent_folder:/mnt/data/")
|
44
|
-
# "./agent_folder:/mnt/data/",
|
45
|
-
"ghcr.io/evalstate/mcp-py-repl:latest",
|
46
|
-
]
|
47
|
-
roots:
|
48
|
-
- uri: "file://./agent_folder/"
|
49
|
-
name: "agent_folder"
|
50
|
-
server_uri_alias: "file:///mnt/data/"
|
51
|
-
fetch:
|
52
|
-
command: "uvx"
|
53
|
-
args: ["mcp-server-fetch"]
|
54
|
-
sequential:
|
55
|
-
command: "npx"
|
56
|
-
args: ["-y","@modelcontextprotocol/server-sequential-thinking"]
|
57
|
-
|
58
|
-
# webmcp:
|
59
|
-
# command: "node"
|
60
|
-
# args: ["/home/ssmith/.webmcp/server.cjs"]
|
61
|
-
# env:
|
62
|
-
# WEBMCP_SERVER_TOKEN: 96e22896d8143fc1d61fec09208fc5ed
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
@@ -1,53 +0,0 @@
|
|
1
|
-
import asyncio
|
2
|
-
|
3
|
-
from mcp_agent.core.fastagent import FastAgent
|
4
|
-
|
5
|
-
agents = FastAgent(name="Researcher Agent (EO)")
|
6
|
-
|
7
|
-
|
8
|
-
@agents.agent(
|
9
|
-
name="Researcher",
|
10
|
-
instruction="""
|
11
|
-
You are a research assistant, with access to internet search (via Brave),
|
12
|
-
website fetch, a python interpreter (you can install packages with uv) and a filesystem.
|
13
|
-
Use the current working directory to save and create files with both the Interpreter and Filesystem tools.
|
14
|
-
The interpreter has numpy, pandas, matplotlib and seaborn already installed.
|
15
|
-
|
16
|
-
You must always provide a summary of the specific sources you have used in your research.
|
17
|
-
""",
|
18
|
-
servers=["brave", "interpreter", "filesystem", "fetch"],
|
19
|
-
)
|
20
|
-
@agents.agent(
|
21
|
-
name="Evaluator",
|
22
|
-
model="sonnet",
|
23
|
-
instruction="""
|
24
|
-
Evaluate the response from the researcher based on the criteria:
|
25
|
-
- Sources cited. Has the researcher provided a summary of the specific sources used in the research?
|
26
|
-
- Validity. Has the researcher cross-checked and validated data and assumptions.
|
27
|
-
- Alignment. Has the researher acted and addressed feedback from any previous assessments?
|
28
|
-
|
29
|
-
For each criterion:
|
30
|
-
- Provide a rating (EXCELLENT, GOOD, FAIR, or POOR).
|
31
|
-
- Offer specific feedback or suggestions for improvement.
|
32
|
-
|
33
|
-
Summarize your evaluation as a structured response with:
|
34
|
-
- Overall quality rating.
|
35
|
-
- Specific feedback and areas for improvement.""",
|
36
|
-
)
|
37
|
-
@agents.evaluator_optimizer(
|
38
|
-
generator="Researcher",
|
39
|
-
evaluator="Evaluator",
|
40
|
-
max_refinements=5,
|
41
|
-
min_rating="EXCELLENT",
|
42
|
-
name="Researcher_Evaluator",
|
43
|
-
)
|
44
|
-
async def main():
|
45
|
-
async with agents.run() as agent:
|
46
|
-
await agent.prompt("Researcher_Evaluator")
|
47
|
-
|
48
|
-
print("Ask follow up quesions to the Researcher?")
|
49
|
-
await agent.prompt("Researcher", default="STOP")
|
50
|
-
|
51
|
-
|
52
|
-
if __name__ == "__main__":
|
53
|
-
asyncio.run(main())
|
@@ -1,190 +0,0 @@
|
|
1
|
-
import asyncio
|
2
|
-
from mcp_agent.core.fastagent import FastAgent
|
3
|
-
|
4
|
-
agents = FastAgent(name="Enhanced Researcher")
|
5
|
-
|
6
|
-
|
7
|
-
@agents.agent(
|
8
|
-
name="ResearchPlanner",
|
9
|
-
model="sonnet", # Using a more capable model for planning
|
10
|
-
instruction="""
|
11
|
-
You are a strategic research planner. Your job is to:
|
12
|
-
1. Break down complex research questions into specific sub-questions
|
13
|
-
2. Identify the key information sources needed to answer each sub-question
|
14
|
-
3. Outline a structured research plan
|
15
|
-
|
16
|
-
When given a research topic:
|
17
|
-
- Analyze what is being asked and identify the core components
|
18
|
-
- Define 3-5 specific sub-questions that need to be answered
|
19
|
-
- For each sub-question, suggest specific search queries and information sources
|
20
|
-
- Prioritize the most important areas to investigate first
|
21
|
-
- Include suggestions for data visualization or analysis if appropriate
|
22
|
-
|
23
|
-
Your output should be a clear, structured research plan that the Researcher can follow.
|
24
|
-
""",
|
25
|
-
servers=["brave"],
|
26
|
-
)
|
27
|
-
@agents.agent(
|
28
|
-
name="Researcher",
|
29
|
-
model="sonnet", # Using a more capable model for deep research
|
30
|
-
instruction="""
|
31
|
-
You are an expert research assistant with access to multiple resources:
|
32
|
-
- Brave Search for initial exploration and discovering sources
|
33
|
-
- Website fetching to read and extract information directly from webpages
|
34
|
-
- Python interpreter for data analysis and visualization
|
35
|
-
- Filesystem tools to save and organize your findings
|
36
|
-
|
37
|
-
RESEARCH METHODOLOGY:
|
38
|
-
1. First understand the research plan provided
|
39
|
-
2. For each sub-question, use search tools to find multiple relevant sources
|
40
|
-
3. Go beyond surface-level information by:
|
41
|
-
- Consulting primary sources when possible
|
42
|
-
- Cross-referencing information across multiple sources
|
43
|
-
- Using the fetch tool to access complete articles rather than just search snippets
|
44
|
-
- Analyzing data with Python when numerical evidence is needed
|
45
|
-
- Creating visualizations when they help clarify complex information
|
46
|
-
|
47
|
-
CRITICAL INFORMATION ASSESSMENT:
|
48
|
-
- Evaluate the credibility of each source (consider recency, authority, potential bias)
|
49
|
-
- Look for consensus across multiple sources
|
50
|
-
- Highlight any contradictions or areas of debate in the research
|
51
|
-
- Clearly state limitations in the available information
|
52
|
-
|
53
|
-
DOCUMENTATION:
|
54
|
-
- Save important information, data, and visualizations to files
|
55
|
-
- Always create a comprehensive bibliography with links to all sources
|
56
|
-
- Include specific citation details (author, date, publication) when available
|
57
|
-
- Note which specific information came from which source
|
58
|
-
|
59
|
-
FINAL RESPONSE:
|
60
|
-
- Structure your findings logically with clear headings
|
61
|
-
- Synthesize the information rather than just listing facts
|
62
|
-
- Directly address each sub-question from the research plan
|
63
|
-
- Use data and visualizations to support key points
|
64
|
-
- End with a concise executive summary of your findings
|
65
|
-
- Include a "Methodology" section explaining how you conducted your research
|
66
|
-
""",
|
67
|
-
servers=["brave", "interpreter", "filesystem", "fetch"],
|
68
|
-
use_history=True,
|
69
|
-
)
|
70
|
-
@agents.agent(
|
71
|
-
name="FactChecker",
|
72
|
-
instruction="""
|
73
|
-
You are a meticulous fact-checker and critical evaluator of research. Your responsibilities are to:
|
74
|
-
|
75
|
-
1. Verify factual claims by cross-checking with authoritative sources
|
76
|
-
2. Identify any unsupported assertions or logical fallacies
|
77
|
-
3. Detect potential biases or limitations in the research methodology
|
78
|
-
4. Ensure proper representation of diverse perspectives on controversial topics
|
79
|
-
5. Evaluate the quality, reliability, and currency of cited sources
|
80
|
-
|
81
|
-
When reviewing research:
|
82
|
-
- Flag any claims that lack sufficient evidence or citation
|
83
|
-
- Identify information that seems outdated or contradicts current consensus
|
84
|
-
- Check for oversimplifications of complex topics
|
85
|
-
- Ensure numerical data and statistics are accurately represented
|
86
|
-
- Verify that quotations are accurate and in proper context
|
87
|
-
- Look for any gaps in the research or important perspectives that were omitted
|
88
|
-
|
89
|
-
Your feedback should be specific, actionable, and structured to help improve accuracy and comprehensiveness.
|
90
|
-
""",
|
91
|
-
servers=["brave", "fetch"],
|
92
|
-
)
|
93
|
-
@agents.agent(
|
94
|
-
name="Evaluator",
|
95
|
-
model="sonnet",
|
96
|
-
instruction="""
|
97
|
-
You are a senior research quality evaluator with expertise in academic and professional research standards.
|
98
|
-
|
99
|
-
COMPREHENSIVE EVALUATION CRITERIA:
|
100
|
-
1. Research Methodology
|
101
|
-
- Has the researcher followed a structured approach?
|
102
|
-
- Were appropriate research methods applied?
|
103
|
-
- Is there evidence of strategic information gathering?
|
104
|
-
|
105
|
-
2. Source Quality & Diversity
|
106
|
-
- Are sources authoritative, current, and relevant?
|
107
|
-
- Is there appropriate diversity of sources?
|
108
|
-
- Were primary sources consulted when appropriate?
|
109
|
-
|
110
|
-
3. Information Depth
|
111
|
-
- Does the research go beyond surface-level information?
|
112
|
-
- Is there evidence of in-depth analysis?
|
113
|
-
- Has the researcher explored multiple aspects of the topic?
|
114
|
-
|
115
|
-
4. Critical Analysis
|
116
|
-
- Has information been critically evaluated rather than simply reported?
|
117
|
-
- Are limitations and uncertainties acknowledged?
|
118
|
-
- Are multiple perspectives considered on controversial topics?
|
119
|
-
|
120
|
-
5. Data & Evidence
|
121
|
-
- Is quantitative data properly analyzed and presented?
|
122
|
-
- Are visualizations clear, accurate, and informative?
|
123
|
-
- Is qualitative information presented with appropriate context?
|
124
|
-
|
125
|
-
6. Documentation & Attribution
|
126
|
-
- Are all sources properly cited with complete reference information?
|
127
|
-
- Is it clear which information came from which source?
|
128
|
-
- Is the bibliography comprehensive and well-formatted?
|
129
|
-
|
130
|
-
7. Structure & Communication
|
131
|
-
- Is the research presented in a logical, well-organized manner?
|
132
|
-
- Are findings communicated clearly and precisely?
|
133
|
-
- Is the level of technical language appropriate for the intended audience?
|
134
|
-
|
135
|
-
8. Alignment with Previous Feedback
|
136
|
-
- Has the researcher addressed specific feedback from previous evaluations?
|
137
|
-
- Have requested improvements been successfully implemented?
|
138
|
-
|
139
|
-
For each criterion, provide:
|
140
|
-
- A detailed RATING (EXCELLENT, GOOD, FAIR, or POOR)
|
141
|
-
- Specific examples from the research that justify your rating
|
142
|
-
- Clear, actionable suggestions for improvement
|
143
|
-
|
144
|
-
Your evaluation should conclude with:
|
145
|
-
- An OVERALL RATING that reflects the research quality
|
146
|
-
- A concise summary of the research's major strengths
|
147
|
-
- A prioritized list of the most important areas for improvement
|
148
|
-
|
149
|
-
The researcher should be able to understand exactly why they received their rating and what specific steps they can take to improve.
|
150
|
-
""",
|
151
|
-
)
|
152
|
-
@agents.chain(
|
153
|
-
name="ResearchProcess",
|
154
|
-
sequence=["ResearchPlanner", "Researcher", "FactChecker"],
|
155
|
-
instruction="A comprehensive research workflow that plans, executes, and verifies research",
|
156
|
-
cumulative=True,
|
157
|
-
)
|
158
|
-
@agents.evaluator_optimizer(
|
159
|
-
generator="ResearchProcess",
|
160
|
-
evaluator="Evaluator",
|
161
|
-
max_refinements=3,
|
162
|
-
min_rating="EXCELLENT",
|
163
|
-
name="EnhancedResearcher",
|
164
|
-
)
|
165
|
-
async def main():
|
166
|
-
async with agents.run() as agent:
|
167
|
-
# Start with a warm-up to set expectations and explain the research approach
|
168
|
-
await agent.Researcher.send(
|
169
|
-
"""I'm an enhanced research assistant trained to conduct thorough, evidence-based research.
|
170
|
-
I'll approach your question by:
|
171
|
-
1. Creating a structured research plan
|
172
|
-
2. Gathering information from multiple authoritative sources
|
173
|
-
3. Analyzing data and creating visualizations when helpful
|
174
|
-
4. Fact-checking and verifying all information
|
175
|
-
5. Providing a comprehensive, well-documented answer
|
176
|
-
|
177
|
-
What would you like me to research for you today?"""
|
178
|
-
)
|
179
|
-
|
180
|
-
# Start the main research workflow
|
181
|
-
await agent.prompt("EnhancedResearcher")
|
182
|
-
|
183
|
-
print(
|
184
|
-
"\nWould you like to ask follow-up questions to the Researcher? (Type 'STOP' to end)"
|
185
|
-
)
|
186
|
-
await agent.prompt("Researcher", default="STOP")
|
187
|
-
|
188
|
-
|
189
|
-
if __name__ == "__main__":
|
190
|
-
asyncio.run(main())
|
@@ -1,38 +0,0 @@
|
|
1
|
-
import asyncio
|
2
|
-
|
3
|
-
from mcp_agent.core.fastagent import FastAgent
|
4
|
-
# from rich import print
|
5
|
-
|
6
|
-
agents = FastAgent(name="Researcher Agent")
|
7
|
-
|
8
|
-
|
9
|
-
@agents.agent(
|
10
|
-
"Researcher",
|
11
|
-
instruction="""
|
12
|
-
You are a research assistant, with access to internet search (via Brave),
|
13
|
-
website fetch, a python interpreter (you can install packages with uv) and a filesystem.
|
14
|
-
Use the current working directory to save and create files with both the Interpreter and Filesystem tools.
|
15
|
-
The interpreter has numpy, pandas, matplotlib and seaborn already installed
|
16
|
-
""",
|
17
|
-
servers=["brave", "interpreter", "filesystem", "fetch"],
|
18
|
-
)
|
19
|
-
async def main():
|
20
|
-
research_prompt = """
|
21
|
-
Produce an investment report for the company Eutelsat. The final report should be saved in the filesystem in markdown format, and
|
22
|
-
contain at least the following:
|
23
|
-
1 - A brief description of the company
|
24
|
-
2 - Current financial position (find data, create and incorporate charts)
|
25
|
-
3 - A PESTLE analysis
|
26
|
-
4 - An investment thesis for the next 3 years. Include both 'buy side' and 'sell side' arguments, and a final
|
27
|
-
summary and recommendation.
|
28
|
-
Todays date is 15 February 2025. Include the main data sources consulted in presenting the report.""" # noqa: F841
|
29
|
-
|
30
|
-
async with agents.run() as agent:
|
31
|
-
await agent.prompt()
|
32
|
-
|
33
|
-
# await agent.prompt(default="STOP")
|
34
|
-
# await agent.prompt(default=research_prompt)
|
35
|
-
|
36
|
-
|
37
|
-
if __name__ == "__main__":
|
38
|
-
asyncio.run(main())
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import asyncio
|
2
|
-
from mcp_agent.core.fastagent import FastAgent
|
3
|
-
|
4
|
-
# Create the application
|
5
|
-
fast = FastAgent("Agent Chaining")
|
6
|
-
|
7
|
-
|
8
|
-
@fast.agent(
|
9
|
-
"url_fetcher",
|
10
|
-
instruction="Given a URL, provide a complete and comprehensive summary",
|
11
|
-
servers=["fetch"],
|
12
|
-
)
|
13
|
-
@fast.agent(
|
14
|
-
"social_media",
|
15
|
-
instruction="""
|
16
|
-
Write a 280 character social media post for any given text.
|
17
|
-
Respond only with the post, never use hashtags.
|
18
|
-
""",
|
19
|
-
)
|
20
|
-
@fast.chain(
|
21
|
-
name="post_writer",
|
22
|
-
sequence=["url_fetcher", "social_media"],
|
23
|
-
)
|
24
|
-
async def main():
|
25
|
-
async with fast.run() as agent:
|
26
|
-
# using chain workflow
|
27
|
-
await agent.post_writer.prompt()
|
28
|
-
|
29
|
-
# calling directly
|
30
|
-
# await agent.url_fetcher("http://llmindset.co.uk/resources/mcp-hfspace/")
|
31
|
-
# await agent.social_media(
|
32
|
-
# await agent.url_fetcher("http://llmindset.co.uk/resources/mcp-hfspace/")
|
33
|
-
# )
|
34
|
-
|
35
|
-
# agents can also be accessed like dictionaries:
|
36
|
-
# awwait agent["post_writer"].prompt()
|
37
|
-
|
38
|
-
|
39
|
-
# alternative syntax for above is result = agent["post_writer"].send(message)
|
40
|
-
# alternative syntax for above is result = agent["post_writer"].prompt()
|
41
|
-
|
42
|
-
|
43
|
-
if __name__ == "__main__":
|
44
|
-
asyncio.run(main())
|
@@ -1,78 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
This demonstrates creating an optimizer and evaluator to iteratively improve content.
|
3
|
-
"""
|
4
|
-
|
5
|
-
import asyncio
|
6
|
-
from mcp_agent.core.fastagent import FastAgent
|
7
|
-
|
8
|
-
# Create the application
|
9
|
-
fast = FastAgent("Evaluator-Optimizer")
|
10
|
-
|
11
|
-
|
12
|
-
# Define generator agent
|
13
|
-
@fast.agent(
|
14
|
-
name="generator",
|
15
|
-
instruction="""You are a career coach specializing in cover letter writing.
|
16
|
-
You are tasked with generating a compelling cover letter given the job posting,
|
17
|
-
candidate details, and company information. Tailor the response to the company and job requirements.
|
18
|
-
""",
|
19
|
-
servers=["fetch"],
|
20
|
-
model="haiku3",
|
21
|
-
use_history=True,
|
22
|
-
)
|
23
|
-
# Define evaluator agent
|
24
|
-
@fast.agent(
|
25
|
-
name="evaluator",
|
26
|
-
instruction="""Evaluate the following response based on the criteria below:
|
27
|
-
1. Clarity: Is the language clear, concise, and grammatically correct?
|
28
|
-
2. Specificity: Does the response include relevant and concrete details tailored to the job description?
|
29
|
-
3. Relevance: Does the response align with the prompt and avoid unnecessary information?
|
30
|
-
4. Tone and Style: Is the tone professional and appropriate for the context?
|
31
|
-
5. Persuasiveness: Does the response effectively highlight the candidate's value?
|
32
|
-
6. Grammar and Mechanics: Are there any spelling or grammatical issues?
|
33
|
-
7. Feedback Alignment: Has the response addressed feedback from previous iterations?
|
34
|
-
|
35
|
-
For each criterion:
|
36
|
-
- Provide a rating (EXCELLENT, GOOD, FAIR, or POOR).
|
37
|
-
- Offer specific feedback or suggestions for improvement.
|
38
|
-
|
39
|
-
Summarize your evaluation as a structured response with:
|
40
|
-
- Overall quality rating.
|
41
|
-
- Specific feedback and areas for improvement.""",
|
42
|
-
model="gpt-4o",
|
43
|
-
)
|
44
|
-
# Define the evaluator-optimizer workflow
|
45
|
-
@fast.evaluator_optimizer(
|
46
|
-
name="cover_letter_writer",
|
47
|
-
generator="generator", # Reference to generator agent
|
48
|
-
evaluator="evaluator", # Reference to evaluator agent
|
49
|
-
min_rating="EXCELLENT", # Strive for excellence
|
50
|
-
max_refinements=3, # Maximum iterations
|
51
|
-
)
|
52
|
-
async def main():
|
53
|
-
async with fast.run() as agent:
|
54
|
-
job_posting = (
|
55
|
-
"Software Engineer at LastMile AI. Responsibilities include developing AI systems, "
|
56
|
-
"collaborating with cross-functional teams, and enhancing scalability. Skills required: "
|
57
|
-
"Python, distributed systems, and machine learning."
|
58
|
-
)
|
59
|
-
candidate_details = (
|
60
|
-
"Alex Johnson, 3 years in machine learning, contributor to open-source AI projects, "
|
61
|
-
"proficient in Python and TensorFlow. Motivated by building scalable AI systems to solve real-world problems."
|
62
|
-
)
|
63
|
-
company_information = (
|
64
|
-
"Look up from the LastMile AI About page: https://lastmileai.dev/about"
|
65
|
-
)
|
66
|
-
|
67
|
-
# Send the task
|
68
|
-
await agent.cover_letter_writer.send(
|
69
|
-
f"Write a cover letter for the following job posting: {job_posting}\n\n"
|
70
|
-
f"Candidate Details: {candidate_details}\n\n"
|
71
|
-
f"Company information: {company_information}",
|
72
|
-
)
|
73
|
-
|
74
|
-
await agent()
|
75
|
-
|
76
|
-
|
77
|
-
if __name__ == "__main__":
|
78
|
-
asyncio.run(main())
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# Please edit this configuration file to match your environment (on Windows).
|
2
|
-
# Examples in comments below - check/change the paths.
|
3
|
-
#
|
4
|
-
#
|
5
|
-
|
6
|
-
execution_engine: asyncio
|
7
|
-
logger:
|
8
|
-
type: file
|
9
|
-
level: error
|
10
|
-
truncate_tools: true
|
11
|
-
|
12
|
-
mcp:
|
13
|
-
servers:
|
14
|
-
filesystem:
|
15
|
-
# On windows update the command and arguments to use `node` and the absolute path to the server.
|
16
|
-
# Use `npm i -g @modelcontextprotocol/server-filesystem` to install the server globally.
|
17
|
-
# Use `npm -g root` to find the global node_modules path.`
|
18
|
-
# command: "node"
|
19
|
-
# args: ["c:/Program Files/nodejs/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js","."]
|
20
|
-
command: "npx"
|
21
|
-
args: ["-y", "@modelcontextprotocol/server-filesystem", "."]
|
22
|
-
fetch:
|
23
|
-
command: "uvx"
|
24
|
-
args: ["mcp-server-fetch"]
|
@@ -1,25 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Agent which demonstrates Human Input tool
|
3
|
-
"""
|
4
|
-
|
5
|
-
import asyncio
|
6
|
-
from mcp_agent.core.fastagent import FastAgent
|
7
|
-
|
8
|
-
# Create the application
|
9
|
-
fast = FastAgent("Human Input")
|
10
|
-
|
11
|
-
|
12
|
-
# Define the agent
|
13
|
-
@fast.agent(
|
14
|
-
instruction="An AI agent that assists with basic tasks. Request Human Input when needed.",
|
15
|
-
human_input=True,
|
16
|
-
)
|
17
|
-
async def main():
|
18
|
-
async with fast.run() as agent:
|
19
|
-
# this usually causes the LLM to request the Human Input Tool
|
20
|
-
await agent("print the next number in the sequence")
|
21
|
-
await agent.prompt(default="STOP")
|
22
|
-
|
23
|
-
|
24
|
-
if __name__ == "__main__":
|
25
|
-
asyncio.run(main())
|
@@ -1,73 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
This demonstrates creating multiple agents and an orchestrator to coordinate them.
|
3
|
-
"""
|
4
|
-
|
5
|
-
import asyncio
|
6
|
-
from mcp_agent.core.fastagent import FastAgent
|
7
|
-
|
8
|
-
# Create the application
|
9
|
-
fast = FastAgent("Orchestrator-Workers")
|
10
|
-
|
11
|
-
|
12
|
-
@fast.agent(
|
13
|
-
"author",
|
14
|
-
instruction="""You are to role play a poorly skilled writer,
|
15
|
-
who makes frequent grammar, punctuations and spelling errors. You enjoy
|
16
|
-
writing short stories, but the narrative doesn't always make sense""",
|
17
|
-
servers=["filesystem"],
|
18
|
-
)
|
19
|
-
# Define worker agents
|
20
|
-
@fast.agent(
|
21
|
-
name="finder",
|
22
|
-
instruction="""You are an agent with access to the filesystem,
|
23
|
-
as well as the ability to fetch URLs. Your job is to identify
|
24
|
-
the closest match to a user's request, make the appropriate tool calls,
|
25
|
-
and return the URI and CONTENTS of the closest match.""",
|
26
|
-
servers=["fetch", "filesystem"],
|
27
|
-
model="gpt-4o",
|
28
|
-
)
|
29
|
-
@fast.agent(
|
30
|
-
name="writer",
|
31
|
-
instruction="""You are an agent that can write to the filesystem.
|
32
|
-
You are tasked with taking the user's input, addressing it, and
|
33
|
-
writing the result to disk in the appropriate location.""",
|
34
|
-
servers=["filesystem"],
|
35
|
-
)
|
36
|
-
@fast.agent(
|
37
|
-
name="proofreader",
|
38
|
-
instruction=""""Review the short story for grammar, spelling, and punctuation errors.
|
39
|
-
Identify any awkward phrasing or structural issues that could improve clarity.
|
40
|
-
Provide detailed feedback on corrections.""",
|
41
|
-
servers=["fetch"],
|
42
|
-
model="gpt-4o",
|
43
|
-
)
|
44
|
-
# Define the orchestrator to coordinate the other agents
|
45
|
-
@fast.orchestrator(
|
46
|
-
name="orchestrate",
|
47
|
-
agents=["finder", "writer", "proofreader"],
|
48
|
-
plan_type="iterative",
|
49
|
-
)
|
50
|
-
async def main():
|
51
|
-
async with fast.run() as agent:
|
52
|
-
await agent()
|
53
|
-
await agent.author(
|
54
|
-
"write a 250 word short story about kittens discovering a castle, and save it to short_story.md"
|
55
|
-
)
|
56
|
-
|
57
|
-
# The orchestrator can be used just like any other agent
|
58
|
-
task = (
|
59
|
-
"""Load the student's short story from short_story.md,
|
60
|
-
and generate a report with feedback across proofreading,
|
61
|
-
factuality/logical consistency and style adherence. Use the style rules from
|
62
|
-
https://apastyle.apa.org/learn/quick-guide-on-formatting and
|
63
|
-
https://apastyle.apa.org/learn/quick-guide-on-references.
|
64
|
-
Write the graded report to graded_report.md in the same directory as short_story.md""",
|
65
|
-
)
|
66
|
-
|
67
|
-
# Send the task
|
68
|
-
await agent.orchestrate(task)
|
69
|
-
await agent()
|
70
|
-
|
71
|
-
|
72
|
-
if __name__ == "__main__":
|
73
|
-
asyncio.run(main())
|