Skip to content

[FEATURE] Add Database Session Management #33

@puritatemcordis

Description

@puritatemcordis

Problem Statement

The current implementation of the Strands agent uses in-memory storage to maintain conversation history. While this is suitable for short-lived sessions, it lacks persistence across application restarts or crashes. To address this limitation, it would be valuable to implement a class that enables saving conversation history to a relational database such as PostgreSQL or MySQL. This enhancement would provide a more robust and reliable foundation for production-grade applications by ensuring conversation state can be preserved and recovered when needed.

Proposed Solution

No response

Use Case

Objective:
Enable the Strands agent to persist conversation history in a relational database to ensure continuity and resilience in production environments.

Primary Actor:
Strands Agent

Stakeholders and Interests:

Developers: Want reliable state management to build robust applications.
End Users: Expect seamless conversation experiences even after interruptions.
Operations/DevOps: Need observability and data recovery mechanisms in case of system failures.
Preconditions:

A relational database (e.g., PostgreSQL, MySQL) is available and configured.
The Strands agent is running in a production or long-lived session environment.

Main Flow:

A user interacts with the Strands agent.
The agent processes user input and generates responses.
Each turn in the conversation (user input and agent response) is saved to the relational database in real-time or at regular intervals.
If the application crashes or restarts, the agent retrieves the saved conversation history from the database.
The agent resumes the conversation with full context, ensuring continuity for the user.

Postconditions:

Conversation history is persistently stored in the database.
The agent can recover and resume sessions after unexpected terminations.

Alternative Flows:

If the database is unreachable, the agent logs the failure and continues with in-memory storage, optionally retrying persistence later.

Alternatives Solutions

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Researching

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions