eliza icon indicating copy to clipboard operation
eliza copied to clipboard

API endpoint /api/agents/:agentId/rooms returns empty list despite agent being active in rooms

Open standujar opened this issue 7 months ago • 1 comments

Describe the bug

The API endpoint /api/agents/:agentId/rooms returns an empty list of rooms ({"success":true,"data":{"rooms":[]}}) even though the agent is actively participating in multiple rooms and responding to messages in those rooms.

To Reproduce

Start the agent with multiple connected services (Discord, Telegram, etc.) Verify the agent is responding to messages in rooms (e.g., Discord channels) Call the API endpoint GET /api/agents/:agentId/rooms Observe that the response contains an empty rooms array despite the agent being active in rooms

Expected behavior

The API should return a list of all rooms where the agent is a participant. For example:

{
  "success": true,
  "data": {
    "rooms": [
      {
        "id": "room-id-1",
        "name": "Room Name 1",
        "source": "discord",
        ...
      },
      ...
    ]
  }
}

Additional context

  • In the agent logs, there are numerous successful room creations: Room [UUID] created successfully
  • Agent connection to rooms is also logged: Success: Successfully connected entity [agentId] in room [roomId]
  • When a message is received and processed in a room, the agent correctly responds
  • The logs show an error: ERROR: No room found for settings provider which might be related
  • The issue appears to be in the association between the agent and rooms in the database, or in how getRoomsForParticipant retrieves this information
  • The function that calls this API is in eliza/packages/cli/src/server/api/agent.ts, which delegates to runtime.getRoomsForParticipant(agentId) which in turn delegates to the database adapter

standujar avatar May 26 '25 08:05 standujar

@standujar Good catch ser, thank you. Added fix here: https://github.com/elizaOS/eliza/pull/4796

0xbbjoker avatar May 27 '25 13:05 0xbbjoker