Grigoriy Dobryakov

Howto · breakdown

Breakdown 05

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.

CTO Head of AI Architect Tech Lead

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. 1. Architecture: IDE → MCP server → n8n REST API. No UI automation; only the contract via MCP and REST.
  2. 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. 3. Dual-file pattern: <name>.workflow.json (n8n export) + <name>.meta.md (YAML frontmatter with agent guidance and n8n_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.

  1. 4. Infrastructure isolation: Docker Compose brings up a dedicated n8n on non-default ports — no conflicts with other local installations.
  2. 5. Autonomy boundary: the agent knows only credential names in n8n, not their values. It references credentialId in 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.

Series signature

Where it breaks

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 me

Other breakdowns

An engineering breakdown series: real task → methodology → working artifact → honest breakdown of where it fails.

Back to series →