Agentic Research

YAML

Also: yml · .yml · yaml 格式 · yaml 檔案

The other common config format: nesting expressed by indentation, closer to a human outline than JSON — and far pickier about whitespace.

When you will meet it

The moment you touch deployment and automation tools (Docker Compose, GitHub Actions, server configs), configuration switches from JSON to YAML (.yml or .yaml). It fails in the least beginner-friendly way: one extra space of indentation or one stray tab, and the reported line points far from the actual mistake. Knowing what YAML cares about in advance beats learning by fire.

An analogy

Like an outline where each indented line belongs to the item above it. A single tab where only spaces are allowed shifts the whole hierarchy — like a mis-indented paragraph ending up in the wrong section.

Minimal example

# 一份正確的小設定:每一層縮排兩個空格,絕不用 Tab
model: demo
options:
  temperature: 0.7
  stream: true
tools:
  - search
  - calculator

Three details decide life or death: a space after every colon; identical indentation for everything at one level; list items begin with dash-space. Nearly every YAML error is a variation on these three.

What people get wrong

  • Indenting with tabs. The YAML spec forbids tabs for indentation outright — and since editors render indentation widths differently, a file that looks aligned on your screen can be crooked to the parser.
  • Leaving yes, no, on and off unquoted: many YAML parsers turn them into booleans — the classic incident is the country code NO parsed as false. A version-like 1.10 also becomes 1.1. Quote anything meant as text.

Related terms

Next