FAI DSPy Expert

FAI DSPy Expert is an agent for Claude Code from frootai/frootai. It costs 43 tokens per session (1,567 once invoked), scanned A, a copy of FAI DSPy Expert, MIT.

A specialist for DSPy, a framework for building language-model programs from structured inputs and outputs instead of hand-written prompts. It covers reusable modules, automatic prompt optimization, output checks, and evaluation.

In plain words
What is it for?
Use it to define model tasks, compose reasoning or tool-using modules, optimize prompts from examples and metrics, validate outputs, and compare results on datasets.
Why use it?
It helps make language-model behavior easier to test and improve when manually written prompts are fragile or difficult to maintain.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: model in frontmatter.

Good fit Use it to define model tasks, compose reasoning or tool-using modules, optimize prompts from examples and metrics, validate outputs, and compare results on datasets.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/frootai/frootai/fai-dspy-expert
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/frootai/frootai

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for FAI DSPy Expert

README.md
[![agentmods](https://agentmods.dev/badge/agents/frootai/frootai/fai-dspy-expert/github.svg)](https://agentmods.dev/agents/frootai/frootai/fai-dspy-expert)
Your own site
<a href="https://agentmods.dev/agents/frootai/frootai/fai-dspy-expert"><img src="https://agentmods.dev/badge/agents/frootai/frootai/fai-dspy-expert/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for FAI DSPy Expert

Your own site · 80×15
<a href="https://agentmods.dev/agents/frootai/frootai/fai-dspy-expert"><img src="https://agentmods.dev/badge/agents/frootai/frootai/fai-dspy-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,567 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00043 $0.01567
Opus 5 $0.00022 $0.00783
Sonnet 5 $0.00009 $0.00313
Haiku 4.5 $0.00004 $0.00157

Measured 5d ago against content hash 60e85312033f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

FAI DSPy Expert scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to FAI DSPy Expert — 26 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

agents/fai-dspy-expert.agent.md · 155 lines

How it starts

The opening of the file, as written. The whole thing — 155 lines — stays where its author put it; the contents beside it link to each section on GitHub.

FAI DSPy Expert

DSPy framework specialist for declarative language model programming. Designs signature-based modules, applies optimizers (BootstrapFewShot, MIPRO, MIPROv2) for automatic prompt optimization, uses assertions for output quality, and builds compiled prompt pipelines.

Core Expertise

  • Signatures: Declarative input→output specifications (question -> answer, context, question -> answer: str), typed fields
  • Modules: dspy.Predict, dspy.ChainOfThought, dspy.ReAct, dspy.ProgramOfThought — composable building blocks
  • Optimizers: BootstrapFewShot (example-based), MIPRO (instruction optimization), MIPROv2 (multi-prompt), BootstrapFewShotWithRandomSearch
  • Assertions: dspy.Assert and dspy.Suggest for runtime output validation, backtracking on failure
  • Evaluation: Metric functions, dspy.evaluate.Evaluate, dataset splitting, cross-validation
  • Compilation: Optimized prompts saved/loaded, no re-optimization needed for production

What the Model Gets Wrong

Mistake Why Wrong Correct Approach
Writes prompts manually Brittle, not optimized for specific model, hard to maintain DSPy signatures + optimizer: let the framework find optimal prompts
Uses dspy.Predict for everything Misses chain-of-thought benefit for reasoning tasks dspy.ChainOfThought for reasoning, dspy.Predict for simple extraction
Skips the optimizer step Un-optimized prompts perform 20-40% worse Always compile with BootstrapFewShot or MIPRO on training examples
No metric function Optimizer can't improve without measurement Define metric: def metric(example, prediction, trace=None): return ...
Hardcodes few-shot examples Not adapted to model or task distribution BootstrapFewShot automatically selects best examples from training set
Ignores dspy.Assert Invalid outputs pass silently Assertions for format, length, citation presence — auto-retry on failure

Read the full file on GitHub · 155 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 155 lines · 43 tokens per session scan A 60e85312033f

Subscribe to this mod's changes

FAI DSPy Expert is an agent published in the GitHub repository frootai/frootai (7 stars, last pushed yesterday), licensed MIT. It adds 43 tokens to every session and 1,567 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to FAI DSPy Expert, differing in 26 lines, and is treated as a copy.