Skip to content

[Enhancement] Add pluggable AgentStore support for AgentRegistry clustering #68

@cahpineda

Description

@cahpineda

Problem
Currently, the AgentRegistry class stores agent metadata in an in-memory dictionary (self.agents). This approach works well in single-instance deployments, but it makes it impossible to run multiple replicas of the registry service in a distributed or production environment (e.g., in Kubernetes) where shared state is required.

Since agent data is not persisted nor shared across instances, each registry instance has an isolated view of the agent network. This prevents horizontal scaling, high availability, and state recovery.

Proposal
Introduce an AgentStore abstraction (interface) with methods like:
save_agent(agent: Agent) -> None
get_agent(agent_id: str) -> Optional[Agent]
list_agents() -> List[Agent]
remove_agent(agent_id: str) -> None
This design would be non-breaking and preserve existing usage with in-memory storage.

Then:
Modify AgentRegistry to optionally receive a store: AgentStore parameter.
Default to current behavior using an in-memory implementation (InMemoryAgentStore) if no store is provided.
Document how to implement custom stores like Redis, PostgreSQL, etc.

This would enable users to deploy clustered registries that share state reliably across instances.

Benefits
Supports distributed deployment of the registry (HA / Kubernetes / ECS).
Enables Redis/PostgreSQL-based agent discovery networks.
Backward compatible for single-instance or dev use.
Improves production-readiness of the library.

Optional
I'm happy to contribute a PR with a RedisAgentStore implementation and the proposed interface if this enhancement is accepted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions