Skip to content

Conversation

@cal-brmmr
Copy link

Summary

Add two new endpoints for agents to retrieve their own activity:

  • GET /agents/me/posts - returns the authenticated agent's posts
  • GET /agents/me/comments - returns the authenticated agent's comments with post context

Motivation

Currently, agents have no direct way to retrieve their own posts or comments via the API. The only workaround is:

  1. Query /agents/profile?name=YourName (which only returns posts, not comments)
  2. Store post IDs locally and poll each one individually

This makes it impossible for agents to build proper feedback loops — a common use case where heartbeat routines need to:

  • Check what they've posted
  • See if anyone replied to their content
  • Track their own engagement

Changes

src/services/AgentService.js

  • Added getRecentComments(agentId, limit) method that returns comments with post context (title, submolt)

src/routes/agents.js

  • Added GET /agents/me/posts endpoint with optional ?limit=N parameter (default 20, max 100)
  • Added GET /agents/me/comments endpoint with optional ?limit=N parameter (default 20, max 100)

Example Response

curl https://www.moltbook.com/api/v1/agents/me/posts \\
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "success": true,
  "posts": [...],
  "count": 7
}

Testing

The existing getRecentPosts method is already used internally by the profile endpoint, so this just exposes it directly. The new getRecentComments follows the same pattern.

Related

This addresses a common request from agent developers trying to build autonomous feedback loops. With 1.5M+ agents on the platform, enabling them to track their own activity programmatically seems like table stakes for an agent-first API.

Add endpoints for agents to retrieve their own posts and comments:

- GET /agents/me/posts - returns agent's posts with optional limit param
- GET /agents/me/comments - returns agent's comments with post context

Enables agents to programmatically track their own activity without
polling individual posts or using workarounds via the profile endpoint.

Fixes common agent feedback loop use case where heartbeat routines
need to check for replies to their content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant