Class: AgencyRegistry
Defined in: packages/agentos/src/core/agency/AgencyRegistry.ts:45
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
Constructor
new AgencyRegistry(
logger?):AgencyRegistry
Defined in: packages/agentos/src/core/agency/AgencyRegistry.ts:56
Creates a new AgencyRegistry instance.
Parameters
logger?
Optional logger for diagnostics
Returns
AgencyRegistry
Methods
appendSeatHistory()
appendSeatHistory(
agencyId,roleId,entry,maxEntries?):AgencySeatState|undefined
Defined in: packages/agentos/src/core/agency/AgencyRegistry.ts:192
Appends a history entry to the specified seat and returns the updated state.
Parameters
agencyId
string
roleId
string
entry
maxEntries?
number = 20
Returns
AgencySeatState | undefined
getAgency()
getAgency(
agencyId):AgencySession|undefined
Defined in: packages/agentos/src/core/agency/AgencyRegistry.ts:125
Retrieves an agency session by identifier.
Parameters
agencyId
string
Target Agency identifier.
Returns
AgencySession | undefined
The matching agency session or undefined when absent.
getAgencyByWorkflow()
getAgencyByWorkflow(
workflowId):AgencySession|undefined
Defined in: packages/agentos/src/core/agency/AgencyRegistry.ts:134
Resolves the agency session associated with a workflow instance (if any).
Parameters
workflowId
string
Workflow instance identifier.
Returns
AgencySession | undefined
The agency session mapped to the workflow, if present.
mergeSeatMetadata()
mergeSeatMetadata(
agencyId,roleId,metadata):AgencySeatState|undefined
Defined in: packages/agentos/src/core/agency/AgencyRegistry.ts:210
Merges metadata onto a seat without altering other properties.
Parameters
agencyId
string
roleId
string
metadata
Record<string, unknown>
Returns
AgencySeatState | undefined
registerSeat()
registerSeat(
args):AgencySession
Defined in: packages/agentos/src/core/agency/AgencyRegistry.ts:145
Registers or updates a seat inside the agency.
Parameters
args
Seat registration payload.
Returns
Updated agency session after the seat registration.
Throws
When attempting to register against an unknown agency.
removeAgency()
removeAgency(
agencyId):boolean
Defined in: packages/agentos/src/core/agency/AgencyRegistry.ts:175
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.
upsertAgency()
upsertAgency(
args):AgencySession
Defined in: packages/agentos/src/core/agency/AgencyRegistry.ts:76
Creates or updates an agency session associated with a workflow.
Parameters
args
Upsert payload containing workflow linkage, memory config, and optional metadata.
Returns
The upserted agency session.
Example
const session = registry.upsertAgency({
workflowId: 'workflow-123',
conversationId: 'conv-456',
memoryConfig: {
enabled: true,
autoIngestCommunications: true,
},
});