---
title: "Building scalable AI agents with modular prompt transpilation"
description: "Monolithic system prompts become difficult to reason about, test, and change as teams add safety policies, domain rules, formatting requirements, and escalation behaviors. The proposed approach treats prompts as software artifacts: modular skill files are composed with includes, variables, and macros, then transpiled into deterministic artifacts. Build-time validation checks missing imports, undefined variables, and circular dependencies, while dependency graphs and CI/CD golden-file comparisons catch drift before deployment. At runtime, progressive disclosure keeps a stable control plane loaded while agents retrieve task-specific skills, reducing context exhaustion and noise. Agents can propose new skill modules or import changes through pull requests, but human review and evaluation remain part of the merge process."
---

# Building scalable AI agents with modular prompt transpilation

[Google](https://yomu.fyi/company/google) · Simerus Mahesh · Jul 16, 2026

**Type:** Problem & solution

## Summary

Monolithic system prompts become difficult to reason about, test, and change as teams add safety policies, domain rules, formatting requirements, and escalation behaviors. The proposed approach treats prompts as software artifacts: modular skill files are composed with includes, variables, and macros, then transpiled into deterministic artifacts. Build-time validation checks missing imports, undefined variables, and circular dependencies, while dependency graphs and CI/CD golden-file comparisons catch drift before deployment. At runtime, progressive disclosure keeps a stable control plane loaded while agents retrieve task-specific skills, reducing context exhaustion and noise. Agents can propose new skill modules or import changes through pull requests, but human review and evaluation remain part of the merge process.

## Context

Production use causes monolithic agent prompts to accumulate safety policies, domain-specific rules, formatting requirements, escalation behaviors, and shared logic. This obscures the impact of changes, creates copy-paste drift, and defers missing-variable or invalid-import errors until runtime.

## Approach / What changed

Author prompts as modular skill files with template includes, variables, and macros, then use a transpiler to resolve dependencies and produce deterministic artifacts. Validate imports, variables, and circular dependencies during builds, compare regenerated golden files in CI, and retrieve task-specific skills dynamically while keeping stable identity and safety instructions in the compiled base prompt.

## Takeaways

- A prompt fragment can be modeled as a node in a dependency graph, allowing recursive imports and other dependency errors to be detected during the build.
- CI can regenerate a transpiled prompt and compare it with the committed golden file; differing outputs cause the build to fail and expose source-artifact drift.
- Agents may draft new skill modules and import changes as pull requests, with the transpiler, evaluations, and human review applied before a change is merged.

**Tags:** [AI Agents](https://yomu.fyi/topic/ai-agents), [Architecture](https://yomu.fyi/topic/architecture), [CI/CD](https://yomu.fyi/topic/ci-cd)

- Source: [Google](https://developers.googleblog.com/building-scalable-ai-agents-with-modular-prompt-transpilation)
- Source URL: https://developers.googleblog.com/building-scalable-ai-agents-with-modular-prompt-transpilation
- Ingested by Yomu: 2026-09-09T14:28:42.560Z

[Read original post](https://developers.googleblog.com/building-scalable-ai-agents-with-modular-prompt-transpilation)
