In-memory implementation of AgentRepository.

Suitable for development, testing, and small-scale deployments. For production use with persistence, consider a database-backed implementation.

const repository = new InMemoryAgentRepository();

await repository.save(customerSupportAgent);
await repository.save(dataAnalysisAgent);

const agent = await repository.findById(agentId);
const supportAgents = await repository.findByCapability(AgentCapability.CUSTOMER_SUPPORT);

Implements

  • AgentRepository

Constructors

Methods

  • Finds an agent by its unique ID

    Parameters

    • id: AgentId

      The agent ID

    Returns Promise<null | AIAgent<unknown, unknown>>

    The agent, or null if not found

  • Finds all agents with a specific capability

    Parameters

    • capability: string

      The capability to search for

    Returns Promise<AIAgent<unknown, unknown>[]>

    Array of agents with the capability

  • Finds all registered agents

    Returns Promise<AIAgent<unknown, unknown>[]>

    Array of all agents

  • Saves an agent (create or update)

    Parameters

    • agent: AIAgent<unknown, unknown>

      The agent to save

    Returns Promise<void>

  • Checks if an agent exists

    Parameters

    • id: AgentId

      The agent ID

    Returns Promise<boolean>

    true if the agent exists