Skip to main content
Version: 2026.1

Agent Templates

The bundle can let an agent generate new Twig templates - page, snippet, or include-only partial. The agent reads developer-curated project context (layouts, partials, brand docs), drafts a template using Pimcore's editable Twig vocabulary, and proposes it for human review. On approval the template becomes selectable in the Pimcore document template dropdown and renders through Pimcore's normal Twig stack.

This is the write counterpart to the bundle's read/fill tools (get_document_schema, get_area_brick, the example fixtures), gated by the same HITL proposal pattern as object, document, and asset edits. For the internals, see Architecture → Agent Template Generation.

The workflow

propose → review → approve → bind → render
  1. Discover context. The agent stages a developer-curated file set (stage_file_set) to read parent layouts and reference material, and calls list_editables to see which editable types the project has installed.
  2. Draft & propose. It composes a single Twig file - type, slug, label, description - and calls propose_agent_template. The bundle validates and sandbox-renders it; only a technically valid template reaches the reviewer, and nothing is written yet.
  3. Review. The proposal card surfaces automatically in the Studio chat - the agent just proposes and stops its turn; there is no separate show step. It shows syntax-highlighted source, validation warnings, a diff for updates, or a dependency summary for deletions.
  4. Approve. The template is persisted and registered; the document template dropdown now offers it. Reject leaves disk untouched.
  5. Bind & render. An editor binds the template to a Page or Snippet; storefront requests render it normally.

What gets generated

A single flat Twig file per template, of one type:

  • page / snippet - selectable on the matching document type.
  • partial - an include-only fragment ({% include %}), never assignable to a document directly.

Templates use Pimcore editables, can {% extends %} a project layout, and may carry inline CSS. Both a hand-written <form method="post"> and Symfony form rendering ({{ form(form) }}, form_*, {% form_theme %}) are supported; the real form comes from the document's controller at request time.

MCP tools

ToolPurpose
list_editablesList the editable type names installed in this project.
propose_agent_templateValidate + sandbox-render a template, then create a create/update proposal.
propose_agent_template_deletionCreate a deletion proposal carrying document bindings and dependent templates.
list_agent_templatesList the persisted templates the current user owns.
list_thumbnail_configsList the project's named thumbnail configs (image or video) with target dimensions, to pick a valid thumbnail - required for pimcore_video, whose thumbnail must be a named string config.

stage_file_set comes from the file-staging group, not this one.

Sample documents

To preview and iterate on a generated template, the proposal card can link it to a sample document - a regular Pimcore Document under a configured folder (/_agent-samples by default) whose template field points at the template. No registration is needed: the card offers Open document when a bound document or sample already exists, and Create sample otherwise.

Refining an existing template

If the user asks the agent to fix a document that uses a project (non-agent) template, the agent can't edit the project file. Instead it clones the source into a new agent template and, on approve, repoints the document's template field to it - the original project template is left untouched. This only takes effect if the document's controller renders the document's configured template rather than a hard-coded one.

Enabling it on an agent

Enabled per agent, via its definition (the Studio agent-configuration UI, or the equivalent config - see Configuration → Agents):

FieldValue
pimcoreMcpServersinclude pimcore-agent-templates
allowedFileStagingSetsthe file sets the agent may stage
skillsdocument-template-generation
pimcore_agent:
agents:
definitions:
cms-agent:
displayName: 'CMS Agent'
model: claude-sonnet-4-6
skills: ['document-template-generation']
pimcoreMcpServers: ['pimcore-agent-templates']
allowedFileStagingSets: ['cms_layouts']

Further reading