Skip to content

Implement: Agent State Storage Schema and Logging System #218

@csmangum

Description

@csmangum

agent_state_storage.md

We need to implement the agent state storage system based on the proposed schema and behavior described in agent_state_storage.md. This feature will enable detailed logging of agent states during simulation steps for later analysis, replay, and debugging.

Goals:

  • Store agent states (position, health, resources, etc.) at every simulation step.
  • Maintain historical records in a queryable format.
  • Support exporting and importing state snapshots.

Tasks:

  1. Define Schema

    • Create AgentStates table with fields:
      • id: primary key
      • agent_id: foreign key reference to Agents
      • simulation_step_id: foreign key reference to SimulationSteps
      • position_x, position_y: numeric (or vector)
      • health, resources: numeric
      • other_states: JSON field for extensibility
  2. Modify Simulation Engine

    • Log agent states after each step
    • Ensure consistent mapping with SimulationSteps
  3. Support Queries

    • Ability to retrieve state history for a given agent
    • Ability to reconstruct entire grid/world at a given step
  4. Testing

    • Unit tests for schema interactions
    • End-to-end test that validates state tracking over a short simulation
  5. (Optional) Performance Optimization

    • Explore bulk inserts or batching techniques if simulations are large-scale

Acceptance Criteria:

  • The database schema matches the specification
  • Agent states are stored accurately after every simulation step
  • Queries for historical states work as intended
  • Documentation added for schema and logging logic

Reference: See attached agent_state_storage.md for full specification and rationale.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions