Repository for persisting and retrieving AI agents.
class InMemoryAgentRepository implements AgentRepository { private agents = new Map<string, AIAgent<any, any>>(); async findById(id: AgentId): Promise<AIAgent<any, any> | null> { return this.agents.get(id.value) ?? null; } async save(agent: AIAgent<any, any>): Promise<void> { this.agents.set(agent.id.value, agent); }} Copy
class InMemoryAgentRepository implements AgentRepository { private agents = new Map<string, AIAgent<any, any>>(); async findById(id: AgentId): Promise<AIAgent<any, any> | null> { return this.agents.get(id.value) ?? null; } async save(agent: AIAgent<any, any>): Promise<void> { this.agents.set(agent.id.value, agent); }}
Finds an agent by its unique ID
The agent ID
The agent, or null if not found
Finds all agents with a specific capability
The capability to search for
Array of agents with the capability
Finds all registered agents
Array of all agents
Saves an agent (create or update)
The agent to save
Deletes an agent
ID of the agent to delete
Checks if an agent exists
true if the agent exists
Repository for persisting and retrieving AI agents.
Example