feat(agent): logical agentId#2395
Open
rudy2steiner wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
看描述和实现 |
Contributor
Author
yes |
|
AgentSkillRepository有考虑增加一个agentId回调? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
agentIdcurrently serves several different purposes in AgentScope Java:These meanings conflict when the same logical Agent is recreated or scaled to multiple runtime instances. The current random UUID changes for every instance, so platforms must maintain an additional mapping between their stable Agent ID and AgentScope's generated ID which discussed in #2313. However, simply making the existing ID configurable would allow multiple instances to share a value that internal state maps currently assume is unique, potentially causing state, trace, or training data to be overwritten or mixed.
This change separates the two identity concepts:
agentIdis the stable, caller-defined logical Agent ID.idis the random UUID of a specific runtime Agent instance.This allows platform integrations to use a stable logical identity while preserving the existing
instance-level isolation.
Main Changes
Agent#getId()for runtime instance identity.AgentBasealways generates an immutableUUID for it, while the default interface implementation falls back to
getAgentId()forcompatibility with existing custom
Agentimplementations.agentId. If it is null or blank, it fallsback to the generated runtime
id, preserving the previous default behavior.ReActAgent.Builder.agentId(String).ReActAgent, soHarnessAgent#getAgentId()now matches the logical ID already used by Harness resourcenamespaces. The existing Harness resolution order and resource paths remain unchanged.
id, including graceful-shutdown state savers,JSONL trace run state, and TrainingRouter input correlation. This prevents collisions when
multiple runtime instances share one logical
agentId.SubAgentTool.subagent_idcontinues to identify a unique runtime sub-agent instance by usingid.default UUID behavior, Harness propagation, and isolation between instances sharing the same
logical ID.