feat(agent): add AgentProfile + ContextVar for per-agent paths (1/6)#37495
Open
davidgut1982 wants to merge 1 commit into
Open
feat(agent): add AgentProfile + ContextVar for per-agent paths (1/6)#37495davidgut1982 wants to merge 1 commit into
davidgut1982 wants to merge 1 commit into
Conversation
This was referenced Jun 2, 2026
d5c5d1b to
7cd230e
Compare
Introduce AgentProfile dataclass and a ContextVar (_current_agent_profile) that lets path getters (get_hermes_home, get_skills_dir, get_memory_dir) resolve to the active agent's home directory under asyncio. - agent/profile.py: AgentProfile, use_profile() context manager, load_agent_registry() from GatewayConfig - hermes_constants.py: get_hermes_home() reads ContextVar before env fallback - tests/agent/test_profile_contextvar.py: ContextVar isolation under asyncio.gather, nested contexts, registry loading Single-agent installs see zero change — no profile bound means fallback to HERMES_HOME env var as before.
7cd230e to
b2aa3f0
Compare
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.
What
Add
AgentProfiledataclass and aContextVarso per-agent filesystem paths and identity resolve correctly under concurrent gateway tasks.Why
Multi-agent routing needs each in-flight message to resolve its own agent's paths/config without threading an explicit argument through every call site; a
ContextVargives task-local agent binding.How to test
Platforms tested
Linux (CT 133 / Proxmox LXC)
Part 1 of 6 in the multi-agent gateway decomposition (replaces #34741). First in the chain — based directly on
main.