emrgnt-cmplxty/automata

Enhancement of `Database` architecture across the application

emrgnt-cmplxty opened this issue · 0 comments

Sure, here's an example of how this task could look like in a GitHub issue:


Summary

This issue is about enhancing our current system architecture and database design. We need to consider a few factors for improvement including the decoupling of databases, transaction handling, database schema changes, task & evaluation workflow integration, and using dependency injection for databases.

Description

We currently use three databases:

  1. AutomataAgentTaskDatabase - tracks all tasks.
  2. OpenAIAutomataConversationDatabase - stores all interactions for a session.
  3. EvalResultWriter - records evaluation results.

These databases are connected using a common session_id.

Tasks

  • Decouple Databases: Investigate if the databases need to be decoupled into separate services to avoid potential bottlenecks or single points of failure and to allow each service to scale independently.

  • Transactions and Consistency: Implement mechanisms for handling transactions across databases and consider the level of consistency required between them.

  • Database Schema Changes: Plan for potential database schema changes that could include adding new fields, changing data types, or restructuring databases.

  • Task & Evaluation Workflow Integration: Ensure smooth integration of the task-oriented workflow with the evaluation harness. Consider using event-driven architecture or a job queue.

  • Dependency Injection for Databases: Make code more flexible and testable by using dependency injection for databases, as noted in the OpenAIAutomataConversationDatabase class.

  • Unit Testing and Mocking: Continue focusing on unit tests for individual components and use mocking to isolate dependencies. Ensure coverage of edge cases and expected workflows.

  • Data Backup and Recovery: Define a strategy for backing up data and recovering from data loss or corruption. Consider replication if the data is critical.

Acceptance Criteria

  • The system is enhanced based on the tasks defined above.
  • All changes have comprehensive unit test coverage.
  • The application functions as expected and all existing functionality is unaffected by these changes.

Remember to assign the issue to the relevant team member(s) and add appropriate labels, in this case "Enhancement". You might also want to link to any relevant milestones or projects.