Example Dags

Every operator, decorator and integration has a runnable Dag under example_dags, listed here by operator. Guides embed the Dags they walk through; the rest link to source.

For what to build rather than how, start at What you can build.

Single-prompt tasks

Guide

What it shows

Single prompts: LLMOperator and @task.llm

Summarize and extract entities, grade incident severity, and triage a queue of support tickets one mapped task at a time (example_llm.py, example_llm_classification.py, example_llm_analysis_pipeline.py).

Branch on an answer: LLMBranchOperator

Let the model pick which downstream task runs, and route a failed task to rerun, page or ignore with a confidence bar.

Analyze files and images: LLMFileAnalysisOperator

@task.llm_file_analysis reasoning over files, images, and PDFs.

Detect schema drift: LLMSchemaCompareOperator

Compare two schemas and block a load when they drifted.

Natural language to SQL: LLMSQLQueryOperator

@task.llm_sql generating SQL from a natural-language question.

Batch processing

Guide

What it shows

Batch processing: LLMBatchOperator

Classify thousands of reviews at half the price through one OpenAI or Anthropic batch job, with structured output and results landed on object storage (example_llm_batch.py).

Agents & tools

Guide

What it shows

Agents with tools: AgentOperator and @task.agent

AgentOperator / @task.agent multi-turn tool use, durable execution, and pydantic-ai capabilities (example_agent.py, example_agent_durable.py, example_agent_capabilities.py).

Toolsets

Loading SKILL.md Agent Skills (example_agent_skills.py) and exposing an Airflow toolset to a LangChain agent, the reverse bridge (example_langchain_toolset_bridge.py).

MCP server connection

Connecting an agent to an MCP server through an Airflow connection.

Human-in-the-loop (HITL) review for agents

Adding a human-in-the-loop review gate to agent output.

Research agent with human review

A LangChain ReAct agent that decides its own tool calls, composed with LLMOperator for report formatting and AIP-90 HITL review (example_langchain_tool_agent.py).

Retrieval & document processing

Guide

What it shows

Load documents: DocumentLoaderOperator

Parsing PDF, DOCX, CSV, and JSON into list[dict] for embedding.

Using the hook directly: PydanticAIHook

Calling PydanticAIHook and a pydantic-ai Agent directly.

LangChain models: LangChainHook

LangChainHook chat-only, embedding-only, and combined patterns.

Using LlamaIndex directly: LlamaIndexHook

LlamaIndexHook plus the embedding and retrieval operators.

By use case

Dags written around a job. Each has a page under What you can build with the Dag embedded and steps to run it.

Use case

Source

Ask questions over a growing PDF corpus

example_llamaindex_rag.py: a weekly indexing Dag plus an on-demand query Dag, with single-Dag and multi-source variants.

Compare companies’ 10-K filings

example_llamaindex_10k.py and example_langchain_10k.py: live SEC EDGAR filings, per-company retrieval fan-out, human review at both ends. One variant per RAG library.

Monthly report from a survey CSV

example_llm_survey_analysis.py: download, schema check, generated SQL, email; plus an interactive variant with HITL. example_llm_survey_agentic.py fans a multi-dimensional question out one SQL query per dimension.

Explain a revenue anomaly

example_sandbox_toolset.py: an agent with a read-only warehouse toolset and a sandbox for the arithmetic.

Weekly status report with a hallucination check

example_aip_progress_tracker.py: the same report built as a deterministic pipeline with a hallucination check and as one autonomous agent.

Research agent with human review

example_langchain_tool_agent.py: a LangChain ReAct agent between a question-review gate and a report-approval gate.

Reliability

Guide

What it shows

Retry policies

Classifying task failures with an LLM into categories you define, then deriving retry, fail, or delay from the category; and the same on a classifier model with a confidence bar. Source: example_llm_retry_policy.py.

Provider fallback

Failing over to another vendor inside one task attempt, and drilling the chain without waiting for an outage. Source: example_llm_fallback.py.

Classifier models

Routing a failure with a model that answers typed questions instead of writing text, and escalating when its confidence is low. Source: example_classifier_model.py.

Was this entry helpful?