chat2graph icon indicating copy to clipboard operation
chat2graph copied to clipboard

feat(dal): implement persistence for Agent instances in database

Open Appointat opened this issue 9 months ago • 0 comments

Description

Currently, agent instances (both leader and experts) are not persisted in the database. As noted in the TODO comment in agent.py, we need to implement proper persistence for these instances rather than mocking the IDs.

Current Behavior

The code currently uses a workaround where agent IDs are created on-the-fly:

# since the expert instance is not persisted, we mock the id with the agent name
self._id: str = id or agent_config.profile.name + "_id"

Proposed Changes

  • Design a database schema for storing agent instances
  • Implement data access objects (DAOs) for agent persistence
  • Update the Agent class to load/save from the database
  • Implement methods to query and retrieve specific agent instances

Benefits

  • Persistence across restarts: Agents can maintain state between system restarts
  • Improved tracking: Better monitoring of agent performance over time
  • Configuration management: Track changes to agent configurations
  • Auditability: Enable historical analysis of agent behavior

Technical Considerations

  • Ensure proper serialization of complex objects like Reasoners and Workflows
  • Support the updates of the agents

Appointat avatar Mar 19 '25 04:03 Appointat