Inferensys

Glossary

robots.txt Grouping

The structural mechanism in a robots.txt file where a User-Agent line is followed by one or more directive lines, forming a rule group that applies exclusively to that bot.
Developer demonstrating multi-agent tool use, agent tool selection interface on laptop, casual tech demo moment.
RULE BLOCK STRUCTURE

What is robots.txt Grouping?

The fundamental structural mechanism in a robots.txt file where a User-Agent line is followed by one or more directive lines, forming a rule group that applies exclusively to that bot.

Robots.txt grouping is the logical structure defined in RFC 9309 where a User-Agent token declaration and its subsequent Disallow or Allow directives form a distinct, autonomous rule block. Each group begins with one or more User-Agent lines and ends at the next User-Agent declaration, creating a scoped policy that applies only to the specified crawler.

A single robots.txt file contains multiple independent groups, allowing webmasters to define separate access policies for different bots like Googlebot and GPTBot. When a crawler parses the file, it must identify the most specific group matching its user-agent token and obey only that block's directives, ignoring rules defined for other agents.

STRUCTURAL ANATOMY

Key Characteristics of a Rule Group

A rule group is the fundamental structural unit of a robots.txt file, binding a specific crawler identity to a set of access directives. Each group defines a self-contained access policy.

01

User-Agent Declaration

Every rule group begins with a User-agent: line, which acts as the group's header and target selector. The token following this field specifies which crawler the subsequent directives apply to.

  • Case-insensitive matching: The token is matched case-insensitively against the crawler's User-Agent HTTP header.
  • Specificity: A group targeting User-agent: GPTBot applies only to OpenAI's crawler, while User-agent: * acts as a catch-all for any crawler not explicitly named in another group.
  • Multiple declarations: A single group can list multiple User-agent lines consecutively to apply the same rules to several bots, e.g., User-agent: GPTBot followed by User-agent: CCBot.
02

Directive Stacking

Following the User-agent line, one or more directive lines form the body of the rule group. These directives are processed sequentially by a compliant parser to determine access rights for a given URL path.

  • Disallow: The primary restrictive rule, e.g., Disallow: /private/, blocks access to any path starting with /private/.
  • Allow: An override mechanism used to carve out exceptions from a broader Disallow rule, e.g., Allow: /private/public-report.pdf.
  • Non-standard extensions: Directives like Crawl-delay: 10 can be included to set a politeness policy, though they are not part of the core RFC 9309 standard.
03

Group Termination & Separation

A rule group is terminated by the start of the next User-agent line or by the end of the file. The boundary between groups is critical for determining which policy applies to a crawler.

  • First-match wins: When a crawler parses the file, it must find the most specific group that matches its User-Agent token. If GPTBot is explicitly defined, it uses that group and ignores the User-agent: * group entirely.
  • Blank lines: Empty lines between groups are ignored by parsers and are used purely for human readability to visually separate distinct bot policies.
  • Group isolation: Directives in one group have zero effect on crawlers targeted by a different group, ensuring complete policy isolation.
04

Path Matching Logic

Within a rule group, the path specified in a Disallow or Allow directive is matched against the requested URL's path component using a defined algorithm from RFC 9309.

  • Prefix matching: A rule like Disallow: /api matches /api, /api/v1/, and /apiary, because it functions as a prefix match.
  • Wildcard character: The * token matches any sequence of characters. Disallow: /*.pdf$ blocks all PDF files when combined with the end-of-path anchor $.
  • Precedence by specificity: If multiple directives match a URL, the most specific rule (the one with the longest matching character sequence) takes precedence. An Allow rule with a longer path overrides a shorter Disallow rule.
05

Global vs. Specific Policy

The interaction between a specific bot's rule group and the universal User-agent: * group forms the basis of a site's access control hierarchy.

  • Explicit targeting: A group for User-agent: Googlebot provides a custom policy that overrides the default catch-all rules.
  • Fallback mechanism: If a crawler's User-Agent token does not match any explicitly named group, it must obey the directives in the User-agent: * group.
  • Complete denial: To block all compliant crawlers from a section, a single Disallow: /sensitive directive in the * group is sufficient, unless a specific group uses an Allow override for that path.
06

Sitemap Cross-Referencing

Although not a directive that controls access, the Sitemap field is often placed at the end of a robots.txt file, outside of any specific rule group, to point crawlers to an index of canonical URLs.

  • Global scope: A Sitemap: https://example.com/sitemap.xml line is not bound to any User-agent and serves as a discovery hint for any crawler that supports the standard.
  • Multiple sitemaps: Several Sitemap lines can be listed to reference multiple sitemap files or sitemap index files.
  • Efficiency: This mechanism allows a crawler to bypass exhaustive site crawling for discovery, directly fetching the list of URLs the site owner wishes to have indexed.
ROBOTS.TXT STRUCTURE

Frequently Asked Questions

Clear answers to common questions about how robots.txt rule groups function, how directives are parsed, and how to structure access controls for AI crawlers.

A robots.txt group is a structural block within a robots.txt file that binds one or more Disallow or Allow directives to a specific User-Agent token. Each group begins with a User-Agent line, and all subsequent directive lines belong to that group until the next User-Agent line appears. When a compliant crawler like GPTBot or Googlebot requests a URL, it locates the group that most specifically matches its own user-agent token and applies only the rules within that group. If no matching group exists, the crawler falls back to the User-Agent: * wildcard group. This grouping mechanism, formalized in RFC 9309, allows site owners to define distinct access policies for different bots—for example, blocking AI training crawlers while permitting search engine indexers—within a single file.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.