fast-agent-mcp 0.2.36__py3-none-any.whl → 0.2.37__py3-none-any.whl

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

Potentially problematic release.


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

Files changed (64) hide show
  1. {fast_agent_mcp-0.2.36.dist-info → fast_agent_mcp-0.2.37.dist-info}/METADATA +10 -7
  2. {fast_agent_mcp-0.2.36.dist-info → fast_agent_mcp-0.2.37.dist-info}/RECORD +46 -47
  3. {fast_agent_mcp-0.2.36.dist-info → fast_agent_mcp-0.2.37.dist-info}/licenses/LICENSE +1 -1
  4. mcp_agent/cli/commands/quickstart.py +59 -5
  5. mcp_agent/config.py +10 -0
  6. mcp_agent/context.py +1 -4
  7. mcp_agent/core/agent_types.py +7 -6
  8. mcp_agent/core/direct_decorators.py +14 -0
  9. mcp_agent/core/direct_factory.py +1 -0
  10. mcp_agent/core/fastagent.py +23 -2
  11. mcp_agent/human_input/elicitation_form.py +723 -0
  12. mcp_agent/human_input/elicitation_forms.py +59 -0
  13. mcp_agent/human_input/elicitation_handler.py +88 -0
  14. mcp_agent/human_input/elicitation_state.py +34 -0
  15. mcp_agent/llm/providers/augmented_llm_google_native.py +4 -2
  16. mcp_agent/llm/providers/augmented_llm_openai.py +1 -1
  17. mcp_agent/mcp/elicitation_factory.py +84 -0
  18. mcp_agent/mcp/elicitation_handlers.py +155 -0
  19. mcp_agent/mcp/helpers/content_helpers.py +27 -0
  20. mcp_agent/mcp/helpers/server_config_helpers.py +10 -8
  21. mcp_agent/mcp/mcp_agent_client_session.py +44 -1
  22. mcp_agent/mcp/mcp_aggregator.py +56 -11
  23. mcp_agent/mcp/mcp_connection_manager.py +30 -18
  24. mcp_agent/mcp_server/agent_server.py +2 -0
  25. mcp_agent/mcp_server_registry.py +16 -8
  26. mcp_agent/resources/examples/data-analysis/analysis.py +1 -2
  27. mcp_agent/resources/examples/mcp/elicitations/README.md +157 -0
  28. mcp_agent/resources/examples/mcp/elicitations/elicitation_account_server.py +88 -0
  29. mcp_agent/resources/examples/mcp/elicitations/elicitation_forms_server.py +232 -0
  30. mcp_agent/resources/examples/mcp/elicitations/elicitation_game_server.py +164 -0
  31. mcp_agent/resources/examples/mcp/elicitations/fastagent.config.yaml +35 -0
  32. mcp_agent/resources/examples/mcp/elicitations/fastagent.secrets.yaml.example +17 -0
  33. mcp_agent/resources/examples/mcp/elicitations/forms_demo.py +111 -0
  34. mcp_agent/resources/examples/mcp/elicitations/game_character.py +65 -0
  35. mcp_agent/resources/examples/mcp/elicitations/game_character_handler.py +256 -0
  36. mcp_agent/resources/examples/{prompting/agent.py → mcp/elicitations/tool_call.py} +4 -5
  37. mcp_agent/resources/examples/mcp/state-transfer/agent_two.py +1 -1
  38. mcp_agent/resources/examples/mcp/state-transfer/fastagent.config.yaml +1 -1
  39. mcp_agent/resources/examples/mcp/state-transfer/fastagent.secrets.yaml.example +1 -0
  40. mcp_agent/resources/examples/workflows/evaluator.py +1 -1
  41. mcp_agent/resources/examples/workflows/graded_report.md +89 -0
  42. mcp_agent/resources/examples/workflows/orchestrator.py +7 -9
  43. mcp_agent/resources/examples/workflows/parallel.py +0 -2
  44. mcp_agent/resources/examples/workflows/short_story.md +13 -0
  45. mcp_agent/resources/examples/in_dev/agent_build.py +0 -84
  46. mcp_agent/resources/examples/in_dev/css-LICENSE.txt +0 -21
  47. mcp_agent/resources/examples/in_dev/slides.py +0 -110
  48. mcp_agent/resources/examples/internal/agent.py +0 -20
  49. mcp_agent/resources/examples/internal/fastagent.config.yaml +0 -66
  50. mcp_agent/resources/examples/internal/history_transfer.py +0 -35
  51. mcp_agent/resources/examples/internal/job.py +0 -84
  52. mcp_agent/resources/examples/internal/prompt_category.py +0 -21
  53. mcp_agent/resources/examples/internal/prompt_sizing.py +0 -51
  54. mcp_agent/resources/examples/internal/simple.txt +0 -2
  55. mcp_agent/resources/examples/internal/sizer.py +0 -20
  56. mcp_agent/resources/examples/internal/social.py +0 -67
  57. mcp_agent/resources/examples/prompting/__init__.py +0 -3
  58. mcp_agent/resources/examples/prompting/delimited_prompt.txt +0 -14
  59. mcp_agent/resources/examples/prompting/fastagent.config.yaml +0 -43
  60. mcp_agent/resources/examples/prompting/image_server.py +0 -52
  61. mcp_agent/resources/examples/prompting/prompt1.txt +0 -6
  62. mcp_agent/resources/examples/prompting/work_with_image.py +0 -19
  63. {fast_agent_mcp-0.2.36.dist-info → fast_agent_mcp-0.2.37.dist-info}/WHEEL +0 -0
  64. {fast_agent_mcp-0.2.36.dist-info → fast_agent_mcp-0.2.37.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,256 @@
1
+ """
2
+ Custom Elicitation Handler for Game Character Creation
3
+
4
+ This module provides a whimsical custom elicitation handler that creates
5
+ an interactive game character creation experience with dice rolls,
6
+ visual gauges, and animated effects.
7
+ """
8
+
9
+ import asyncio
10
+ import random
11
+ from typing import TYPE_CHECKING, Any, Dict
12
+
13
+ from mcp.shared.context import RequestContext
14
+ from mcp.types import ElicitRequestParams, ElicitResult
15
+ from rich.console import Console
16
+ from rich.progress import BarColumn, Progress, TextColumn
17
+ from rich.prompt import Confirm
18
+ from rich.table import Table
19
+
20
+ from mcp_agent.logging.logger import get_logger
21
+
22
+ if TYPE_CHECKING:
23
+ from mcp import ClientSession
24
+
25
+ logger = get_logger(__name__)
26
+ console = Console()
27
+
28
+
29
+ async def game_character_elicitation_handler(
30
+ context: RequestContext["ClientSession", Any],
31
+ params: ElicitRequestParams,
32
+ ) -> ElicitResult:
33
+ """Custom handler that creates an interactive character creation experience."""
34
+ logger.info(f"Game character elicitation handler called: {params.message}")
35
+
36
+ if params.requestedSchema:
37
+ properties = params.requestedSchema.get("properties", {})
38
+ content: Dict[str, Any] = {}
39
+
40
+ console.print("\n[bold magenta]🎮 Character Creation Studio 🎮[/bold magenta]\n")
41
+
42
+ # Character name with typewriter effect
43
+ if "character_name" in properties:
44
+ console.print("[cyan]✨ Generating your character's name...[/cyan] ", end="")
45
+ name_prefixes = ["Hero", "Legend", "Epic", "Mighty", "Brave", "Noble"]
46
+ name_suffixes = ["blade", "heart", "storm", "fire", "shadow", "star"]
47
+
48
+ name = f"{random.choice(name_prefixes)}{random.choice(name_suffixes)}{random.randint(1, 999)}"
49
+
50
+ for char in name:
51
+ console.print(char, end="", style="bold green")
52
+ await asyncio.sleep(0.03)
53
+ console.print("\n")
54
+ content["character_name"] = name
55
+
56
+ # Class selection with visual menu and fate dice
57
+ if "character_class" in properties:
58
+ class_enum = properties["character_class"].get("enum", [])
59
+ class_names = properties["character_class"].get("enumNames", class_enum)
60
+
61
+ table = Table(title="🎯 Choose Your Destiny", show_header=False, box=None)
62
+ table.add_column("Option", style="cyan", width=8)
63
+ table.add_column("Class", style="yellow", width=20)
64
+ table.add_column("Description", style="dim", width=30)
65
+
66
+ descriptions = [
67
+ "Master of sword and shield",
68
+ "Wielder of arcane mysteries",
69
+ "Silent shadow striker",
70
+ "Nature's deadly archer",
71
+ "Holy warrior of light",
72
+ "Inspiring magical performer",
73
+ ]
74
+
75
+ for i, (cls, name, desc) in enumerate(zip(class_enum, class_names, descriptions)):
76
+ table.add_row(f"[{i + 1}]", name, desc)
77
+
78
+ console.print(table)
79
+
80
+ # Dramatic fate dice roll
81
+ console.print("\n[bold yellow]🎲 The Fates decide your path...[/bold yellow]")
82
+ for _ in range(8):
83
+ dice_face = random.choice(["⚀", "⚁", "⚂", "⚃", "⚄", "⚅"])
84
+ console.print(f"\r Rolling... {dice_face}", end="")
85
+ await asyncio.sleep(0.2)
86
+
87
+ fate_roll = random.randint(1, 6)
88
+ selected_idx = (fate_roll - 1) % len(class_enum)
89
+ console.print(f"\n 🎲 Fate dice: [bold red]{fate_roll}[/bold red]!")
90
+ console.print(
91
+ f"✨ Destiny has chosen: [bold yellow]{class_names[selected_idx]}[/bold yellow]!\n"
92
+ )
93
+ content["character_class"] = class_enum[selected_idx]
94
+
95
+ # Stats rolling with animated progress bars and cosmic effects
96
+ stat_names = ["strength", "intelligence", "dexterity", "charisma"]
97
+ stats_info = {
98
+ "strength": {"emoji": "💪", "desc": "Physical power"},
99
+ "intelligence": {"emoji": "🧠", "desc": "Mental acuity"},
100
+ "dexterity": {"emoji": "🏃", "desc": "Agility & speed"},
101
+ "charisma": {"emoji": "✨", "desc": "Personal magnetism"},
102
+ }
103
+
104
+ console.print("[bold]🌟 Rolling cosmic dice for your abilities...[/bold]\n")
105
+
106
+ with Progress(
107
+ TextColumn("[progress.description]{task.description}"),
108
+ BarColumn(bar_width=25, style="cyan", complete_style="green"),
109
+ TextColumn("[progress.percentage]{task.percentage:>3.0f}%"),
110
+ console=console,
111
+ ) as progress:
112
+ for stat in stat_names:
113
+ if stat in properties:
114
+ # Roll 3d6 for classic D&D feel with bonus potential
115
+ rolls = [random.randint(1, 6) for _ in range(3)]
116
+ total = sum(rolls)
117
+
118
+ # Add cosmic bonus chance
119
+ if random.random() < 0.15: # 15% chance for cosmic boost
120
+ cosmic_bonus = random.randint(1, 3)
121
+ total = min(18, total + cosmic_bonus)
122
+ cosmic_text = f" ✨+{cosmic_bonus} COSMIC✨"
123
+ else:
124
+ cosmic_text = ""
125
+
126
+ stat_info = stats_info.get(stat, {"emoji": "📊", "desc": stat.title()})
127
+ task = progress.add_task(
128
+ f"{stat_info['emoji']} {stat.capitalize()}: {stat_info['desc']}", total=18
129
+ )
130
+
131
+ # Animate the progress bar with suspense
132
+ for i in range(total + 1):
133
+ progress.update(task, completed=i)
134
+ await asyncio.sleep(0.04)
135
+
136
+ content[stat] = total
137
+ console.print(
138
+ f" 🎲 Rolled: {rolls} = [bold green]{total}[/bold green]{cosmic_text}"
139
+ )
140
+
141
+ # Lucky dice legendary challenge
142
+ if "lucky_dice" in properties:
143
+ console.print("\n" + "=" * 60)
144
+ console.print("[bold yellow]🎰 LEGENDARY CHALLENGE: Lucky Dice! 🎰[/bold yellow]")
145
+ console.print("The ancient dice of fortune whisper your name...")
146
+ console.print("Do you dare tempt fate for legendary power?")
147
+ console.print("=" * 60)
148
+
149
+ # Epic dice rolling sequence
150
+ console.print("\n[cyan]🌟 Rolling the Dice of Destiny...[/cyan]")
151
+
152
+ for i in range(15):
153
+ dice_faces = ["⚀", "⚁", "⚂", "⚃", "⚄", "⚅"]
154
+ d20_faces = ["🎲"] * 19 + ["💎"] # Special diamond for 20
155
+
156
+ if i < 10:
157
+ face = random.choice(dice_faces)
158
+ else:
159
+ face = random.choice(d20_faces)
160
+
161
+ console.print(f"\r [bold]{face}[/bold] Rolling...", end="")
162
+ await asyncio.sleep(0.15)
163
+
164
+ final_roll = random.randint(1, 20)
165
+
166
+ if final_roll == 20:
167
+ console.print("\r [bold red]💎 NATURAL 20! 💎[/bold red]")
168
+ console.print(" [bold green]🌟 LEGENDARY SUCCESS! 🌟[/bold green]")
169
+ console.print(" [gold1]You have been blessed by the gods themselves![/gold1]")
170
+ bonus_text = "🏆 Divine Champion status unlocked!"
171
+ elif final_roll >= 18:
172
+ console.print(f"\r [bold yellow]⭐ {final_roll} - EPIC ROLL! ⭐[/bold yellow]")
173
+ bonus_text = "🎁 Epic treasure discovered!"
174
+ elif final_roll >= 15:
175
+ console.print(f"\r [green]🎲 {final_roll} - Great success![/green]")
176
+ bonus_text = "🌟 Rare magical item found!"
177
+ elif final_roll >= 10:
178
+ console.print(f"\r [yellow]🎲 {final_roll} - Good fortune.[/yellow]")
179
+ bonus_text = "🗡️ Modest blessing received."
180
+ elif final_roll == 1:
181
+ console.print("\r [bold red]💀 CRITICAL FUMBLE! 💀[/bold red]")
182
+ bonus_text = "😅 Learning experience gained... try again!"
183
+ else:
184
+ console.print(f"\r [dim]🎲 {final_roll} - The dice are silent.[/dim]")
185
+ bonus_text = "🎯 Your destiny remains unwritten."
186
+
187
+ console.print(f" [italic]{bonus_text}[/italic]")
188
+ content["lucky_dice"] = final_roll >= 10
189
+
190
+ # Epic character summary with theatrical flair
191
+ console.print("\n" + "=" * 70)
192
+ console.print("[bold cyan]📜 Your Character Has Been Rolled! 📜[/bold cyan]")
193
+ console.print("=" * 70)
194
+
195
+ # Show character summary
196
+ total_stats = sum(content.get(stat, 10) for stat in stat_names if stat in content)
197
+
198
+ # Create a simple table
199
+ stats_table = Table(show_header=False, box=None)
200
+ stats_table.add_column("Label", style="cyan", width=15)
201
+ stats_table.add_column("Value", style="bold white")
202
+
203
+ if "character_name" in content:
204
+ stats_table.add_row("Name:", content["character_name"])
205
+ if "character_class" in content:
206
+ class_idx = class_enum.index(content["character_class"])
207
+ stats_table.add_row("Class:", class_names[class_idx])
208
+
209
+ stats_table.add_row("", "") # Empty row for spacing
210
+
211
+ # Add stats
212
+ for stat in stat_names:
213
+ if stat in content:
214
+ stat_label = f"{stat.capitalize()}:"
215
+ stats_table.add_row(stat_label, str(content[stat]))
216
+
217
+ stats_table.add_row("", "")
218
+ stats_table.add_row("Total Power:", str(total_stats))
219
+
220
+ console.print(stats_table)
221
+
222
+ # Power message
223
+ if total_stats > 60:
224
+ console.print("✨ [bold gold1]The realm trembles before your might![/bold gold1] ✨")
225
+ elif total_stats > 50:
226
+ console.print("⚔️ [bold green]A formidable hero rises![/bold green] ⚔️")
227
+ elif total_stats < 35:
228
+ console.print("🎯 [bold blue]The underdog's tale begins![/bold blue] 🎯")
229
+ else:
230
+ console.print("🗡️ [bold white]Adventure awaits the worthy![/bold white] 🗡️")
231
+
232
+ # Ask for confirmation
233
+ console.print("\n[bold yellow]Do you accept this character?[/bold yellow]")
234
+ console.print("[dim]Press Enter to accept, 'n' to decline, or Ctrl+C to cancel[/dim]\n")
235
+
236
+ try:
237
+ accepted = Confirm.ask("Accept character?", default=True)
238
+
239
+ if accepted:
240
+ console.print(
241
+ "\n[bold green]✅ Character accepted! Your adventure begins![/bold green]"
242
+ )
243
+ return ElicitResult(action="accept", content=content)
244
+ else:
245
+ console.print(
246
+ "\n[yellow]❌ Character declined. The fates will roll again...[/yellow]"
247
+ )
248
+ return ElicitResult(action="decline")
249
+ except KeyboardInterrupt:
250
+ console.print("\n[red]❌ Character creation cancelled![/red]")
251
+ return ElicitResult(action="cancel")
252
+
253
+ else:
254
+ # No schema, return a fun message
255
+ content = {"response": "⚔️ Ready for adventure! ⚔️"}
256
+ return ElicitResult(action="accept", content=content)
@@ -3,19 +3,18 @@ import asyncio
3
3
  from mcp_agent.core.fastagent import FastAgent
4
4
 
5
5
  # Create the application
6
- fast = FastAgent("FastAgent Example")
6
+ fast = FastAgent("fast-agent example")
7
7
 
8
8
 
9
9
  # Define the agent
10
10
  @fast.agent(
11
- "agent",
12
11
  instruction="You are a helpful AI Agent",
13
- servers=["prompts"], # , "imgetage", "hfspace"],
12
+ servers=["elicitation_account_server"],
14
13
  )
15
- async def main() -> None:
14
+ async def main():
16
15
  # use the --model command line switch or agent arguments to change model
17
16
  async with fast.run() as agent:
18
- await agent()
17
+ await agent.send('***CALL_TOOL create_user_account {"service_name": "fast-agent"}')
19
18
 
20
19
 
21
20
  if __name__ == "__main__":
@@ -3,7 +3,7 @@ import asyncio
3
3
  from mcp_agent.core.fastagent import FastAgent
4
4
 
5
5
  # Create the application
6
- fast = FastAgent("fast-agent agent_two (mcp host)")
6
+ fast = FastAgent("fast-agent agent_two (mcp client)")
7
7
 
8
8
 
9
9
  # Define the agent
@@ -9,7 +9,7 @@ default_model: gpt-4.1
9
9
 
10
10
  # Logging and Console Configuration:
11
11
  logger:
12
- # Switched off to avoid cluttering the console
12
+ # Switched off to avoid polluting the console
13
13
  progress_display: false
14
14
 
15
15
  # Show chat User/Assistant messages on the console
@@ -12,3 +12,4 @@ deepseek:
12
12
  api_key: <your-api-key-here>
13
13
  openrouter:
14
14
  api_key: <your-api-key-here>
15
+
@@ -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="gpt-4o",
43
+ model="gpt-4.1",
44
44
  )
45
45
  # Define the evaluator-optimizer workflow
46
46
  @fast.evaluator_optimizer(
@@ -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.
@@ -13,7 +13,7 @@ fast = FastAgent("Orchestrator-Workers")
13
13
  @fast.agent(
14
14
  "author",
15
15
  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
17
17
  writing short stories, but the narrative doesn't always make sense""",
18
18
  servers=["filesystem"],
19
19
  )
@@ -25,7 +25,7 @@ fast = FastAgent("Orchestrator-Workers")
25
25
  the closest match to a user's request, make the appropriate tool calls,
26
26
  and return the URI and CONTENTS of the closest match.""",
27
27
  servers=["fetch", "filesystem"],
28
- model="gpt-4o",
28
+ model="gpt-4.1",
29
29
  )
30
30
  @fast.agent(
31
31
  name="writer",
@@ -40,19 +40,17 @@ fast = FastAgent("Orchestrator-Workers")
40
40
  Identify any awkward phrasing or structural issues that could improve clarity.
41
41
  Provide detailed feedback on corrections.""",
42
42
  servers=["fetch"],
43
- model="gpt-4o",
43
+ model="gpt-4.1",
44
44
  )
45
45
  # Define the orchestrator to coordinate the other agents
46
46
  @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"
50
48
  )
51
49
  async def main() -> None:
52
50
  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
+ # )
56
54
 
57
55
  # The orchestrator can be used just like any other agent
58
56
  task = """Load the student's short story from short_story.md,
@@ -25,7 +25,6 @@ fast = FastAgent(
25
25
  instruction="""Verify the factual consistency within the story. Identify any contradictions,
26
26
  logical inconsistencies, or inaccuracies in the plot, character actions, or setting.
27
27
  Highlight potential issues with reasoning or coherence.""",
28
- model="gpt-4.1-mini",
29
28
  )
30
29
  @fast.agent(
31
30
  name="style_enforcer",
@@ -40,7 +39,6 @@ fast = FastAgent(
40
39
  into a structured report. Summarize key issues and categorize them by type.
41
40
  Provide actionable recommendations for improving the story,
42
41
  and give an overall grade based on the feedback.""",
43
- model="o3-mini.low",
44
42
  )
45
43
  @fast.parallel(
46
44
  fan_out=["proofreader", "fact_checker", "style_enforcer"],
@@ -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??
@@ -1,84 +0,0 @@
1
- """
2
- This demonstrates creating multiple agents and an orchestrator to coordinate them.
3
- """
4
-
5
- import asyncio
6
-
7
- from mcp_agent.core.fastagent import FastAgent
8
- from mcp_agent.llm.augmented_llm import RequestParams
9
-
10
- # Create the application
11
- fast = FastAgent("Agent Builder")
12
-
13
-
14
- @fast.agent(
15
- "agent_expert",
16
- instruction="""
17
- You design agent workflows, adhering to 'Building Effective Agents' (details to follow).
18
-
19
- You provide concise specific guidance on design and composition. Prefer simple solutions,
20
- and don't nest workflows more than one level deep.
21
-
22
- Your objective is to produce a single '.py' agent in the style of the examples.
23
-
24
- Keep the application simple, concentrationg on defining Agent instructions, MCP Servers and
25
- appropriate use of Workflows.
26
-
27
- The style of the program should be like the examples you have been shown, with a minimum of
28
- additional code, using only very simple Python where absolutely necessary.
29
-
30
- Concentrate on the quality of the Agent instructions and "warmup" prompts given to them.
31
-
32
- Keep requirements minimal: focus on building the prompts and the best workflow. The program
33
- is expected to be adjusted and refined later.
34
-
35
- If you are unsure about how to proceed, request input from the Human.
36
-
37
- Use the filesystem tools to save your completed fastagent program, in an appropriately named '.py' file.
38
-
39
- """,
40
- servers=["filesystem", "fetch"],
41
- request_params=RequestParams(maxTokens=8192),
42
- )
43
- # Define worker agents
44
- @fast.agent(
45
- "requirements_capture",
46
- instruction="""
47
- You help the Human define their requirements for building Agent based systems.
48
-
49
- Keep questions short, simple and minimal, always offering to complete the questioning
50
- if desired. If uncertain about something, respond asking the 'agent_expert' for guidance.
51
-
52
- Do not interrogate the Human, prefer to move the process on, as more details can be requested later
53
- if needed. Remind the Human of this.
54
- """,
55
- human_input=True,
56
- )
57
- # Define the orchestrator to coordinate the other agents
58
- @fast.orchestrator(
59
- name="agent_builder",
60
- agents=["agent_expert", "requirements_capture"],
61
- model="sonnet",
62
- plan_type="iterative",
63
- request_params=RequestParams(maxTokens=8192),
64
- plan_iterations=5,
65
- )
66
- async def main() -> None:
67
- async with fast.run() as agent:
68
- CODER_WARMUP = """
69
- - Read this paper: https://www.anthropic.com/research/building-effective-agents" to understand how
70
- and when to use different types of Agents and Workflow types.
71
-
72
- - Read this README https://raw.githubusercontent.com/evalstate/fast-agent/refs/heads/main/README.md file
73
- to see how to use "fast-agent" framework.
74
-
75
- - Look at the 'fastagent.config.yaml' file to see the available and configured MCP Servers.
76
-
77
- """
78
- await agent.agent_expert(CODER_WARMUP)
79
-
80
- await agent.agent_builder()
81
-
82
-
83
- if __name__ == "__main__":
84
- asyncio.run(main())
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021-2024 Paulo Cunha
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.