Skip to content

Feat/removing postgresql - #11

Open
quentinP-hexamind wants to merge 5 commits into
mainfrom
feat/removing_postgresql
Open

Feat/removing postgresql#11
quentinP-hexamind wants to merge 5 commits into
mainfrom
feat/removing_postgresql

Conversation

@quentinP-hexamind

Copy link
Copy Markdown
Collaborator

Drop Postgres as the default & delegate conversation history to the backend

Summary

Two related simplifications to how the platform stores state:

  1. SQLite is now the default datastore for the proxy, that means no server to stand up. Postgres becomes an opt-in extra for multi-worker / high-concurrency deployments.
  2. The agent backend now owns conversation memory. The proxy forwards only the new user turn and keeps its stored transcript purely for display (sidebar / reload). A new /forget endpoint lets the backend drop a conversation's memory when the user deletes it.

What changed

Datastore (proxy)

  • Default [PLATFORM_DATABASE_URL] → sqlite+aiosqlite:///./hexa.sqlite (config.py).
  • aiosqlite promoted to a core dependency; asyncpg moved behind a new postgres extra (pip install '.[postgres]') (pyproject.toml).
  • docker-compose.yml, .env.example, and QUICKSTART.md reframed: Postgres is now optional, with the opt-in steps documented. *.sqlite git-ignored.

Conversation memory (proxy)

  • The chat route forwards only [{role: user, content: …}], the prior _assemble_history DB read is gone ([chat.py]). Stored user/assistant rows are now explicitly the display transcript, never model context.
  • Deleting a conversation calls the backend's /forget (best-effort, a down/unimplemented backend never fails the delete) ([conversations.py], [runtime_client.py]).

Reference & template backends

  • New in-process memory store + /forget route in the reference agent-server ([memory.py], [routes/agents.py]), with _assistant_text capturing the reply across all framework event shapes.
  • Same pattern added to the copy-me starter-agent and hexgate-agent templates.
  • verify_backend.py now probes /forget.

Contract

  • CONTRACT.md §5 documents the new ownership model, the conversation_id memory key, cold-id handling, and the /forget lifecycle.

Behavior contractual change

Any custom backend must now:

  • treat input.messages as the new turn only and own its own memory keyed by context.conversation_id (accepting unseen ids without error);
    implement POST /agents/{id}/forget {conversation_id} → {forgotten: bool}

Testing

  • proxy-server: 92 passing, test_chat.py updated to assert only the new turn is forwarded while the full display transcript is still stored; test_conversations.py adds delete→/forget coverage incl. the best-effort failure path.
  • agent-server: 25 passing (new suite), memory.py, the stream route's transcript reconstruction, /forget, and _assistant_text per framework. Wired into make test (so it runs in CI).

Follow-ups (not in this PR)

  • starter-agent / hexgate-agent memory logic is currently untested.
  • No retry-idempotency dedup by run_id (documented simplification); a missing conversation_id currently yields empty history rather than falling back to input.messages

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.

3 participants