Tutorial for autotrain - #1299
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new documentation tutorial page describing “AutoTrain”, a multi-agent AutoML workflow that combines a FastAPI frontend with a three-stage Flyte pipeline and agent-driven iterative experimentation, intended for the Union.ai/Flyte docs tutorials section.
Changes:
- Introduces a new tutorial page explaining the AutoTrain architecture (frontend + pipeline + 3 agents).
- Adds multiple
{{< code ... >}}shortcode inclusions that pull referenced snippets fromunionai-examples. - Documents deployment, prerequisites (secrets), usage, and debugging steps for running the app/pipeline.
Comments suppressed due to low confidence (5)
content/tutorials/agents/auto_train/_index.md:17
- The page is included in both variants but this paragraph hard-codes “Union UI” and “Union project/domain”. Using
{{< key product_name >}}keeps the wording accurate across Flyte vs Union renders.
AutoTrain automates that whole loop behind a simple web interface: a user submits a dataset link and a few fields, and a FastAPI app kicks off a three-stage Flyte pipeline. A **data agent** profiles and cleans the dataset, a **design agent** turns that profile into a concrete experiment plan and a starting `train.py`, and a **research agent** runs an iterative improve-and-evaluate loop with the Claude Agent SDK, committing progress to GitHub and opening a PR with the results. Every step is a task or trace visible in the Union UI. Architecturally, this is a hybrid app-task graph: the frontend and the pipeline's tasks are deployed to the same Union project/domain, and the app submits runs programmatically (`flyte.run.aio()`) on the user's behalf, then polls the cluster to report progress back to them.
content/tutorials/agents/auto_train/_index.md:166
- This line hard-codes “Union UI” even though the page is rendered for both Flyte and Union variants. Using the
product_namekey keeps the docs consistent across variants.
Every step of the loop - CLI setup, git clone, the baseline implementation, each change proposal, each training run, crash fixes, commits, PR creation, the final convergence check - is wrapped in `@flyte.trace`, so it shows up as a distinct traced action in the Union UI with its own inputs, outputs, and timing, all nested inside the single `run_research` task. Because a trace's identity is `(function name, input hash)`, every per-experiment call takes `exp_id` (and `run_training` an attempt counter) as an explicit input - otherwise a repeated call with the same arguments would replay a cached result instead of re-running.
content/tutorials/agents/auto_train/_index.md:263
- This section hard-codes “Union UI” / “Why Union?” even though the page is included in both
+flyteand+unionvariants. Prefer theproduct_namekey so the rendered docs match the active variant.
- **Union UI**: a live report on the research task - the running trace of what each experiment tried, a Performance tab charting the metric across experiments, and full logs for every stage.
- **GitHub**: an experiment branch with the full history of `train.py` revisions (one commit per improvement) and a PR summarizing the best result, ready to review or merge.
- **The status page**: the best metric value, a link to the PR, and - if the agent's own convergence check flagged the result as unsatisfactory - a plain-language explanation of what went wrong and what to try next.
## Why Union?
content/tutorials/agents/auto_train/_index.md:269
- Same variant consistency issue: “Union UI” is hard-coded on a page that renders for both variants.
**Observability into an unattended, multi-hour process.** The research loop can run for a long time with no one watching. Every internal step - installing the CLI, cloning the branch, implementing the baseline, each change proposal, each training run, crash fixes, commits, PR creation, the final convergence check - is wrapped in `@flyte.trace`, so it shows up as its own action in the Union UI with inputs, outputs, and timing, nested inside the single task container. If experiment 14 crashes, you're not left with a bare stack trace - you can see exactly what the previous 13 experiments tried and why.
content/tutorials/agents/auto_train/_index.md:277
- This concluding sentence hard-codes “Union” even though the page is rendered for both Flyte and Union variants. Using the
product_namekey avoids variant-specific branding in shared content.
AutoTrain is a specific example of a more general pattern: an LLM decides what to try next, and Union handles how that work actually runs - on the right compute, with the right secrets, with every step traceable, whether the loop takes five minutes or five hours.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| variants: +flyte +union | ||
| --- | ||
|
|
||
| # AutoTrain: A Multi-Agent AutoML Pipeline on Union |
|
@parnianz I reviewed this in detail. Nice tutorial, and the hybrid app-task graph it demonstrates is genuinely the most interesting thing in it. A few things need fixing before it can merge, starting with two that block it outright. Blockers1. The examples submodule points at an unmerged branch. This PR bumps So as it stands, the next routine 2. CI has never run on the current head. There are zero check runs on Three things in the tutorial that won't work if a reader copies them
The curl sends the wrong field name. It posts The documented setup leaves ScreenshotsTwo don't match what the text says:
Also Smaller things
One editorial thought, take it or leave it: this overlaps a fair bit with — docsy · automated docs agent |
No description provided.