Class StoreBackedSubagentRegistry
java.lang.Object
io.agentscope.harness.agent.gateway.StoreBackedSubagentRegistry
- All Implemented Interfaces:
SubagentRegistry
Distributed
SubagentRegistry backed by a BaseStore. Because the store is supplied
by a DistributedStore (Redis / OSS / MySQL), exposure
records become visible to every node, so any replica can resolve a subagentId and
re-materialize the subagent.
Records are stored under the namespace ["subagents", "exposed"] keyed by
subagentId. TTL is enforced lazily on find(java.lang.String): an elapsed record is deleted and
reported as absent.
This registry deliberately stores only routing/identity metadata. Concurrency safety for the
subagent's mutable conversation state is the responsibility of the distributed
AgentStateStore (and BaseStore.putIfVersion(java.util.List<java.lang.String>, java.lang.String, java.util.Map<java.lang.String, java.lang.Object>, long) where
explicit optimistic guarding is desired), not of this registry.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionResolves a subagent handle.voidregister(SubagentRecord record) Persists an exposure record.voidRemoves a single exposure record.voidrevokeByParentSession(String parentSessionId) Removes all exposure records associated with the given parent session.
-
Constructor Details
-
StoreBackedSubagentRegistry
-
-
Method Details
-
register
Description copied from interface:SubagentRegistryPersists an exposure record. Idempotent onSubagentRecord.subagentId()— re-registering the same id overwrites the previous record.- Specified by:
registerin interfaceSubagentRegistry- Parameters:
record- the record to persist (must carry a non-nullsubagentId)
-
find
Description copied from interface:SubagentRegistryResolves a subagent handle. Implementations should treat an expired record (seeSubagentRecord.isExpired(java.time.Instant)) as absent and may evict it lazily.- Specified by:
findin interfaceSubagentRegistry- Parameters:
subagentId- the handle to resolve- Returns:
- the record, or
Optional.empty()if unknown or expired
-
revoke
Description copied from interface:SubagentRegistryRemoves a single exposure record. No-op when the id is unknown.- Specified by:
revokein interfaceSubagentRegistry
-
revokeByParentSession
Description copied from interface:SubagentRegistryRemoves all exposure records associated with the given parent session. Used to clean up when a parent conversation ends. Implementations that cannot enumerate by parent may no-op.- Specified by:
revokeByParentSessionin interfaceSubagentRegistry- Parameters:
parentSessionId- the parent session whose exposed subagents should be revoked
-