Agent builds executable deterministic workflows
The agent produces persistent versioned artifacts, not ephemeral answers. Same
workflow_id, same processing
graph, same result — automation you can verify and reproduce.
Problem
A chat agent solves a task from scratch every time. Same request → different implementation each time, varying quality, no version, no audit trail. Acceptable for a one-off task. For repeating production automation — this is the absence of reproducibility as a property.
Methodology
The agent produces persistent versioned artifacts, not ephemeral responses.
- 1. Architecture: IDE → MCP server → n8n REST API. No UI automation; only the contract via MCP and REST.
-
2. Agent loop: search for an existing workflow in
workflows/→ if none, design the graph → export JSON + metadata → import into n8n via API → test run → activate on validation → for repeating tasks reuse the verified workflow (don't regenerate). -
3. Dual-file pattern:
<name>.workflow.json(n8n export) +<name>.meta.md(YAML frontmatter with agent guidance andn8n_workflow_id, so subsequent runs target the same stable instance).
<!-- daily-sales-sync.meta.md -->
---
schema_version: 1
slug: daily-sales-sync
name: Daily Sales Sync
summary: Syncs orders from Bitrix to ERP every morning
status: active
tags: [sales, sync, erp]
triggers: [cron]
version: 3
updated: 2026-05-01
n8n_workflow_id: 47
owner: data-platform
mcp_agent: >
Do NOT recreate this workflow — it is bound to n8n_workflow_id: 47.
When the source schema changes, edit only nodes[2].parameters;
do not touch credentials or triggers.
---
The paired daily-sales-sync.workflow.json
is the exported graph from n8n. n8n_workflow_id: 47
is what turns "agent created a workflow" into "agent updated the same workflow":
reproducibility depends on this field.
- 4. Infrastructure isolation: Docker Compose brings up a dedicated n8n on non-default ports — no conflicts with other local installations.
-
5. Autonomy boundary: the agent knows only credential
names in n8n, not their values. It references
credentialIdin the graph — but cannot read the token or password.
Artifact
github.com/dobryakov/ai-n8n-workflow-builder
(Python). Reproducible:
run-n8n-mcp.sh reads env
and starts the MCP via npx.
Where it breaks
-
Drift between git and the n8n UI.
Someone edited a workflow directly in the interface —
workflow.jsonis now stale. The pattern only works with discipline: all changes through the agent, not through the UI. -
Stale
meta.md. If guidance isn't updated after the source schema changes — the agent does "right by the instructions, but wrong in fact." The accuracy ofmeta.mdis a responsibility, not an automatic property. - The pattern guarantees the same graph, not the same result. Execution determinism ≠ idempotency of side effects. The same workflow run twice may create duplicates in downstream systems — if those systems aren't idempotent.
For whom and why
The thesis "persistent artifacts vs ephemeral chat" is about reproducibility as an architectural principle, not an n8n tutorial. Directly in the frame of enterprise AI enablement: how to make agent automation versionable and auditable.
Want reproducible, auditable agent automation in your processes?
Versioned, auditable workflows instead of one-off chat sessions — agent automation that can be verified and repeated.
Email meOther breakdowns
An engineering breakdown series: real task → methodology → working artifact → honest breakdown of where it fails.
Back to series →