{"slug": "my-ai-agent-could-publish-it-couldn-t-reply-to-a-comment", "title": "My AI Agent Could Publish. It Couldn't Reply to a Comment.", "summary": "A developer built a scheduled content agent that reads article metrics, selects topics, and publishes to Dev.to via the documented articles API, but found it could not post comment replies despite holding a valid API key. The public comments endpoint returned an id_code while the web reply form required a numeric DOM comment ID, the API route returned 404, and the web route failed CSRF validation without an authenticated browser session and rendered-page token. The developer split the workflow so the agent proposes replies for separate review rather than treating prepared actions as completed ones, and this week it posted neither of two proposed replies because the browser session was logged out.", "body_md": "I built a scheduled content agent that can read article metrics, choose a topic, publish to Dev.to, and check the result.\n\nPublishing worked first time. The agent had an API key and used the documented article endpoint:\n\n```\nPOST /api/articles\napi-key: ...\n```\n\nThen I added the less glamorous part: reply to comments that do not already have a response from me.\n\nThe agent could find the comments. It could identify the author, article, thread, and whether a reply already existed. It still could not post one.\n\nThe failure was not the language model. It was the authentication boundary.\n\nThe public comments endpoint returned an `id_code`, but posting a reply through the web form wanted a numeric DOM comment ID. Posting to the API route returned `404`. Posting to the web route with only the API key failed CSRF validation.\n\nThe working web request needs three different things:\n\n```\nauthenticated browser session\nCSRF token from the rendered page\nnumeric parent comment ID from the DOM\n```\n\nThe API key was valid. It was just valid for a different capability.\n\nThat distinction matters in agent infrastructure. “The agent has credentials” is too vague to be useful. A credential authorises a particular action through a particular interface. It does not automatically create a browser session, satisfy CSRF protection, or prove that the side effect landed in the right thread.\n\nI split the workflow instead of trying to make one credential do everything:\n\nThat last rule is important. An autonomous agent should not turn “I prepared the action” into “I completed the action.”\n\nThis week the agent found two unanswered comments and passed both proposed replies through a separate review for self-replies, duplicates, wrong parents, and generic wording. The browser session was logged out, so it posted neither.\n\nThat is a partial failure, but it is the honest one.\n\nThe useful lesson: agent permissions are not a boolean. Model capability, API credentials, browser identity, anti-forgery tokens, and post-action verification are separate parts of the system. Treating them separately makes the automation less magical and much easier to trust.", "url": "https://wpnews.pro/news/my-ai-agent-could-publish-it-couldn-t-reply-to-a-comment", "canonical_source": "https://dev.to/toddsullivan/my-ai-agent-could-publish-it-couldnt-reply-to-a-comment-9n7", "published_at": "2026-11-10 09:07:27+00:00", "updated_at": "2026-11-10 09:21:40.011636+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools"], "entities": ["Dev.to"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/my-ai-agent-could-publish-it-couldn-t-reply-to-a-comment", "markdown": "https://wpnews.pro/news/my-ai-agent-could-publish-it-couldn-t-reply-to-a-comment.md", "text": "https://wpnews.pro/news/my-ai-agent-could-publish-it-couldn-t-reply-to-a-comment.txt", "jsonld": "https://wpnews.pro/news/my-ai-agent-could-publish-it-couldn-t-reply-to-a-comment.jsonld"}}