Skip to content
Back to search

fast-agent

Code, Build and Evaluate agents - excellent Model and Skills/MCP/ACP/A2A Support

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/evalstate/fast-agent with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/evalstate/fast-agent'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/evalstate--fast-agent/badge.svg)](/listings/evalstate--fast-agent)

HTML

<a href="/listings/evalstate--fast-agent"><img src="/api/listings/evalstate--fast-agent/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 716 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. <p align="center">
  2. <a href="https://pypi.org/project/fast-agent-mcp/"><img src="https://img.shields.io/pypi/v/fast-agent-mcp?color=%2334D058&label=pypi" /></a>
  3. <a href="#"><img src="https://github.com/evalstate/fast-agent/actions/workflows/main-checks.yml/badge.svg" /></a>
  4. <a href="https://github.com/evalstate/fast-agent/issues"><img src="https://img.shields.io/github/issues-raw/evalstate/fast-agent" /></a>
  5. <a href="https://discord.gg/xg5cJ7ndN6"><img src="https://img.shields.io/discord/1358470293990936787" alt="discord" /></a>
  6. <img alt="Pepy Total Downloads" src="https://img.shields.io/pepy/dt/fast-agent-mcp?label=pypi%20%7C%20downloads"/>
  7. <a href="https://github.com/evalstate/fast-agent-mcp/blob/main/LICENSE"><img src="https://img.shields.io/pypi/l/fast-agent-mcp" /></a>
  8. </p>
  9. ## Start Here
  10. > [!TIP]
  11. > Please see https://fast-agent.ai for latest documentation.
  12. **`fast-agent`** is a flexible way to interact with LLMs, excellent for use as a Coding Agent, Development Toolkit, Evaluation or Workflow platform.
  13. To start an interactive session with shell support, install [uv](https://astral.sh/uv) and run
  14. ```bash
  15. uvx fast-agent-mcp@latest -x
  16. ```
  17. To start coding with Hugging Face inference providers or use your OpenAI Codex plan:
  18. ```bash
  19. # Code with Hugging Face Inference Providers
  20. uvx fast-agent-mcp@latest --pack hf-dev
  21. # Code with Codex (agents optimized for OpenAI)
  22. uvx fast-agent-mcp@latest --pack codex
  23. ```
  24. Enter a shell with `!`, or run shell commands e.g. `! cd web && npm run build`.
  25. Manage skills with the `/skills` command, and connect to MCP Servers with `/connect`. The default **`fast-agent`** registry contains skills to let you set up LSP, Agent and Tool Hooks, Compaction strategies, Automation and more.
  26. ```bash
  27. # /connect supports stdio or streamable http (with OAuth)
  28. # Start a STDIO server
  29. /connect @modelcontextprotocol/server-everything
  30. # Connect to a Streamable HTTP Server
  31. /connect https://huggingface.co/mcp
  32. ```
  33. It's recommended to install **`fast-agent`** to set up the shell aliases and other tooling.
  34. ```bash
  35. # Install fast-agent
  36. uv tool install -U fast-agent-mcp
  37. # Run fast-agent with opus, shell support and built-in subagents
  38. fast-agent --model opus -xx
  39. ```
  40. Use local models with the generic provider, or automatically create the correct configuration for `llama.cpp`:
  41. ```bash
  42. fast-agent model llamacpp
  43. ```
  44. Any **`fast-agent`** setup or program can be used with any ACP client - the simplest way is to use `fast-agent-acp`:
  45. ```bash
  46. # Run fast-agent inside Toad
  47. toad acp "fast-agent-acp -x --model sonnet"
  48. ```
  49. **`fast-agent`** enables you to create and interact with sophisticated multimodal Agents and Workflows in minutes. It is the first framework with complete, end-to-end tested MCP Feature support including Sampling and Elicitations.
  50. `fast-agent` is CLI-first, with an optional prompt_toolkit-powered interactive terminal prompt (TUI-style input, completions, and in-terminal menus); responses can stream live to the terminal via rich without relying on full-screen curses UIs or external GUI overlays.
  51. <!-- ![multi_model_trim](https://github.com/user-attachments/assets/c8bf7474-2c41-4ef3-8924-06e29907d7c6) -->
  52. 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).
  53. Model support is comprehensive with native support for Anthropic, OpenAI and Google providers as well as Azure, Ollama, Deepseek and dozens of others via TensorZero. Structured Outputs, PDF and Vision support is simple to use and well tested. Passthrough and Playback LLMs enable rapid development and test of Python glue-code for your applications.
  54. Recent features include:
  55. - Agent Skills (SKILL.md)
  56. - MCP Apps
  57. - OpenAI Apps SDK
  58. - Shell Mode
  59. - Advanced MCP Transport Diagnsotics
  60. - MCP Elicitations
  61. <img width="800" alt="MCP Transport Diagnostics" src="https://github.com/user-attachments/assets/e26472de-58d9-4726-8bdd-01eb407414cf" />
  62. `fast-agent` is the only tool that allows you to inspect Streamable HTTP Transport usage - a critical feature for ensuring reliable, compliant deployments. OAuth is supported with KeyRing storage for secrets. Use the `fast-agent auth` command to manage.
  63. > [!IMPORTANT]
  64. >
  65. > Documentation is included in this repository under `docs/`. Use the docs helper script from the
  66. > repository root to install, generate, build, serve, screenshot, and assess the site.
  67. ### Agent Application Development
  68. Prompts and configurations that define your Agent Applications are stored in simple files, with minimal boilerplate, enabling simple management and version control.
  69. Chat with individual Agents and Components before, during and after workflow execution to tune and diagnose your application. Agents can request human input to get additional context for task completion.
  70. Simple model selection makes testing Model <-> MCP Server interaction painless. You can read more about the motivation behind this project [here](https://llmindset.co.uk/resources/fast-agent/)
  71. ![2025-03-23-fast-agent](https://github.com/user-attachments/assets/8f6dbb69-43e3-4633-8e12-5572e9614728)
  72. ## Get started:
  73. Start by installing the [uv package manager](https://docs.astral.sh/uv/) for Python. Then:
  74. ```bash
  75. uv pip install fast-agent-mcp # install fast-agent!
  76. fast-agent go # start an interactive session
  77. fast-agent go --url https://hf.co/mcp # with a remote MCP
  78. fast-agent go --model=generic.qwen2.5 # use ollama qwen 2.5
  79. fast-agent go --pack analyst --model haiku # install/reuse a card pack and launch it
  80. fast-agent scaffold # create an example agent and config files
  81. uv run agent.py # run with default_model or FAST_AGENT_MODEL configured
  82. uv run agent.py --model='gpt-5.4-mini?reasoning=low' # specify a model
  83. uv run agent.py --transport http --port 8001 # expose as MCP server (server mode implied)
  84. fast-agent quickstart workflow # create "building effective agents" examples
  85. ```
  86. With no configured model, an interactive run opens the model picker.
  87. Automation and server runs must pass `--model`, set `FAST_AGENT_MODEL`, configure
  88. `default_model`, or declare a model on the agent.
  89. For packaged starter agents, use `fast-agent go --pack <name> --model <model>`.
  90. This installs the pack into the selected fast-agent home if needed, then
  91. starts `go` normally. `--model` is a fallback for cards without an explicit
  92. model setting; a model declared directly in an AgentCard still wins.
  93. Other quickstart examples include a Researcher Agent (with Evaluator-Optimizer workflow) and Data Analysis Agent (similar to the ChatGPT experience), demonstrating MCP Roots support.
  94. > [!TIP]
  95. > Windows Users - there are a couple of configuration changes needed for the Filesystem and Docker MCP Servers - necessary changes are detailed within the configuration files.
  96. ### Basic Agents
  97. Defining an agent is as simple as:
  98. ```python
  99. @fast.agent(
  100. instruction="Given an object, respond only with an estimate of its size."
  101. )
  102. ```
  103. We can then send messages to the Agent:
  104. ```python
  105. async with fast.run() as agent:
  106. moon_size = await agent("the moon")
  107. print(moon_size)
  108. ```
  109. Or start an interactive chat with the Agent:
  110. ```python
  111. async with fast.run() as agent:
  112. await agent.interactive()
  113. ```
  114. Here is the complete `sizer.py` Agent application, with boilerplate code:
  115. ```python
  116. import asyncio
  117. from fast_agent import FastAgent
  118. # Create the application
  119. fast = FastAgent("Agent Example")
  120. @fast.agent(instruction="Given an object, respond only with an estimate of its size.")
  121. async def main():
  122. async with fast.run() as agent:
  123. await agent.interactive()
  124. if __name__ == "__main__":
  125. asyncio.run(main())
  126. ```
  127. The Agent can then be run with `uv run sizer.py`.
  128. Specify a model with the `--model` switch - for example `uv run sizer.py --model sonnet`.
  129. Model strings also accept query overrides. For example:
  130. - `uv run sizer.py --model "gpt-5?reasoning=low"`
  131. - `uv run sizer.py --model "claude-sonnet-4-6?web_search=on"`
  132. - `uv run sizer.py --model "claude-sonnet-4-5?context=1m"`
  133. - `uv run sizer.py --model "gpt-5?poll_period=240"`
  134. For Anthropic models, `?context=1m` is only needed for earlier Sonnet 4 / Sonnet 4.5
  135. models that still require the explicit 1M context opt-in. Claude Sonnet 4.6 and
  136. Claude Opus 4.6 already use their long context window by default, so `?context=1m`
  137. is accepted for backward compatibility but is unnecessary there.
  138. ### Combining Agents and using MCP Servers
  139. _To generate examples use `fast-agent quickstart workflow`. This example can be run with `uv run workflow/chaining.py`. Place `fast-agent.yaml` in the active fast-agent home, or pass an explicit config path when needed._
  140. Agents can be chained to build a workflow, using MCP Servers defined in the `fast-agent.yaml` file:
  141. ```python
  142. @fast.agent(
  143. "url_fetcher",
  144. "Given a URL, provide a complete and comprehensive summary",
  145. servers=["fetch"], # Name of an MCP Server defined in fast-agent.yaml
  146. )
  147. @fast.agent(
  148. "social_media",
  149. """
  150. Write a 280 character social media post for any given text.
  151. Respond only with the post, never use hashtags.
  152. """,
  153. )
  154. @fast.chain(
  155. name="post_writer",
  156. sequence=["url_fetcher", "social_media"],
  157. )
  158. async def main():
  159. async with fast.run() as agent:
  160. # using chain workflow
  161. await agent.post_writer("http://llmindset.co.uk")
  162. ```
  163. All Agents and Workflows respond to `.send("message")` or `.prompt()` to begin a chat session.
  164. Saved as `social.py` we can now run this workflow from the command line with:
  165. ```bash
  166. uv run workflow/chaining.py --agent post_writer --message "<url>"
  167. ```
  168. Add the `--quiet` switch to disable progress and message display and return only the final response - useful for simple automations.
  169. ### MAKER
  170. MAKER (“Massively decomposed Agentic processes with K-voting Error Reduction”) wraps a worker agent and samples it repeatedly until a response achieves a k-vote margin over all alternatives (“first-to-ahead-by-k” voting). This is useful for long chains of simple steps where rare errors would otherwise compound.
  171. - Reference: [Solving a Million-Step LLM Task with Zero Errors](https://arxiv.org/abs/2511.09030)
  172. - Credit: Lucid Programmer (PR author)
  173. ```python
  174. @fast.agent(
  175. name="classifier",
  176. instruction="Reply with only: A, B, or C.",
  177. )
  178. @fast.maker(
  179. name="reliable_classifier",
  180. worker="classifier",
  181. k=3,
  182. max_samples=25,
  183. match_strategy="normalized",
  184. red_flag_max_length=16,
  185. )
  186. async def main():
  187. async with fast.run() as agent:
  188. await agent.reliable_classifier.send("Classify: ...")
  189. ```
  190. ### Agents As Tools
  191. The Agents As Tools workflow takes a complex task, breaks it into subtasks, and calls other agents as tools based on the main agent instruction.
  192. This pattern is inspired by the OpenAI Agents SDK [Agents as tools](https://openai.github.io/openai-agents-python/tools/#agents-as-tools) feature.
  193. With child agents exposed as tools, you can implement routing, parallelization, and orchestrator-workers [decomposition](https://www.anthropic.com/engineering/building-effective-agents) directly in the instruction (and combine them). Multiple tool calls per turn are supported and executed in parallel.
  194. Common usage patterns may combine:
  195. - Routing: choose the right specialist tool(s) based on the user prompt.
  196. - Parallelization: fan out over independent items/projects, then aggregate.
  197. - Orchestrator-workers: break a task into scoped subtasks (often via a simple JSON plan), then coordinate execution.
  198. ```python
  199. @fast.agent(
  200. name="NY-Project-Manager",
  201. instruction="Return NY time + timezone, plus a one-line project status.",
  202. servers=["time"],
  203. )
  204. @fast.agent(
  205. name="London-Project-Manager",
  206. instruction="Return London time + timezone, plus a one-line news update.",
  207. servers=["time"],
  208. )
  209. @fast.agent(
  210. name="PMO-orchestrator",
  211. instruction=(
  212. "Get reports. Always use one tool call per project/news. " # parallelization
  213. "Responsibilities: NY projects: [OpenAI, Fast-Agent, Anthropic]. London news: [Economics, Art, Culture]. " # routing
  214. "Aggregate results and add a one-line PMO summary."
  215. ),
  216. default=True,
  217. agents=["NY-Project-Manager", "London-Project-Manager"], # orchestrator-workers
  218. )
  219. async def main() -> None:
  220. async with fast.run() as agent:
  221. await agent("Get PMO report. Projects: all. News: Art, Culture")
  222. ```
  223. Extended example and all params sample is available in the repository as
  224. [`examples/workflows/agents_as_tools_extended.py`](examples/workflows/agents_as_tools_extended.py).
  225. ## MCP OAuth (v2.1)
  226. For SSE and HTTP MCP servers, OAuth is enabled by default with minimal configuration. A local callback server is used to capture the authorization code, with a paste-URL fallback if the port is unavailable.
  227. - Minimal per-server settings in `fast-agent.yaml`:
  228. ```yaml
  229. mcp:
  230. servers:
  231. myserver:
  232. transport: http # or sse
  233. url: http://localhost:8001/mcp # or /sse for SSE servers
  234. auth:
  235. oauth: true # default: true
  236. redirect_port: 3030 # default: 3030
  237. redirect_path: /callback # default: /callback
  238. # scope: "user" # optional; if omitted, server defaults are used
  239. ```
  240. - The OAuth client uses PKCE and in-memory token storage (no tokens written to disk).
  241. - Token persistence: by default, tokens are stored securely in your OS keychain via `keyring`. If a keychain is unavailable (e.g., headless container), in-memory storage is used for the session.
  242. - To force in-memory only per server, set:
  243. ```yaml
  244. mcp:
  245. servers:
  246. myserver:
  247. transport: http
  248. url: http://localhost:8001/mcp
  249. auth:
  250. oauth: true
  251. persist: memory
  252. ```
  253. - To disable OAuth for a specific server , set `auth.oauth: false` for that server.
  254. ## MCP Ping (optional)
  255. The MCP ping utility can be enabled by either peer (client or server). See the [Ping overview](https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/ping#overview).
  256. Client-side pinging is configured per server (default: 30s interval, 3 missed pings):
  257. ```yaml
  258. mcp:
  259. servers:
  260. myserver:
  261. ping_interval_seconds: 30 # optional; <=0 disables
  262. max_missed_pings: 3 # optional; consecutive timeouts before marking failed
  263. ```
  264. ## Workflows
  265. ### Chain
  266. The `chain` workflow offers a more declarative approach to calling Agents in sequence:
  267. ```python
  268. @fast.chain(
  269. "post_writer",
  270. sequence=["url_fetcher","social_media"]
  271. )
  272. # we can them prompt it directly:
  273. async with fast.run() as agent:
  274. await agent.post_writer()
  275. ```
  276. This starts an interactive session, which produces a short social media post for a given URL. If a _chain_ is prompted it returns to a chat with last Agent in the chain. You can switch the agent to prompt by typing `@agent-name`.
  277. Chains can be incorporated in other workflows, or contain other workflow elements (including other Chains). You can set an `instruction` to precisely describe it's capabilities to other workflow steps if needed.
  278. ### Human Input
  279. Agents can request Human Input to assist with a task or get additional context:
  280. ```python
  281. @fast.agent(
  282. instruction="An AI agent that assists with basic tasks. Request Human Input when needed.",
  283. human_input=True,
  284. )
  285. await agent("print the next number in the sequence")
  286. ```
  287. In the example `human_input.py`, the Agent will prompt the User for additional information to complete the task.
  288. ### Parallel
  289. The Parallel Workflow sends the same message to multiple Agents simultaneously (`fan-out`), then uses the `fan-in` Agent to process the combined content.
  290. ```python
  291. @fast.agent("translate_fr", "Translate the text to French")
  292. @fast.agent("translate_de", "Translate the text to German")
  293. @fast.agent("translate_es", "Translate the text to Spanish")
  294. @fast.parallel(
  295. name="translate",
  296. fan_out=["translate_fr","translate_de","translate_es"]
  297. )
  298. @fast.chain(
  299. "post_writer",
  300. sequence=["url_fetcher","social_media","translate"]
  301. )
  302. ```
  303. If you don't specify a `fan-in` agent, the `parallel` returns the combined Agent results verbatim.
  304. `parallel` is also useful to ensemble ideas from different LLMs.
  305. When using `parallel` in other workflows, specify an `instruction` to describe its operation.
  306. ### Evaluator-Optimizer
  307. Evaluator-Optimizers combine 2 agents: one to generate content (the `generator`), and the other to judge that content and provide actionable feedback (the `evaluator`). Messages are sent to the generator first, then the pair run in a loop until either the evaluator is satisfied with the quality, or the maximum number of refinements is reached. The final result from the Generator is returned.
  308. If the Generator has `use_history` off, the previous iteration is returned when asking for improvements - otherwise conversational context is used.
  309. ```python
  310. @fast.evaluator_optimizer(
  311. name="researcher",
  312. generator="web_searcher",
  313. evaluator="quality_assurance",
  314. min_rating="EXCELLENT",
  315. max_refinements=3
  316. )
  317. async with fast.run() as agent:
  318. await agent.researcher.send("produce a report on how to make the perfect espresso")
  319. ```
  320. When used in a workflow, it returns the last `generator` message as the result.
  321. See the `evaluator.py` workflow example, or `fast-agent quickstart researcher` for a more complete example.
  322. ### Router
  323. Routers use an LLM to assess a message, and route it to the most appropriate Agent. The routing prompt is automatically generated based on the Agent instructions and available Servers.
  324. ```python
  325. @fast.router(
  326. name="route",
  327. agents=["agent1","agent2","agent3"]
  328. )
  329. ```
  330. Look at the `router.py` workflow for an example.
  331. ### Orchestrator
  332. Given a complex task, the Orchestrator uses an LLM to generate a plan to divide the task amongst the available Agents. The planning and aggregation prompts are generated by the Orchestrator, which benefits from using more capable models. Plans can either be built once at the beginning (`plan_type="full"`) or iteratively (`plan_type="iterative"`).
  333. ```python
  334. @fast.orchestrator(
  335. name="orchestrate",
  336. agents=["task1","task2","task3"]
  337. )
  338. ```
  339. See the `orchestrator.py` or `agent_build.py` workflow example.
  340. ## Agent Features
  341. ### Calling Agents
  342. All definitions allow omitting the name and instructions arguments for brevity:
  343. ```python
  344. @fast.agent("You are a helpful agent") # Create an agent with a default name.
  345. @fast.agent("greeter","Respond cheerfully!") # Create an agent with the name "greeter"
  346. moon_size = await agent("the moon") # Call the default (first defined agent) with a message
  347. result = await agent.greeter("Good morning!") # Send a message to an agent by name using dot notation
  348. result = await agent.greeter.send("Hello!") # You can call 'send' explicitly
  349. await agent.greeter() # If no message is specified, a chat session will open
  350. await agent.greeter.prompt() # that can be made more explicit
  351. await agent.greeter.prompt(default_prompt="OK") # and supports setting a default prompt
  352. await agent["greeter"].send("Good Evening!") # Dictionary access is supported if preferred
  353. ```
  354. ### Defining Agents
  355. #### Basic Agent
  356. ```python
  357. @fast.agent(
  358. name="agent", # name of the agent
  359. instruction="You are a helpful Agent", # base instruction for the agent
  360. servers=["filesystem"], # list of MCP Servers for the agent
  361. model="gpt-5.4-mini?reasoning=high", # specify a model for the agent
  362. use_history=True, # agent maintains chat history
  363. request_params=RequestParams(temperature= 0.7), # additional parameters for the LLM (or RequestParams())
  364. human_input=True, # agent can request human input
  365. )
  366. ```
  367. #### Chain
  368. ```python
  369. @fast.chain(
  370. name="chain", # name of the chain
  371. sequence=["agent1", "agent2", ...], # list of agents in execution order
  372. instruction="instruction", # instruction to describe the chain for other workflows
  373. cumulative=False, # whether to accumulate messages through the chain
  374. continue_with_final=True, # open chat with agent at end of chain after prompting
  375. )
  376. ```
  377. #### Parallel
  378. ```python
  379. @fast.parallel(
  380. name="parallel", # name of the parallel workflow
  381. fan_out=["agent1", "agent2"], # list of agents to run in parallel
  382. fan_in="aggregator", # name of agent that combines results (optional)
  383. instruction="instruction", # instruction to describe the parallel for other workflows
  384. include_request=True, # include original request in fan-in message
  385. )
  386. ```
  387. #### Evaluator-Optimizer
  388. ```python
  389. @fast.evaluator_optimizer(
  390. name="researcher", # name of the workflow
  391. generator="web_searcher", # name of the content generator agent
  392. evaluator="quality_assurance", # name of the evaluator agent
  393. min_rating="GOOD", # minimum acceptable quality (EXCELLENT, GOOD, FAIR, POOR)
  394. max_refinements=3, # maximum number of refinement iterations
  395. )
  396. ```
  397. #### Router
  398. ```python
  399. @fast.router(
  400. name="route", # name of the router
  401. agents=["agent1", "agent2", "agent3"], # list of agent names router can delegate to
  402. model="gpt-5.4-mini?reasoning=high", # specify routing model
  403. use_history=False, # router does not maintain conversation history
  404. human_input=False, # whether router can request human input
  405. )
  406. ```
  407. #### Orchestrator
  408. ```python
  409. @fast.orchestrator(
  410. name="orchestrator", # name of the orchestrator
  411. instruction="instruction", # base instruction for the orchestrator
  412. agents=["agent1", "agent2"], # list of agent names this orchestrator can use
  413. model="gpt-5.4-mini?reasoning=high", # specify orchestrator planning model
  414. use_history=False, # orchestrator doesn't maintain chat history (no effect).
  415. human_input=False, # whether orchestrator can request human input
  416. plan_type="full", # planning approach: "full" or "iterative"
  417. plan_iterations=5, # maximum number of full plan attempts, or iterations
  418. )
  419. ```
  420. #### MAKER
  421. ```python
  422. @fast.maker(
  423. name="maker", # name of the workflow
  424. worker="worker_agent", # worker agent name
  425. k=3, # voting margin (first-to-ahead-by-k)
  426. max_samples=50, # maximum number of samples
  427. match_strategy="exact", # exact|normalized|structured
  428. red_flag_max_length=256, # flag unusually long outputs
  429. instruction="instruction", # optional instruction override
  430. )
  431. ```
  432. #### Agents As Tools
  433. ```python
  434. @fast.agent(
  435. name="orchestrator", # orchestrator agent name
  436. instruction="instruction", # orchestrator instruction (routing/decomposition/aggregation)
  437. agents=["agent1", "agent2"], # exposed as tools: agent__agent1, agent__agent2
  438. max_parallel=128, # cap parallel child tool calls (OpenAI limit is 128)
  439. child_timeout_sec=600, # per-child timeout (seconds)
  440. max_display_instances=20, # collapse progress display after top-N instances
  441. )
  442. ```
  443. ### Function Tools
  444. Register Python functions as tools directly in code — no MCP server or external file needed. Both sync and async functions are supported. The function name and docstring are used as the tool name and description by default, or you can override them with `name=` and `description=`.
  445. **Per-agent tools (`@agent.tool`)** — scope a tool to a specific agent:
  446. ```python
  447. @fast.agent(name="writer", instruction="You write things.")
  448. async def writer(): ...
  449. @writer.tool
  450. def translate(text: str, language: str) -> str:
  451. """Translate text to the given language."""
  452. return f"[{language}] {text}"
  453. @writer.tool(name="summarize", description="Produce a one-line summary")
  454. def summarize(text: str) -> str:
  455. return f"Summary: {text[:80]}..."
  456. ```
  457. **Global tools (`@fast.tool`)** — available to all agents that don't declare their own tools:
  458. ```python
  459. @fast.tool
  460. def get_weather(city: str) -> str:
  461. """Return the current weather for a city."""
  462. return f"Sunny in {city}"
  463. @fast.agent(name="assistant", instruction="You are helpful.")
  464. # assistant gets get_weather (global @fast.tool)
  465. ```
  466. Agents with `@agent.tool` or `function_tools=` only see their own tools — globals are not injected. Use `function_tools=[]` to explicitly opt out of globals with no tools.
  467. ### Multimodal Support
  468. Add resources to prompts with MCP types directly or through an external MCP resource server. Convenience APIs make this simple, for example:
  469. ```python
  470. summary: str = await agent.with_resource(
  471. "Summarise this PDF please",
  472. "mcp_server",
  473. "resource://fast-agent/sample.pdf",
  474. )
  475. ```
  476. #### MCP Tool Result Conversion
  477. LLM APIs have restrictions on the content types that can be returned as Tool Calls/Function results via their Chat Completions API's:
  478. - OpenAI supports Text
  479. - Anthropic supports Text and Image
  480. - Google supports Text, Image, PDF, and Video (e.g., `video/mp4`).
  481. > **Note**: Inline video data is limited to 20MB. For larger files, use the File API. YouTube URLs are supported directly.
  482. For MCP Tool Results, `ImageResources` and `EmbeddedResources` are converted to User Messages and added to the conversation.
  483. ### Prompts
  484. MCP Prompts are supported with `apply_prompt(name,arguments)`, which always returns an Assistant Message. If the last message from the MCP Server is a 'User' message, it is sent to the LLM for processing. Prompts applied to the Agent's Context are retained - meaning that with `use_history=False`, Agents can act as finely tuned responders.
  485. Prompts can also be applied interactively through the interactive interface by using the `/prompt` command.
  486. ### Sampling
  487. Sampling LLMs are configured per Client/Server pair. Specify the model name in fast-agent.yaml as follows:
  488. ```yaml
  489. mcp:
  490. servers:
  491. sampling_resource:
  492. command: "uv"
  493. args: ["run", "sampling_resource_server.py"]
  494. sampling:
  495. model: "haiku"
  496. ```
  497. ### Secrets File
  498. > [!TIP]
  499. > Put `fast-agent.secrets.yaml` alongside `fast-agent.yaml` in your active fast-agent home. Select a different home with `--home` or `FAST_AGENT_HOME`; select a different workspace with `--workspace` and the home defaults to `<workspace>/.fast-agent`.
  500. ### Interactive Shell
  501. ![fast-agent](https://github.com/user-attachments/assets/3e692103-bf97-489a-b519-2d0fee036369)
  502. ## Documentation
  503. The documentation site lives in `docs/`. To work with the docs locally:
  504. ```bash
  505. # Install docs dependencies (first time only)
  506. uv run scripts/docs.py install
  507. # Generate reference docs from source code
  508. uv run scripts/docs.py generate
  509. # Run the dev server (http://127.0.0.1:8000)
  510. uv run scripts/docs.py serve
  511. # Capture and assess screenshots of the built docs
  512. uv run scripts/docs.py screenshot
  513. uv run scripts/docs.py assess
  514. # Or generate and serve in one command
  515. uv run scripts/docs.py all
  516. ```
  517. The generator extracts configuration field descriptions, model aliases, and API references directly from the source code to keep documentation in sync.
  518. ## Project Notes
  519. `fast-agent` builds on the [`mcp-agent`](https://github.com/lastmile-ai/mcp-agent) project by Sarmad Qadri.
  520. ### Contributing
  521. Contributions and PRs are welcome - feel free to raise issues to discuss. Full guidelines for contributing and roadmap coming very soon. Get in touch!

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.