Skip to content

Commit 7cb3760

Browse files
committed
2 parents abc2173 + ed52172 commit 7cb3760

File tree

73 files changed

+1610
-1124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1610
-1124
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
> [!TIP]
1313
> Documentation site is in production here : https://fast-agent.ai. Feel free to feed back what's helpful and what's not. llms.txt link is here: https://fast-agent.ai/llms.txt
1414
15-
**`fast-agent`** enables you to create and interact with sophisticated Agents and Workflows in minutes. It is the first framework with complete, end-to-end tested MCP Feature support including Sampling. Both Anthropic (Haiku, Sonnet, Opus) and OpenAI models (gpt-4o family, o1/o3 family) are supported.
15+
**`fast-agent`** enables you to create and interact with sophisticated Agents and Workflows in minutes. It is the first framework with complete, end-to-end tested MCP Feature support including Sampling. Both Anthropic (Haiku, Sonnet, Opus) and OpenAI models (gpt-4o/gpt-4.1 family, o1/o3 family) are supported.
1616

1717
The simple declarative syntax lets you concentrate on composing your Prompts and MCP Servers to [build effective agents](https://www.anthropic.com/research/building-effective-agents).
1818

1919
`fast-agent` is multi-modal, supporting Images and PDFs for both Anthropic and OpenAI endpoints via Prompts, Resources and MCP Tool Call results. The inclusion of passthrough and playback LLMs enable rapid development and test of Python glue-code for your applications.
2020

21-
> [!TIP] > `fast-agent` is now MCP Native! Coming Soon - Full Documentation Site and Further MCP Examples.
21+
> [!TIP]
22+
> `fast-agent` is now MCP Native! Coming Soon - Full Documentation Site and Further MCP Examples.
2223
2324
### Agent Application Development
2425

@@ -70,7 +71,7 @@ Or start an interactive chat with the Agent:
7071

7172
```python
7273
async with fast.run() as agent:
73-
await agent()
74+
await agent.interactive()
7475
```
7576

7677
Here is the complete `sizer.py` Agent application, with boilerplate code:
@@ -87,7 +88,7 @@ fast = FastAgent("Agent Example")
8788
)
8889
async def main():
8990
async with fast.run() as agent:
90-
await agent()
91+
await agent.interactive()
9192

9293
if __name__ == "__main__":
9394
asyncio.run(main())

examples/data-analysis/analysis-campaign.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
- Extracted compelling insights suitable for social media promotion
3434
""",
3535
request_params=RequestParams(maxTokens=8192),
36-
model="gpt-4o",
36+
model="gpt-4.1",
3737
)
3838
@fast.evaluator_optimizer(
3939
"analysis_tool",
@@ -55,7 +55,7 @@
5555
""",
5656
servers=["fetch", "brave"], # Using the fetch MCP server for Brave search
5757
request_params=RequestParams(temperature=0.3),
58-
model="gpt-4o",
58+
model="gpt-4.1",
5959
)
6060
# Social media content generator
6161
@fast.agent(

examples/mcp/state-transfer/fastagent.config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Check here for current details: https://fast-agent.ai/models/
66

77
# set the default model for fast-agent below:
8-
default_model: gpt-4o
8+
default_model: gpt-4.1
99

1010
# Logging and Console Configuration:
1111
logger:

examples/researcher/fastagent.config.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#
55
#
66

7-
execution_engine: asyncio
87
logger:
98
type: console
109
level: error
@@ -53,14 +52,10 @@ mcp:
5352
args: ["mcp-server-fetch"]
5453
sequential:
5554
command: "npx"
56-
args: ["-y","@modelcontextprotocol/server-sequential-thinking"]
57-
55+
args: ["-y", "@modelcontextprotocol/server-sequential-thinking"]
5856
# webmcp:
5957
# command: "node"
6058
# args: ["/home/ssmith/.webmcp/server.cjs"]
6159
# env:
6260
# WEBMCP_SERVER_TOKEN: 96e22896d8143fc1d61fec09208fc5ed
6361

64-
65-
66-

examples/workflows/evaluator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
Summarize your evaluation as a structured response with:
4141
- Overall quality rating.
4242
- Specific feedback and areas for improvement.""",
43-
model="gpt-4o",
43+
model="gpt-4.1",
4444
)
4545
# Define the evaluator-optimizer workflow
4646
@fast.evaluator_optimizer(

examples/workflows/fastagent.config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#
44
#
55

6-
execution_engine: asyncio
76
logger:
87
type: file
98
level: error

examples/workflows/orchestrator.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@fast.agent(
1414
"author",
1515
instruction="""You are to role play a poorly skilled writer,
16-
who makes frequent grammar, punctuations and spelling errors. You enjoy
16+
who makes frequent grammar, punctuation and spelling errors. You enjoy
1717
writing short stories, but the narrative doesn't always make sense""",
1818
servers=["filesystem"],
1919
)
@@ -25,7 +25,7 @@
2525
the closest match to a user's request, make the appropriate tool calls,
2626
and return the URI and CONTENTS of the closest match.""",
2727
servers=["fetch", "filesystem"],
28-
model="gpt-4o",
28+
model="gpt-4.1",
2929
)
3030
@fast.agent(
3131
name="writer",
@@ -40,19 +40,17 @@
4040
Identify any awkward phrasing or structural issues that could improve clarity.
4141
Provide detailed feedback on corrections.""",
4242
servers=["fetch"],
43-
model="gpt-4o",
43+
model="gpt-4.1",
4444
)
4545
# Define the orchestrator to coordinate the other agents
4646
@fast.orchestrator(
47-
name="orchestrate",
48-
agents=["finder", "writer", "proofreader"],
49-
plan_type="full",
47+
name="orchestrate", agents=["finder", "writer", "proofreader"], plan_type="full", model="sonnet"
5048
)
5149
async def main() -> None:
5250
async with fast.run() as 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-
)
51+
# await agent.author(
52+
# "write a 250 word short story about kittens discovering a castle, and save it to short_story.md"
53+
# )
5654

5755
# The orchestrator can be used just like any other agent
5856
task = """Load the student's short story from short_story.md,

examples/workflows/parallel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
instruction="""Verify the factual consistency within the story. Identify any contradictions,
2626
logical inconsistencies, or inaccuracies in the plot, character actions, or setting.
2727
Highlight potential issues with reasoning or coherence.""",
28-
model="gpt-4o",
28+
model="gpt-4.1",
2929
)
3030
@fast.agent(
3131
name="style_enforcer",

fastagent.config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Please edit this configuration file to match your environment (on Windows).
22
# Examples in comments below - check/change the paths.
3-
#
4-
#
5-
6-
execution_engine: asyncio
73
logger:
84
type: file
95
level: error

pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "fast-agent-mcp"
3-
version = "0.2.16"
3+
version = "0.2.17"
44
description = "Define, Prompt and Test MCP enabled Agents and Workflows"
55
readme = "README.md"
66
license = { file = "LICENSE" }
@@ -34,9 +34,6 @@ dependencies = [
3434
]
3535

3636
[project.optional-dependencies]
37-
temporal = [
38-
"temporalio>=1.8.0",
39-
]
4037
openai = [
4138
"openai>=1.58.1",
4239
]

schema/mcp-agent.config.schema.json

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -589,42 +589,6 @@
589589
},
590590
"title": "OpenTelemetrySettings",
591591
"type": "object"
592-
},
593-
"TemporalSettings": {
594-
"description": "Temporal settings for the fast-agent application.",
595-
"properties": {
596-
"host": {
597-
"title": "Host",
598-
"type": "string"
599-
},
600-
"namespace": {
601-
"default": "default",
602-
"title": "Namespace",
603-
"type": "string"
604-
},
605-
"task_queue": {
606-
"title": "Task Queue",
607-
"type": "string"
608-
},
609-
"api_key": {
610-
"anyOf": [
611-
{
612-
"type": "string"
613-
},
614-
{
615-
"type": "null"
616-
}
617-
],
618-
"default": null,
619-
"title": "Api Key"
620-
}
621-
},
622-
"required": [
623-
"host",
624-
"task_queue"
625-
],
626-
"title": "TemporalSettings",
627-
"type": "object"
628592
}
629593
},
630594
"additionalProperties": true,
@@ -647,8 +611,7 @@
647611
"execution_engine": {
648612
"default": "asyncio",
649613
"enum": [
650-
"asyncio",
651-
"temporal"
614+
"asyncio"
652615
],
653616
"title": "Execution Engine",
654617
"type": "string",
@@ -666,18 +629,6 @@
666629
"default": "haiku",
667630
"title": "Default Model"
668631
},
669-
"temporal": {
670-
"anyOf": [
671-
{
672-
"$ref": "#/$defs/TemporalSettings"
673-
},
674-
{
675-
"type": "null"
676-
}
677-
],
678-
"default": null,
679-
"description": "Settings for Temporal workflow orchestration"
680-
},
681632
"anthropic": {
682633
"anyOf": [
683634
{
@@ -776,4 +727,4 @@
776727
"title": "MCP Agent Configuration Schema",
777728
"type": "object",
778729
"$schema": "http://json-schema.org/draft-07/schema#"
779-
}
730+
}

src/mcp_agent/agents/base_agent.py

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
Union,
2121
)
2222

23+
from a2a_types.types import AgentCapabilities, AgentCard, AgentSkill
2324
from mcp.types import (
2425
CallToolResult,
2526
EmbeddedResource,
@@ -58,6 +59,11 @@
5859
from mcp_agent.context import Context
5960

6061

62+
DEFAULT_CAPABILITIES = AgentCapabilities(
63+
streaming=False, pushNotifications=False, stateTransitionHistory=False
64+
)
65+
66+
6167
class BaseAgent(MCPAggregator, AgentProtocol):
6268
"""
6369
A base Agent class that implements the AgentProtocol interface.
@@ -586,7 +592,7 @@ async def generate(
586592

587593
async def structured(
588594
self,
589-
prompt: List[PromptMessageMultipart],
595+
multipart_messages: List[PromptMessageMultipart],
590596
model: Type[ModelT],
591597
request_params: RequestParams | None = None,
592598
) -> Tuple[ModelT | None, PromptMessageMultipart]:
@@ -603,7 +609,7 @@ async def structured(
603609
An instance of the specified model, or None if coercion fails
604610
"""
605611
assert self._llm
606-
return await self._llm.structured(prompt, model, request_params)
612+
return await self._llm.structured(multipart_messages, model, request_params)
607613

608614
async def apply_prompt_messages(
609615
self, prompts: List[PromptMessageMultipart], request_params: RequestParams | None = None
@@ -626,13 +632,51 @@ async def apply_prompt_messages(
626632
def agent_type(self) -> AgentType:
627633
"""
628634
Return the type of this agent.
635+
"""
636+
return AgentType.BASIC
637+
638+
async def agent_card(self) -> AgentCard:
639+
"""
640+
Return an A2A card describing this Agent
641+
"""
629642

630-
This is used for display purposes in the interactive prompt and other UI elements.
643+
skills: List[AgentSkill] = []
644+
tools: ListToolsResult = await self.list_tools()
645+
for tool in tools.tools:
646+
skills.append(await self.convert(tool))
631647

632-
Returns:
633-
String representing the agent type
648+
return AgentCard(
649+
name=self.name,
650+
description=self.instruction,
651+
url=f"fast-agent://agents/{self.name}/",
652+
version="0.1",
653+
capabilities=DEFAULT_CAPABILITIES,
654+
defaultInputModes=["text/plain"],
655+
defaultOutputModes=["text/plain"],
656+
provider=None,
657+
documentationUrl=None,
658+
authentication=None,
659+
skills=skills,
660+
)
661+
662+
async def convert(self, tool: Tool) -> AgentSkill:
634663
"""
635-
return AgentType.BASIC
664+
Convert a Tool to an AgentSkill.
665+
"""
666+
667+
_, tool_without_namespace = await self._parse_resource_name(tool.name, "tool")
668+
return AgentSkill(
669+
id=tool.name,
670+
name=tool_without_namespace,
671+
description=tool.description,
672+
tags=["tool"],
673+
examples=None,
674+
inputModes=None, # ["text/plain"],
675+
# cover TextContent | ImageContent ->
676+
# https://github.com/modelcontextprotocol/modelcontextprotocol/pull/223
677+
# https://github.com/modelcontextprotocol/modelcontextprotocol/pull/93
678+
outputModes=None, # ,["text/plain", "image/*"],
679+
)
636680

637681
@property
638682
def message_history(self) -> List[PromptMessageMultipart]:

0 commit comments

Comments
 (0)