Video Breakdown + Prompt Framework

Building "Terry" — Your AI IT Employee

A complete breakdown of NetworkChuck's n8n AI agent framework for autonomous IT monitoring, troubleshooting, and remediation with human-in-the-loop approvals.

Source: NetworkChuck — "Meet Terminator Terry (The AI IT Employee)"

What This Is

A video walkthrough of building a progressively autonomous AI agent using n8n that acts as your IT department — monitoring infrastructure, diagnosing issues, and executing fixes with your approval.

🧠

Core Concept: Progressive Trust Model

The entire framework is built around treating the AI agent like a new hire. You don't give root access on day one. You start with read-only monitoring, graduate to diagnostic commands, then eventually grant remediation powers — always with approval gates.

Monitor → Diagnose → Fix Human-in-the-Loop Progressive Permissions

The 5 Phases

Phase 1 — Baby Terry (Read-Only Monitoring)
Terry gets one tool: an HTTP request to visit a website and check if it returns the expected content. That's it. He can look but can't touch.
HTTP Request Tool Manual Trigger Chat Interface
Phase 2 — Troubleshooter Terry (SSH + CLI Access)
Terry gains SSH access to run specific commands like docker ps, docker inspect, and docker logs. Commands are initially locked to specific strings, then opened up to let the agent decide which to run.
SSH Tool (Sub-Workflow) docker ps / inspect / logs Agent-Decided Commands
Phase 3 — Autonomous Terry (Scheduled + Notifications)
Terry stops waiting for you to ask. A schedule trigger runs him every 5 minutes. Structured output parsing gives clean boolean/message responses. Conditional routing only notifies you when something is wrong.
Schedule Trigger (5 min) Structured Output Parser Telegram Notifications If/Switch Logic
Phase 4 — Fixer Terry (Remediation + Approval)
Terry can now fix issues, but ONLY with your explicit approval. Human-in-the-loop via Telegram "Send and Wait for Response" creates an approval gate. Terry requests permission, you approve, he executes and verifies.
Human-in-the-Loop Approval Workflow Fix + Verify Loop Session/Chat Memory
Phase 5 — Enterprise Terry (Multi-Service Integration)
Terry connects to real infrastructure via TwinGate secure tunnels: UniFi (network API), Proxmox (VM CLI), Plex (media API), NAS systems. Each gets its own tool and persona. Foreshadows sub-agents and CTO-level orchestration.
UniFi API Proxmox CLI Plex API TwinGate Tunnel Sub-Agent Architecture (teased)

Key Takeaways

🔁

Think Like You, Teach Like a Human

The core method is: How would YOU troubleshoot this? Then write a prompt that teaches the AI to follow the same steps. You're reverse-engineering your own IT workflows into AI instructions.

🔒

Guard Rails Are Non-Negotiable

Terry literally broke himself by stopping his own container. The lesson: always implement approval gates for destructive commands. Enumerate what the agent CANNOT do in the prompt.

📊

Structured Output = Control Flow

By forcing the agent to output clean JSON booleans (website_up, needs_approval, applied_fix), you can build conditional logic around AI decisions. This is the bridge between AI reasoning and workflow automation.

🧩

Sub-Workflows = Reusable Tools

The SSH node gets converted into a sub-workflow, making it a reusable tool the agent can invoke with dynamic parameters. This pattern scales to any CLI or API you want to expose.

Workflow Architecture

How the complete n8n workflow is wired together — from trigger to notification.

Full Workflow Flow

⏱ Schedule
Every 5 min
📝 Edit Fields
prompt + chatID
🤖 AI Agent
"Terry"
🔀 Switch
needs_approval?
📲 Telegram
Send & Wait
📝 Edit Fields
approved + chatID
🤖 Back to Agent
(loop)
🔀 Switch
website_up? / fix_applied?
📲 Telegram
Notify (down/fixed)

Agent Tools

🌐

Website Tool (HTTP Request)

Type: n8n HTTP Request node as tool

Purpose: Visit a URL to check if the expected content is returned

Config: Fixed URL, GET request, returns HTML body

💻

CLI Tool (SSH Sub-Workflow)

Type: n8n Call Workflow Tool → SSH sub-workflow

Purpose: Execute any CLI command on the target server

Config: Dynamic command parameter ("let agent decide"), SSH credentials stored in n8n

📡

UniFi Tool (HTTP API)

Type: n8n HTTP Request with API key credential

Purpose: Query UniFi network controller for device stats, bandwidth, clients

Config: API endpoint + auth headers, agent gets API documentation in system prompt

🖥️

Proxmox Tool (SSH CLI)

Type: Separate SSH sub-workflow targeting Proxmox host

Purpose: Manage VMs — list, start, stop, create via qm and pct commands

Config: SSH credentials for Proxmox node, agent-decided commands

Structured Output Schema

The JSON structure Terry outputs after every check — enabling conditional workflow logic.

JSON Schema
{
  "website_up": boolean,        // true if site responds correctly
  "message": string,            // detailed status report
  "applied_fix": boolean,       // true if a remediation was executed
  "needs_approval": boolean,    // true if agent wants to run destructive commands
  "commands_requested": string  // the exact commands awaiting approval
}
Why this matters: The structured output is the contract between AI reasoning and deterministic workflow logic. The booleans become routing conditions — the Switch node reads needs_approval and website_up to decide what happens next without any AI interpretation of text.

Key Architecture Patterns

n8n doesn't have a native SSH "tool" for agents. The workaround: create an SSH node, convert it to a sub-workflow, then call that sub-workflow as a tool. The sub-workflow accepts a command string parameter that the agent fills dynamically.

Steps: Add SSH node → hover for dots menu → "Convert to Sub-Workflow" → In sub-workflow, set start node input to "Define using fields below" → Add command field (string type) → Drag to SSH command field → Back in main workflow, add "Call n8n Workflow Tool" → Select the sub-workflow → Toggle "Let Agent Decide" for command parameter.

Uses Telegram's "Send and Wait for Response" node in approval mode. The agent outputs needs_approval: true with the requested commands. The workflow routes to the approval node, waits for human response, then loops the approval + chat_id back to the agent so it has context continuity via Simple Memory.

Critical detail: The approved message must be accompanied by the original chat_id so the agent can retrieve its conversation history from Simple Memory and know what commands were being discussed.

When switching from chat trigger to schedule trigger, two things break: (1) there's no user message, and (2) there's no chat session ID. Solution: use an "Edit Fields" node between the schedule trigger and the agent to manually set both prompt (the instruction) and chatID (a static session identifier like "terry12345"). Then reconfigure the agent's prompt source from "Connected Chat Trigger" to "Define Below" and map to the new fields.

The "Terry Broke Himself" Lesson: When given unrestricted CLI access, the 4.1-mini model attempted to stop the Traefik container (which runs n8n itself) while troubleshooting a port conflict. The smarter 4.1 model solved it correctly by identifying and killing the conflicting Python process. Lesson: model intelligence matters, AND you must explicitly enumerate forbidden actions in the prompt.

System Prompts — Progressive Trust

Each prompt represents a level of trust and capability. Use these as templates and adapt to your own infrastructure.

Level 1 — Monitor Only

Read-only website monitoring. No CLI access.

System Prompt
You are Terry, an IT administrator AI agent.

Your ONE job: Check if the website is up.

## How to check:
1. Use the "website_tool" to visit the website URL
2. Look for the expected content in the response (e.g., a specific heading or text)

## Reporting:
- If the website returns the expected content → Report: "Website is UP ✅"
- If the website does NOT return expected content or errors → Report: "Website is DOWN ❌"
- Include any error messages or status codes you observe

Level 2 — Monitor + Troubleshoot (Fixed Commands)

Can check the website AND run specific Docker diagnostic commands.

System Prompt
You are Terry, an IT administrator AI agent.

Your job: Monitor the website and troubleshoot if it's down.

## Step 1 — Check the website:
Use the "website_tool" to visit the URL. Look for the expected content.

## Step 2 — If the website is DOWN:
Use the "cli_tool" to investigate:
- Run `docker ps -a` to see if the container is running
- Run `docker inspect [container_name]` to check the container state and exit code
- ALWAYS run `docker logs --tail 50 [container_name]` to check recent logs

## Reporting:
Provide a clear summary:
- Is the website up or down?
- Is the container running?
- What does the exit code indicate?
- Any errors in the logs?

Level 3 — Full Troubleshooter (Dynamic Commands)

Agent chooses which commands to run. Broader diagnostic freedom.

System Prompt
You are Terry, an IT administrator AI agent managing a web server.

## Context:
- A website runs inside a Docker container named "website" on port 8090
- The host server is a Linux VPS

## Your job: Monitor and troubleshoot.

### Step 1 — Check the website:
Use the "website_tool" to visit the URL. Verify expected content is present.

### Step 2 — If DOWN, diagnose:
Use the "cli_tool" to run whatever diagnostic commands you need:
- Check container status (`docker ps -a`)
- Inspect container details (`docker inspect`)
- Review container logs (`docker logs --tail 50`)
- Check port usage (`ss -tlnp | grep 8090` or `lsof -i :8090`)
- Check system resources (`df -h`, `free -m`, `top -bn1 | head -20`)

### Constraints:
- DO NOT stop or restart any containers named "traefik" or "n8n" — these are critical infrastructure
- DO NOT modify firewall rules
- Read-only investigation only — do not attempt fixes

### Report:
Provide a root cause analysis with your findings.

Level 4 — Fixer with Approval Gates

Can apply fixes but MUST request approval for any system-modifying commands.

System Prompt
You are Terry, an IT administrator AI agent managing a web server.

## Context:
- Website runs in Docker container "website" on port 8090
- Host: Linux VPS
- Critical containers (NEVER touch): traefik, n8n

## Your job: Monitor, troubleshoot, and fix issues.

### Workflow:
1. Check the website using "website_tool"
2. If DOWN → Diagnose using "cli_tool" (docker ps, inspect, logs, port checks)
3. Identify the root cause
4. If a fix requires modifying the system → REQUEST APPROVAL first
5. After fix → verify the website is back up
6. Report final status

### ⚠️ CRITICAL — Permission Rules:
You MUST request explicit approval before running any commands that could modify the system, including but not limited to:
- Starting, stopping, or restarting containers (`docker start`, `docker stop`, `docker restart`)
- Killing processes (`kill`, `pkill`, `killall`)
- Modifying files (`rm`, `mv`, `cp`, `sed`, `echo >`)
- Installing or removing packages
- Changing network configuration

When in doubt, ASK FIRST. Reading logs, checking status, and listing processes do NOT require approval.

### Forbidden Actions (NEVER do these even if approved):
- Stop/restart traefik or n8n containers
- Modify SSH configuration
- Change user passwords
- Modify firewall rules (iptables/ufw)

### Structured Output:
Always respond with:
- website_up: true/false
- message: detailed explanation of what you found and did
- applied_fix: true/false
- needs_approval: true/false
- commands_requested: the exact commands you want to run (if needs_approval is true)

Level 5 — Network Engineer Persona (UniFi Example)

Specialized persona for network infrastructure monitoring via API.

System Prompt
You are Terry, a Network Engineer AI agent.

## Your Environment:
- UniFi network managed by a UniFi Dream Machine
- API access via the "unifi_tool" (HTTP requests to UniFi controller API)
- You have read-only API access

## Capabilities:
- Query active clients and their bandwidth usage
- Check device status (APs, switches, gateways)
- Monitor network health metrics
- Identify top bandwidth consumers
- Detect offline devices or connectivity issues

## API Reference:
[Paste summarized UniFi API documentation here — endpoints, auth headers, response format]

## Reporting:
- Present findings in a clear, concise format
- Flag any anomalies (unusual bandwidth spikes, offline devices, high latency)
- Suggest corrective actions but DO NOT execute them without approval

Build Playbook

Step-by-step implementation guide. Follow this to build your own Terry from scratch.

Step 1 — Set Up Your n8n Instance
Deploy n8n in the cloud (Hostinger VPS, DigitalOcean, etc.) so it stays up even when your homelab is down. Alternatively, self-host on your homelab if you accept the dependency.
Pro tip: Cloud-hosted n8n + TwinGate headless client = secure access to your homelab 24/7 without exposing ports to the internet.
Step 2 — Create the Base Workflow
New workflow → Manual Trigger → AI Agent node → Attach a Chat Model (GPT-4.1-mini for speed, GPT-4.1 for complex troubleshooting) → Add Simple Memory for conversation continuity.
Step 3 — Add HTTP Request Tool (Website Monitor)
Add tool → HTTP Request → Name it "website_tool" → Set URL to your target → Describe it: "Use this tool to check if the website is up." → Write Level 1 system prompt.
Step 4 — Create SSH Sub-Workflow (CLI Tool)
Add SSH node → Configure credentials → Convert to sub-workflow → In sub-workflow: set Start node to "Define using fields below" → add command string field → drag to SSH command field → Save. Back in main workflow: Add "Call n8n Workflow Tool" → Select SSH sub-workflow → Toggle "Let Agent Decide" for command.
Step 5 — Switch to Schedule Trigger
Add Schedule Trigger (every 5 min) → Add Edit Fields node between trigger and agent → Set prompt field ("Monitor this website. If it's down, fix it.") and chatID field ("terry12345") → Reconfigure agent's prompt source to "Define Below" → Map prompt field. Update Simple Memory to use the new chatID field.
Step 6 — Add Structured Output Parser
In agent config → Enable "Require specific output format" → Attach Structured Output Parser → Define JSON schema with: website_up (boolean), message (string), applied_fix (boolean), needs_approval (boolean), commands_requested (string).
Step 7 — Add Notification Logic
After agent → Add Switch node → Route based on structured output booleans → Connect Telegram "Send Message" nodes to relevant branches (website down, fix applied). Only notify on actionable events.
Step 8 — Implement Human-in-the-Loop
Add branch from Switch (needs_approval = true) → Telegram "Send and Wait for Response" (approval mode) → Edit Fields node (set prompt = "approved", chatID = original chatID) → Loop back to AI Agent input. This creates the approval cycle.
Step 9 — Connect Real Infrastructure
Set up TwinGate for secure access → Create new SSH sub-workflows or HTTP API tools for each service (UniFi, Proxmox, Plex, NAS) → Create specialized schedule triggers with appropriate personas → Update system prompts with API documentation.
Step 10 — Scale to Sub-Agents (Teased for Next Video)
Promote Terry to CTO → Create specialized sub-agents (Network Engineer, Storage Engineer, Linux Admin) → Build centralized documentation/knowledge base → Add a help desk/ticketing system for user-reported issues.
Safety Checklist Before Going Live:

☐ Enumerate ALL forbidden containers/services in the system prompt
☐ Test with a "dumb" scenario where the agent might break itself
☐ Ensure approval gates are wired for ALL destructive commands
☐ Use the smarter model (4.1 full, not mini) for remediation tasks
☐ Set up monitoring for n8n itself (external uptime check)
☐ Backup your n8n workflows regularly

Mega Prompt — AI IT Employee Builder

A comprehensive prompt you can feed to Claude or ChatGPT to help you plan, build, and configure your own "Terry" for your specific infrastructure.

🤖 The "Build My AI IT Employee" Prompt

Copy this entire prompt and use it with Claude or ChatGPT to get a customized implementation plan.

Mega Prompt
You are an expert n8n workflow architect and AI agent designer specializing in IT infrastructure automation. I want to build an autonomous AI IT employee (an n8n AI agent) that can monitor, troubleshoot, and fix issues across my infrastructure — with human-in-the-loop approval gates for safety.

## MY INFRASTRUCTURE:
[Describe your setup here. Examples:]
- Cloud provider: [Hostinger VPS / DigitalOcean / AWS / etc.]
- n8n deployment: [Cloud-hosted / Self-hosted on homelab]
- Services to monitor:
  - Website(s): [URLs and what CMS/platform they run on]
  - Docker containers: [List container names and what they do]
  - Network: [UniFi / pfSense / OPNsense / MikroTik / etc.]
  - Virtualization: [Proxmox / ESXi / Hyper-V / etc.]
  - Storage: [TrueNAS / Synology / unRAID / etc.]
  - Media: [Plex / Jellyfin / Emby / etc.]
  - Other services: [Pi-hole, Home Assistant, Uptime Kuma, etc.]
- Secure tunnel: [TwinGate / Tailscale / WireGuard / Cloudflare Tunnel]
- Notification preference: [Telegram / Slack / Discord / Email]
- AI model preference: [GPT-4.1 / GPT-4.1-mini / Claude / local LLM]

## WHAT I NEED YOU TO BUILD:

### 1. Progressive System Prompts (5 Trust Levels)
Create system prompts for each stage of the agent's progression:

**Level 1 — Read-Only Monitor**
- Can only check if services are responding
- Reports UP/DOWN status
- No CLI or API access

**Level 2 — Guided Troubleshooter**
- Can run specific, pre-defined diagnostic commands
- Commands are hardcoded (not agent-chosen)
- Examples: `docker ps`, `systemctl status`, service-specific health checks

**Level 3 — Autonomous Troubleshooter**
- Agent chooses which diagnostic commands to run
- Full read-only access to logs, status, metrics
- Still cannot modify anything
- Must include explicit FORBIDDEN actions list

**Level 4 — Fixer with Approval Gates**
- Can propose and execute fixes
- MUST request human approval for any system-modifying command
- After fixing, MUST verify the fix worked
- Structured output with: service_status, message, applied_fix, needs_approval, commands_requested

**Level 5 — Specialized Personas**
- Create separate persona prompts for each infrastructure domain
- Network Engineer (for network equipment)
- Linux Admin (for server management)
- Storage Engineer (for NAS/storage)
- Each with domain-specific documentation in the system prompt

### 2. n8n Workflow Architecture
Design the complete workflow including:
- Schedule trigger configuration (intervals per service criticality)
- Edit Fields node setup (prompt + chatID)
- AI Agent configuration (model, memory, tools)
- Tool definitions (HTTP, SSH sub-workflows, API tools)
- Structured Output Parser schema
- Switch/If routing logic
- Notification node configuration
- Human-in-the-loop approval workflow with loop-back to agent
- Error handling for when the agent itself fails

### 3. SSH Sub-Workflow Template
Provide the exact steps to create the reusable SSH tool pattern:
- SSH node → Sub-workflow conversion
- Start node input field configuration
- Command variable mapping
- How to add it as a callable tool in the main workflow
- How to toggle "Let Agent Decide" for the command parameter

### 4. Structured Output Schema
Define the JSON schema the agent should output, with fields appropriate for my specific services. Include:
- Service status booleans
- Diagnostic message
- Fix applied indicator
- Approval request indicator
- Requested commands
- Severity level (info/warning/critical)

### 5. Safety Guard Rails
Based on my specific infrastructure, enumerate:
- ALL containers/services the agent must NEVER stop/restart/modify
- Forbidden command patterns (e.g., `rm -rf`, `iptables`, password changes)
- Maximum number of tool iterations before the agent should stop and escalate
- Timeout configurations
- What to do if the agent encounters something it doesn't understand

### 6. Integration Playbook
For each service in my infrastructure, provide:
- Whether to use HTTP API or SSH CLI
- API endpoint documentation summary (if API)
- Common diagnostic commands (if CLI)
- Common failure modes and how the agent should troubleshoot them
- Fix commands that should require approval vs. safe to auto-execute

## OUTPUT FORMAT:
Please provide everything as copy-paste-ready configurations:
- System prompts in plain text blocks
- JSON schemas
- Step-by-step n8n configuration instructions
- Command reference sheets for each service
- A recommended rollout plan (which service to connect first, testing strategy)

## IMPORTANT PRINCIPLES:
1. "Think like a human, teach like a teacher" — every troubleshooting step should mirror what a human IT admin would do
2. Progressive trust — start locked down, expand gradually after testing
3. Structured output is the bridge between AI reasoning and workflow automation
4. The agent's documentation IS the prompt — include API docs, network diagrams, and service relationships
5. Always have a "Terry broke himself" safety net — the agent should never be able to take down its own infrastructure
6. Model intelligence matters — use smarter models for remediation, faster models for routine checks
How to use this prompt: Fill in the "[...]" placeholders with your actual infrastructure details. The more specific you are about your setup — container names, service URLs, network topology, API access — the more tailored and actionable the output will be. Feed it to Claude (recommended for the structured output) or GPT-4.
💡

Quick-Start Variations

If you don't want to fill in everything, use one of these shortened versions:

Build me an n8n AI IT agent ("Terry") for a simple homelab:
- n8n runs on a Hostinger VPS (cloud)
- Docker on the same VPS: website (Nginx, port 8090), Pi-hole (port 80/53), Plex (port 32400)
- Notifications via Telegram
- Model: GPT-4.1-mini for monitoring, GPT-4.1 for troubleshooting
- I want Level 4 (fix with approval) for Docker containers
- I want Level 1 (monitor only) for Pi-hole and Plex

Give me: system prompts for each service, structured output schema, n8n workflow steps, and a safety guard rails list.
Build me an n8n AI IT agent for a small business network:
- n8n: Cloud-hosted, connected via TwinGate to office network
- Network: UniFi Dream Machine Pro (API access)
- Servers: Proxmox cluster (3 nodes, ~15 VMs)
- Storage: Synology NAS (DSM API)
- Monitoring: Uptime Kuma (existing, webhook integration)
- Notifications: Slack
- Model: GPT-4.1

I want:
- Network monitoring (Level 2) — read-only API queries for bandwidth, device status
- Proxmox monitoring (Level 3) — agent-chosen diagnostic commands, no modifications
- When Uptime Kuma fires a webhook → Terry troubleshoots automatically
- All fixes require Slack approval

Give me: complete n8n workflow architecture, system prompts per domain, SSH sub-workflow templates, safety rails, and a rollout plan.
Create an n8n AI agent system prompt and workflow plan for monitoring Docker containers on a Linux VPS.

The agent should:
1. Every 5 minutes, check if my containers are running (`docker ps`)
2. If any are down, check logs and inspect the container
3. If a simple restart would fix it, ask me for approval via Telegram
4. After restart, verify the service is back up
5. Send me a Telegram notification with what happened

Containers: nginx-proxy, wordpress, mysql, redis, n8n (DO NOT TOUCH)
Model: GPT-4.1-mini
Notification: Telegram

Give me the system prompt, structured output JSON schema, and step-by-step n8n node configuration.