hermes - 💡(How to fix) Fix [Feature]: Session List & Management REST API Endpoints [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#28859Fetched 2026-05-20 04:01:26
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×3commented ×1

Fix Action

Fix / Workaround

PATCH /v1/sessions/{session_id}

Code Example

GET /v1/sessions?limit=10&platform=api_server&search=kubernetes
Authorization: Bearer <key>

---

{
  "object": "list",
  "data": [
    {
      "id": "20260501_143012_a1b2c3d4",
      "object": "hermes.session",
      "platform": "api_server",
      "title": "Kubernetes deployment review",
      "model": "anthropic/claude-opus-4",
      "started_at": "2026-05-01T14:30:12Z",
      "last_active_at": "2026-05-01T15:42:07Z",
      "ended_at": "2026-05-01T15:42:07Z",
      "turn_count": 14,
      "parent_session_id": null
    }
  ],
  "total": 42,
  "has_more": true
}

---

{
  "id": "20260501_143012_a1b2c3d4",
  "object": "hermes.session",
  "platform": "api_server",
  "title": "Kubernetes deployment review",
  "model": "anthropic/claude-opus-4",
  "started_at": "2026-05-01T14:30:12Z",
  "last_active_at": "2026-05-01T15:42:07Z",
  "ended_at": "2026-05-01T15:42:07Z",
  "turn_count": 14,
  "parent_session_id": null,
  "child_session_ids": []
}

---

{
  "object": "list",
  "session_id": "20260501_143012_a1b2c3d4",
  "data": [
    {"role": "user",      "content": "Review my k8s deployment manifest", "timestamp": "2026-05-01T14:30:12Z"},
    {"role": "assistant", "content": "I'll take a look...",               "timestamp": "2026-05-01T14:30:18Z"}
  ],
  "has_more": false
}

---

{"title": "My updated session title"}

---

{
  "features": {
    "chat_completions": true,
    "responses_api": true,
    "run_submission": true,
    "sessions_api": true
  }
}

---
RAW_BUFFERClick to expand / collapse

Problem or Use Case

The API server currently has no way to enumerate or query past sessions. Clients that want to implement a "conversation history" panel (e.g. a JetBrains / VS Code plugin, a custom web dashboard) must either:

  • parse the SQLite database directly (brittle, bypasses business logic, breaks on schema changes), or
  • scrape GET /health/detailed which only exposes a live count of active sessions — not a browsable list.

Meanwhile, the internal SessionDB already provides:

  • list_sessions_rich() — paginated session listing with metadata
  • search_sessions() — FTS5 full-text search across session content

These are used by hermes sessions list (CLI) and the dashboard's /api/status endpoint. The same data simply needs to be surfaced through the API server under the same bearer-auth guard that protects all other endpoints.

Concrete use-cases blocked today:

  • JetBrains / VS Code plugin showing a "Chat History" sidebar with past sessions
  • Custom web dashboards for multi-user deployments
  • A2A orchestrators that need to hand off work to a prior session by ID
  • Automated tooling that archives or prunes old sessions via the API

Proposed Solution

All endpoints follow the same bearer auth pattern as the rest of the API server.

GET /v1/sessions

List sessions with optional filtering and pagination.

Query parameters:

ParameterTypeDefaultDescription
limitint20Max results to return
offsetint0Pagination offset
platformstring(all)Filter by platform (cli, api_server, telegram, …)
searchstring(none)FTS5 full-text search across session content
sinceISO 8601(none)Return sessions started after this timestamp
untilISO 8601(none)Return sessions started before this timestamp

Example request:

GET /v1/sessions?limit=10&platform=api_server&search=kubernetes
Authorization: Bearer <key>

Example response:

{
  "object": "list",
  "data": [
    {
      "id": "20260501_143012_a1b2c3d4",
      "object": "hermes.session",
      "platform": "api_server",
      "title": "Kubernetes deployment review",
      "model": "anthropic/claude-opus-4",
      "started_at": "2026-05-01T14:30:12Z",
      "last_active_at": "2026-05-01T15:42:07Z",
      "ended_at": "2026-05-01T15:42:07Z",
      "turn_count": 14,
      "parent_session_id": null
    }
  ],
  "total": 42,
  "has_more": true
}

GET /v1/sessions/{session_id}

Retrieve metadata for a single session.

Example response:

{
  "id": "20260501_143012_a1b2c3d4",
  "object": "hermes.session",
  "platform": "api_server",
  "title": "Kubernetes deployment review",
  "model": "anthropic/claude-opus-4",
  "started_at": "2026-05-01T14:30:12Z",
  "last_active_at": "2026-05-01T15:42:07Z",
  "ended_at": "2026-05-01T15:42:07Z",
  "turn_count": 14,
  "parent_session_id": null,
  "child_session_ids": []
}

GET /v1/sessions/{session_id}/messages

Return the message history for a session (useful for resuming or displaying context).

Query parameters:

ParameterTypeDefaultDescription
limitint50Max messages to return
offsetint0Pagination offset

Example response:

{
  "object": "list",
  "session_id": "20260501_143012_a1b2c3d4",
  "data": [
    {"role": "user",      "content": "Review my k8s deployment manifest", "timestamp": "2026-05-01T14:30:12Z"},
    {"role": "assistant", "content": "I'll take a look...",               "timestamp": "2026-05-01T14:30:18Z"}
  ],
  "has_more": false
}

PATCH /v1/sessions/{session_id}

Update mutable session metadata (title).

Request body:

{"title": "My updated session title"}

DELETE /v1/sessions/{session_id}

Delete a session and its stored messages.


Capabilities advertisement

The GET /v1/capabilities response should grow a sessions_api flag so clients can detect support at runtime:

{
  "features": {
    "chat_completions": true,
    "responses_api": true,
    "run_submission": true,
    "sessions_api": true
  }
}

Implementation Notes

  • No new storage layer needed. All data lives in SessionDB already. This is purely an HTTP façade.
  • list_sessions_rich() already filters by parent_session_id IS NULL for display — expose an include_children=true query param to let callers opt in to child sessions (also fixes the counting bug described in #15722).
  • Message retrieval could reuse the same session file / SQLite row structure used by session_search and hermes sessions list.
  • Bearer auth is already applied globally in the API server — no new auth code needed.
  • The conversation parameter in /v1/responses already creates named sessions; GET /v1/sessions would make those sessions discoverable by name.

Alternatives Considered

AlternativeWhy not sufficient
Read SQLite directlyBypasses business logic, fragile against schema changes, requires filesystem access
GET /health/detailedOnly exposes a live count of active sessions, not browsable history
conversation param in Responses APICreates/chains sessions but provides no way to list existing ones
Internal session_search agent toolOnly available to the agent itself, not callable by external API clients

Feature Type

Gateway / messaging improvement

Scope

None

Contribution

  • I'd like to implement this myself and submit a PR

Debug Report (optional)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix [Feature]: Session List & Management REST API Endpoints [1 comments, 2 participants]