> ## Documentation Index
> Fetch the complete documentation index at: https://astronomer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# AI context for data engineering

An AI agent is only as useful as the context it has access to. Without any context engineering, your AI agent will only know what is in its training data and its Dag code tends to be generic, include bad practices, and likely use outdated versions of Airflow and Airflow providers.

This guide covers:

* Where local AI harnesses load context from automatically
* What you need to tell an agent about your Airflow environment before it starts writing Dags
* How to add the Airflow-specific skills that Astronomer maintains
* How to work with Otto, Astronomer's data engineering agent

<Tip>
  [Otto](/docs/astro/otto-overview), Astronomer's data engineering agent, has the best practices and Airflow-specific context described in this guide built-in, and additional advanced capabilities for local data engineering.

  To work with Otto locally, install the [Astro CLI](/docs/cli/v1.44/overview), sign in to your Astro account with `astro login` (a [free trial](https://www.astronomer.io/lp/signup/) is available), and then run `astro otto`.
</Tip>

<Info>
  This guide covers local AI agent harnesses. For context engineering for deployed AI agents, see the [AI Context Engineering with Apache Airflow®](https://www.astronomer.io/ebooks/ai-context-engineering-with-apache-airflow/) eBook.
</Info>

## Assumed knowledge

To get the most out of this guide, you should have:

* A local Airflow environment. See [Run Airflow locally](/docs/learn/run-airflow-locally).
* Basic familiarity with an AI coding agent harness, such as Claude Code or Cursor.

## Auto-loaded context

Most AI harnesses read certain files automatically when a session starts, before you type a prompt:

* **Global instructions**: A file at a fixed path that loads into every agent session on your computer, regardless of project. For Claude Code, this is `~/.claude/CLAUDE.md` by default.
* **Repository instructions**: A file at the root of your project, read as soon as an agent starts there. `AGENTS.md` is a cross-harness standard for this. See [agents.md](https://agents.md) for examples, and [`ruler`](https://github.com/intellectronica/ruler) to generate harness-specific config files from a single `AGENTS.md`.
* **Tool and MCP descriptions**: Available tool and MCP server descriptions load as soon as the harness starts, whether or not you use them. Each connected MCP server costs tokens for this reason, regardless of whether the agent calls any of its tools.

## Context you provide

Auto-loaded files contain global or repository-level information. Everything specific to the Dag(s) you're about to write you supply yourself, before instructing the agent to start writing the spec.

* **Your environment**: Your Airflow version, provider versions, executor, worker queue setup, and similar information. Frontier models train on years of publicly available Dag code, and their training data contains far more Airflow 2 than Airflow 3 code. A generic coding agent without explicit instructions can write code that is incompatible with your version.

* **Documentation for anything recent**: If your planned pipeline should use a feature added in a recent release, paste relevant sections of the Astro, Airflow, Airflow provider, and other package documentation into the prompt. Many websites have `llms.txt` or "View as Markdown" options to make it easier for you to copy the information. For Airflow providers it often makes sense to let your agent query the [Airflow Registry](https://airflow.apache.org/registry/api-explorer/) for details about provider packages. With the Astro CLI that's `astro api airflow`, which you can add to your agent's allowlist. See [Restrict agent commands](/docs/learn/run-airflow-locally#restrict-agent-commands).

  <Frame>
    <img src="https://mintcdn.com/astronomer/7cvVga37XNSM4920/images/img/guides/copy-page-as-markdown-menu.png?fit=max&auto=format&n=7cvVga37XNSM4920&q=85&s=8e98647fa230c265dc98d1125ab6aa8c" alt="The Copy page menu on an Astronomer documentation page, with options to copy the page as Markdown for LLMs, view it as plain text, or open it in Claude or ChatGPT." width="1225" height="569" data-path="images/img/guides/copy-page-as-markdown-menu.png" />
  </Frame>

* **A reference Dag**: Keep a folder of *golden records*, reference Dags organized by use case or departments, depending on your organizational structure. If one or more of your planned Dags resembles a golden Dag, instruct your agent to inspect the reference Dag before writing the spec. Make sure to review your reference Dags periodically and update them with the latest Airflow features. Otto, Astronomer's data engineering agent, already has context on the Dags in your environment and uses them for reference patterns.

## Airflow-specific skills

Astronomer maintains the open-source [`astronomer/agents`](https://github.com/astronomer/agents) skills, covering Airflow operations, Dag authoring and testing, dbt, lineage, and data discovery.

For Claude Code:

```bash theme={null}
claude plugin marketplace add astronomer/agents
claude plugin install astronomer-data@astronomer
```

For Cursor:

```bash theme={null}
npx skills add astronomer/agents --skill '*' -a cursor
```

For any other AI coding agent:

```bash theme={null}
npx skills add astronomer/agents --skill '*'
```

## Otto

<Info>
  **Labs**

  Otto is in [Labs](/docs/astro/feature-previews).
</Info>

Otto is Astronomer's data engineering agent. It is a harness that already contains the best practices defined in this chapter, including the open-source `astronomer/agents` skills, and adds specialized capabilities such as a proprietary compatibility knowledge base drawn from Astronomer's experience running Airflow at scale. Otto can be used with the latest Anthropic, OpenAI, and Google Gemini models.

Use Otto to:

* Explore your Dags, Deployments, and data warehouse.
* [Author and debug Dags](/docs/learn/develop-dags-with-ai): describe what you need, and let Otto write the spec and the Dags, while iteratively testing them in your local Airflow environment.
* Investigate production failures using task logs, run history, Astro Deployment configurations, and Dag source.
* Review pull requests, with inline comments and commit suggestions.
* Plan and execute Airflow upgrades against Astronomer's compatibility knowledge base.
* Migrate workflows from legacy orchestration systems to Airflow on Astro.

To use Otto, sign in to your Astro account and run `astro otto` from your project folder:

```bash theme={null}
astro login
astro otto
```

See [Otto overview](/docs/astro/otto-overview) for more information.

### Delegate to Otto

Instead of running Otto interactively yourself, your AI coding harness can delegate Airflow-specific work directly to Otto, invoking `astro otto` in headless mode as a sub-agent and continuing after Otto returns a result. Ask your harness to `use Otto`, `ask Otto`, or `delegate to Otto`, and it hands off the task for you if it has access to the [`delegating-to-otto`](https://github.com/astronomer/agents/blob/main/skills/delegating-to-otto/SKILL.md) skill.

Headless invocation supports session continuity, permission modes, tool allowlists, model selection, structured output, and MCP configuration, so a harness can resume or reference a specific Otto session instead of starting fresh each time. See the [`astro otto`](/docs/cli/v1.44/astro-otto) reference for the full set of options.
