Class AgencyRegistry

Tracks the Agencies (multi-GMI collectives) active inside the AgentOS runtime.

Remarks

The registry is intentionally ephemeral; durable state should be captured via workflow persistence. For shared memory, use AgencyMemoryManager.

Example

const registry = new AgencyRegistry(logger);

// Create agency with shared memory enabled
const session = registry.upsertAgency({
workflowId: 'workflow-123',
conversationId: 'conv-456',
memoryConfig: { enabled: true },
});

// Register GMI seats
registry.registerSeat({
agencyId: session.agencyId,
roleId: 'researcher',
gmiInstanceId: 'gmi-789',
personaId: 'research-persona',
});

Constructors

Methods

  • Creates or updates an agency session associated with a workflow.

    Parameters

    • args: AgencyUpsertArgs

      Upsert payload containing workflow linkage, memory config, and optional metadata.

    Returns AgencySession

    The upserted agency session.

    Example

    const session = registry.upsertAgency({
    workflowId: 'workflow-123',
    conversationId: 'conv-456',
    memoryConfig: {
    enabled: true,
    autoIngestCommunications: true,
    },
    });
  • Resolves the agency session associated with a workflow instance (if any).

    Parameters

    • workflowId: string

      Workflow instance identifier.

    Returns undefined | AgencySession

    The agency session mapped to the workflow, if present.

  • Removes an agency entirely (e.g., when the workflow reaches a terminal state).

    Parameters

    • agencyId: string

      Agency identifier to remove.

    Returns boolean

    true when the agency existed and was removed.