Guides | Diaphora Docs | Diaphora

Learn Frags

A guided path from a local runtime to production-ready plans. Work through the tracks in order, or jump straight to the lesson you need.

13 Lessons
3 Tracks
~83 Minutes

Track 01

Set up your environment

Get the open-source Frags runtime running on your own machine.

  1. Start here
    5 min read
    Running Frags Locally
    Install the open-source Frags CLI, point it at Gemini, ChatGPT, Anthropic, or Ollama, and run your first blueprint on your own machine.

  2. Setting up tools
    4 min read
    Add a new connection to tools.json end-to-end — OAuth for an MCP server, a Postgres collection, and where apicp fits in — then verify it before wiring it into a blueprint.

Track 02

Blueprints

  1. Anatomy of a blueprint
    6 min read
    The four things every blueprint declares — tools, parameters, sessions, and typed schema — walked through on one complete example.

  2. Build a hello-world blueprint
    6 min read
    Write your first FML blueprint from scratch — a single session with a schema — then grow it with parameters, prompt phases, and connected sessions.

  3. Anatomy of a session
    7 min read
    Every part of a session, top to bottom — name, tools, PreCalls, context, and the key prePrompt (+) vs prompt (-) distinction that turns gathered context into typed output.

  4. Design your output schemas
    6 min read
    Shape a session's typed output — field syntax, comments the model reads as instructions, flat-vs-nested structure, scalar shorthand, and reusable $Component refs.

  5. Data flow: params, vars & context
    7 min read
    How data moves through a blueprint across the three namespaces — caller inputs, working memory, and session outputs — and the rule for reading context safely.

  6. Templates and expressions
    6 min read
    Go templates always make strings; $(...) preserves real types. Learn the three expression positions and never hand a tool a stringified array again.

  7. PreCalls deep-dive
    8 min read
    Run tools deterministically before prompts — global vs session PreCalls, tool vs code invocations, and routing output into vars or context.

  8. Connect Frags to your data
    8 min read
    Pull live data into a blueprint — run a web search, call an MCP server (Slack), and query a database (Postgres) with PreCalls, transformers, and context routing.

  9. Control the flow of a blueprint
    9 min read
    Order, gate, and fan out sessions with after, target, expect, and iterate — the declarative flow controls Frags runs for you.

  10. Generate an apicp from an OpenAPI spec
    5 min read
    Map an OpenAPI operation into an apicp.yaml mapping and expose it as a focused MCP server a blueprint can call with require apicp.

Track 03

Run it in production

Schedule blueprints on a cadence and let the platform run, deliver, and observe them.

  1. Schedule recurring blueprints
    6 min read
    Run a blueprint automatically on a cadence — schedule a weekly market brief that analyzes data and emails an HTML report through the Resend MCP server, all on Diaphora's managed runtime.