Builds ยท mentor.work ยท AI view

Idea2Post Agent Mode: turning a working content SaaS into an autonomous operator with Hermes

What I Built

Idea2Post Agent Mode — a new autonomous "Agent" tab inside an already-shipped content SaaS (idea2post.app). The existing product is a one-shot generator: paste an idea, get hooks/blog/social posts. Useful, but it's still a stateless AI wrapper — the user has to decide what to generate.

Agent Mode flips that. The user types a goal — "What should I post on Facebook this week?" — and a Hermes Agent autonomously:

  1. Pulls the system's own state (queued jobs, recent content) via MCP tools
  2. Reads the most recent posts from the user's tracked competitors (real crawler signal, not made up)
  3. Analyzes the engagement and identifies underserved themes
  4. Optionally calls the existing in-house content generator for concrete drafts
  5. Reports back with citations to the actual data it used

Crucially, none of the existing flows were touched. Quick Mode (one-shot generation), auto-pipelines (cron-driven crawl→generate→publish loops), and the 7 background workers all keep running unchanged. Agent Mode is a parallel route that orchestrates the same building blocks in a different sequence.

The whole layer is roughly:

Browser  โ”€โ”€SSEโ”€โ”€โ–ถ  PHP proxy  โ”€โ”€HTTPโ”€โ”€โ–ถ  Hermes Agent
                                         (gateway @ :8642)
                                              โ”‚
                                              โ”œโ”€ web search (built-in)
                                              โ””โ”€ idea2post MCP server (stdio)
                                                     โ”‚
                                                     โ””โ”€โ–ถ PHP CLI โ”€โ–ถ MySQL + content engine

Demo

Live agent run inside the dashboard. Notice:

  • Tool chips (๐Ÿ”ง status_report, ๐Ÿ”ง recent_competitor_posts) appear as Hermes calls them, pulsing while running, turning green when complete
  • Content streams in token-by-token after research finishes
  • Numbers and competitor names in the reply come from the real database, not the LLM's imagination

[ https://youtu.be/7e4dsX8pd1s — record from cp.idea2post.app/?page=i2p-agent]

Quick prompts the demo runs:

  • "What should I post on Facebook this week? Check my competitor signal and propose 3 angles."
  • "Give me a status report — queued jobs, content last 7 days, active pipelines, recent competitor activity."
  • "Generate a full content plan: research recent competitor posts, pick the most engaging theme, draft 1 blog + 3 FB posts."

Code

https://github.com/melyx-id/idea2post-agent

Key files:

Layer Path Lines
MCP server (Python, FastMCP) — exposes idea2post engine as tools opt/idea2post-mcp/server.py ~95
PHP CLI bridge — talks to MySQL + existing content engine engine/i2p_agent_cli.php ~110
Agent UI (chat, streaming) pages/i2p-agent.php ~270
SSE proxy: browser ↔ Hermes Agent pages/i2p-agent-api-stream.php ~110

My Tech Stack

  • Hermes Agent v0.14.0 — running as a systemd user service on a Ubuntu 22.04 VPS
  • LLM: openai/gpt-oss-120b:free via OpenRouter (free tier, supports tool calling)
  • MCP: official mcp Python SDK (FastMCP) over stdio
  • Backend: existing SaaS — PHP 8.3, MySQL 10.6 (MariaDB), Apache → Caddy
  • Frontend: vanilla JS + Tailwind CDN, Server-Sent Events for live tool/token streaming
  • Infra: Caddy reverse proxy, idea2post's existing 7-worker cron stack

No new frameworks, no rewrites. The whole agent layer is ~600 lines.

How I Used Hermes Agent

Three Hermes capabilities did the heavy lifting:

1. The agent loop itself. I didn't want to write a tool-calling state machine. Hermes' /v1/chat/completions endpoint already runs the full reasoning→tool→observe→reason loop internally. My PHP backend just POSTs the user's goal and reads the stream. Multi-turn tool calls, retries, compression, all handled.

2. MCP for tool surface. Instead of hard-coding tools into the prompt, I built a small Python MCP server that exposes 7 idea2post operations (status_report, list_competitors, recent_competitor_posts, list_publish_accounts, list_pipelines, generate_content, queue_publish). Each tool internally shells out to a PHP CLI that talks to the real MySQL and the existing content engine. hermes mcp add idea2post --command ... registered it in one line. Adding a new capability later means adding one function in server.py — Hermes picks it up.

3. The streaming protocol. Hermes' SSE stream emits both standard OpenAI chat.completion.chunk frames and custom hermes.tool.progress events with status: running / completed per tool call. This is the difference between "spinner for 30 seconds" and "the agent is visibly thinking" — chip turns from purple-pulsing to green-โœ“ in real time as each MCP tool returns. Massive UX upgrade for ~30 lines of frontend code.

Why this was the right fit. I had a working SaaS that already did the expensive work — competitor crawlers, content generation, FB/LinkedIn publishing. What I was missing was an orchestration layer that could reason over which subsystem to invoke for a given high-level goal. Hermes provided that layer without forcing a rewrite. The existing one-shot generator at ?page=i2p-generate is now one of many tools the agent can call, instead of being the entire product.

The net result: same SaaS, but the user can ask it open-ended questions and watch it autonomously chain research → analysis → generation. That's the leap from "AI wrapper" to "agent product" — and Hermes did 80% of it.
Link: https://dev.to/mervindublin/idea2post-agent-mode-turning-a-working-content-saas-into-an-autonomous-operator-with-hermes-3g


This article was AI-assisted and edited by Mervin. All facts were verified against primary sources before publishing.