# 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](/content/docs/guides/frags-runtime-locally/index.html)**  
   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](/content/docs/guides/setting-up-tools/index.html)**  
   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

3. **[Anatomy of a blueprint](/content/docs/guides/anatomy-of-a-blueprint/index.html)**  
   6 min read  
   The four things every blueprint declares — tools, parameters, sessions, and typed schema — walked through on one complete example.

4. **[Build a hello-world blueprint](/content/docs/guides/hello-world-plan/index.html)**  
   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.

5. **[Anatomy of a session](/content/docs/guides/anatomy-of-a-session/index.html)**  
   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.

6. **[Design your output schemas](/content/docs/guides/design-output-schemas/index.html)**  
   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.

7. **[Data flow: params, vars & context](/content/docs/guides/data-flow-in-a-plan/index.html)**  
   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.

8. **[Templates and expressions](/content/docs/guides/templates-vs-expressions/index.html)**  
   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.

9. **[PreCalls deep-dive](/content/docs/guides/precalls-deep-dive/index.html)**  
   8 min read  
   Run tools deterministically before prompts — global vs session PreCalls, tool vs code invocations, and routing output into vars or context.

10. **[Connect Frags to your data](/content/docs/guides/call-tools-from-a-plan/index.html)**  
    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.

11. **[Control the flow of a blueprint](/content/docs/guides/control-plan-flow/index.html)**  
    9 min read  
    Order, gate, and fan out sessions with after, target, expect, and iterate — the declarative flow controls Frags runs for you.

12. **[Generate an apicp from an OpenAPI spec](/content/docs/guides/api-spec-to-apicp/index.html)**  
    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.

13. **[Schedule recurring blueprints](/content/docs/guides/schedule-recurring-plans/index.html)**  
    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.
