This is a hands-on tutorial for people who already work with a coding agent (Claude Code, Cursor, Copilot, Windsurf, Cline, Codex…). Instead of copying code out of a README, you'll paste prompts to your agent and watch it build real Flyte pipelines for you — grounded by the official Flyte MCP server so it writes correct, current code. You'll run the pipelines yourself from the terminal, so you learn the moving parts, not just the magic.
Two things you'll walk away with:
- The fundamentals. The agent types the code, but you run the CLI and ask the agent to explain what it built — so you actually understand tasks, environments, parallelism, retries, reports, and deployment.
- A feel for the value. You'll see Flyte run your Python in the cloud, fan it out in parallel, recover from failures, stream live reports, and deploy — and understand why each one matters.
⏱️ Budget about an hour. The first cloud run spends a few minutes building a container image; later steps reuse it and are quick.
The one rule that makes this work: your agent's exact output will differ every time — that's fine. We never check that your code looks a certain way. We check that the right thing happened (a run succeeded, work ran in parallel, a failure recovered). Each step ends with a Checkpoint you use to confirm you landed in the right place.
Who runs what: the agent always writes the code. In the early steps you run the Flyte CLI yourself — that muscle memory matters. Once you've got it, you'll hand command-running back to the agent and let it run and verify things for you.
You need:
- Python 3.10+ and a coding agent you're comfortable using.
- Docker running (only if you'll use the local devbox in Step 2).
- This repo, cloned locally. It ships the Flyte MCP configuration for every supported agent, so connecting in Step 1 is mostly done for you.
git clone <this-repo-url> v2-tutorial
cd v2-tutorialThen install Flyte. Use whichever tool you prefer — pick one and stick with it:
Option A — uv (fast, no manual venv):
uv syncOption B — pip (in a virtual environment):
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install flyte🔧 Running
flytecommands in this tutorial. Everyflyte ...command below assumes Flyte is on your path. If you used pip, that means your venv is activated (source .venv/bin/activate). If you used uv, prefix each command withuv run— e.g.uv run flyte get config. Pick one habit and use it for every command in the tutorial.
The Flyte MCP server gives your agent live access to Flyte's docs and code examples. This is what keeps the agent's output correct and consistent — without it, agents guess at APIs. Get this working before anything else.
The server is remote and needs no login:
https://flyte-mcp.apps.demo.hosted.unionai.cloud/flyte-mcp/mcp
Find your agent below. For the agents that read repo-committed config (Claude Code, Cursor, VS Code, Codex), the file is already in this repo — you just open the project and approve it.
Claude Code
Already configured via .mcp.json in this repo. Open the project
and Claude Code will prompt you to approve the flyte server. Or add it yourself:
claude mcp add --transport http --scope project flyte https://flyte-mcp.apps.demo.hosted.unionai.cloud/flyte-mcp/mcpCursor
Already configured via .cursor/mcp.json. Open the project,
then go to Settings → Tools & Integrations / MCP and enable flyte.
VS Code + GitHub Copilot
Already configured via .vscode/mcp.json. Open the project,
switch Copilot Chat to Agent mode, and start the flyte server when
prompted (or via the MCP servers list).
Codex CLI
A project-local .codex/config.toml is included. If your
Codex setup doesn't pick it up, add it to ~/.codex/config.toml:
[mcp_servers.flyte]
url = "https://flyte-mcp.apps.demo.hosted.unionai.cloud/flyte-mcp/mcp"Windsurf
Windsurf only reads a global config, so add this to
~/.codeium/windsurf/mcp_config.json yourself (note the key is serverUrl):
{
"mcpServers": {
"flyte": {
"serverUrl": "https://flyte-mcp.apps.demo.hosted.unionai.cloud/flyte-mcp/mcp"
}
}
}Cline
Cline stores MCP config globally. Open the Cline panel → MCP Servers →
Configure, and add (the type must be exactly streamableHttp):
{
"mcpServers": {
"flyte": {
"url": "https://flyte-mcp.apps.demo.hosted.unionai.cloud/flyte-mcp/mcp",
"type": "streamableHttp"
}
}
}Paste this to your agent:
Using the Flyte MCP server, search the Flyte docs and tell me what a
TaskEnvironmentis and what@env.taskdoes. Quote where you found it.
If it answers with specifics pulled from Flyte's docs (not a vague guess), you're connected and ready to build. If it can't reach the server, revisit the config for your agent above.
Your code runs on a Flyte backend. Pick one and create a config — you run these commands.
Option A — local devbox (fastest, no account): a Flyte cluster on your own machine. Make sure Docker is running, then:
flyte start devbox
flyte create config \
--endpoint localhost:30080 \
--project flytesnacks \
--domain development \
--builder local \
--insecure \
--output ~/.union/config.yamlThe devbox UI comes up at http://localhost:30080. Details: https://www.union.ai/docs/v2/flyte/user-guide/run-modes/running-devbox/
Option B — a remote Union cluster (if you have one):
flyte create config \
--endpoint <org>.hosted.unionai.cloud \
--builder remote \
--domain development \
--org <org> \
--project <project> \
--output ~/.union/config.yamlflyte get config
flyte whoamiflyte get config prints your active endpoint, org, project, and domain — read
it and make sure it points where you expect. If both commands answer cleanly,
your CLI is wired up.
The core Flyte idea: write normal Python functions, mark them as tasks, and run them on real infrastructure without rewriting anything.
Prompt your agent:
Using the Flyte MCP for reference, create a file
hello.pywith a single Flyte task that takes anamestring and returns a greeting, plus amaintask that calls it. Set up aTaskEnvironmentwith a Debian-based image. Don't run it — just write the file and tell me the exactflyte runcommand to executemainwith a name.
Now you run it (the agent gives you the exact line; it looks like this):
flyte run hello.py main --name WorldThe first run builds a container image — give it a few minutes. When it finishes, the CLI prints an execution URL. Open it: that's your function running as a tracked execution on the cluster.
The command should finish without error and print a URL. Open it and confirm the execution shows Succeeded.
Explain, using the Flyte MCP, what
TaskEnvironmentand@env.taskdid here. Why did my plain Python function need an "environment" and an "image" to run in the cloud? Keep it to a few sentences.
You rarely run one thing. Flyte makes running the same task across many inputs in parallel a one-liner — and each one is its own tracked, retryable unit.
Prompt your agent:
Now add a task to
hello.pythat usesflyte.mapto run my greeting task in parallel across a list of at least 8 names and returns all the greetings. Give me theflyte runcommand for it — I'll run it.
You run it, then open the execution URL it prints.
In the UI you should see one child action per name, not a single task looping. Spot-check: did they run side by side?
Using the Flyte MCP, explain why
flyte.mapis better here than a plain Pythonforloop. What does Flyte give me — scaling, retries, visibility — that the loop wouldn't?
Real pipelines hit transient errors and resource limits. Flyte treats retries and resource sizing as first-class settings, and lets a task ask for more resources only when it needs them.
Prompt your agent:
Using the Flyte MCP, create
resilient.pywith a task that fails on its first attempt and then succeeds when Flyte retries it — detect the current retry attempt from what Flyte exposes to the task (ask the MCP how), so it works even though each retry runs in a fresh pod. Setretriesso the task recovers. Add a second task that requests extra memory for just itself via a resource override. Give me theflyte runcommand.
ℹ️ Reading the attempt number is the trick: a plain in-process counter resets on every retry because each attempt is a brand-new pod, so the task has to read the attempt number Flyte hands it.
You run it. This time, let your agent help you verify — paste:
Run that
flyte runcommand for me, then tell me how many attempts the flaky task made and whether the run ultimately succeeded.
The run succeeds despite early failed attempts. In the UI, the flaky task shows multiple attempts ending in Succeeded.
Briefly: how do
retriesand resource overrides help me run cheaply and reliably? When would I override resources for one task instead of raising them everywhere?
Flyte tasks can emit rich, interactive HTML reports — charts, tables, live progress — attached right to the execution. This is the observability story.
Prompt your agent (and let it drive now):
Using the Flyte MCP, create
report.pywith a task that generates an interactive HTML report (a chart or live-updating dashboard) withflyte.report. Then run it for me and tell me where to view the report in the UI.
Open the execution and find the report tab — that visualization was produced by your task and travels with the run.
So far each flyte run uploaded your code on the spot. flyte deploy
registers your task environment on the backend as a named, reusable entity — the
foundation for running it on a schedule, triggering it from other systems, or
sharing it with teammates.
Prompt your agent:
Using the Flyte MCP, explain the difference between
flyte runandflyte deploy. Then deploy the environment fromhello.pyfor me and confirm it registered, and show me where to find the deployed task in the UI.
Your agent reports a successful deploy, and you can find the deployed task/environment in the UI without re-running from source.
You've seen the whole arc: cloud execution, effortless parallelism, resilience, observability, and deployment — and you've run the CLI yourself. Time to fish on your own. Pick any of these and hand it to your agent, leaning on the Flyte MCP and the checkpoint habit ("prove it actually worked") you've built:
- "Build a small multi-step pipeline where one task's output feeds the next, and the steps that can run in parallel do."
- "Take the map example and fan it out across 100 inputs, limiting how many run at once."
- "Write a pipeline that processes a public dataset and produces a report summarizing it."
- "Add a task that only runs on a larger machine, and prove from the UI it got the resources it asked for."
- "Recreate something from my own work as a Flyte pipeline, run it, and deploy it."
For each: ask the agent to build it, run it (or run it yourself), confirm from the execution that it worked, and when something surprises you, ask the agent to explain it using the Flyte MCP.
- Browse real examples: https://github.com/flyteorg/flyte-sdk/tree/main/examples
- Latest from Union: https://www.union.ai/resources
- Ask questions on Slack: https://slack.flyte.org/