feat(agent): inject LLMProvider instance into STARAgent#16
Merged
Conversation
- _apply_llm_provider now writes _llm_config alongside _llm_client so the lazy llm_client property cannot silently revert to the old provider - Add divergence-warning comment in ctor instance-handling block - Strengthen test_set_llm_provider_repoints_all_sinks: construct agent with ltmemory_path and assert Sink 3 (_ltmemory._rlm._llm.provider)
…vider string path
This was referenced Jul 7, 2026
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.
Summary
LLMProviderinstance intoSTARAgentvia a dedicatedllm_provider_instanceparam (no union overload of the existingllm_providerstring), and re-point it mid-session viaset_llm_provider(...).LLMonce at the agent boundary, then fan that oneLLMout to three sinks so the actual call site uses it (no split-brain): agent_llm_client, runtimeLLMCaller(via existingruntime.set_llm), andLTMemory→RLMResource.RLMResourceandLTMemorygainllm=params +set_llm()to accept/forward the injected instance; the legacyprovider+modelstring path stays lazy and behaviorally unchanged (no API key needed at construction).llm_clientproperty setter now also fans out to theLTMemorysink, closing a partial-update footgun now that LTMemory is a live LLM sink.Changes
dana/common/resource/rlm_resource.py—llmparam +set_llm(leaf sink)dana/core/memory/ltmemory.py—llmparam +set_llm(forwards to RLMResource)dana/core/agent/star_agent.py—llm_provider_instanceparam,_apply_llm_provider()fan-out,set_llm_provider(),_llm_configsync on re-point, setter→ltmemory fan-outtests/unit/core/test_inject_llm_provider.py— 9 tests: no-split-brain invariant, re-point all sinks (instance + string paths), ltmemory injection, legacy lazy regressionTest Plan
uv run pytest tests/unit/core/test_inject_llm_provider.py— 9 passedtest_agent_runtime.py,tests/unit/core/star,test_ltmemory.py,test_staragent_ltmemory.py— 84 passed total, no regressions_llm_client is Noneat construction, no key required)Spec:
docs/superpowers/specs/2026-06-08-inject-llm-provider-instance-design.mdPlan:
docs/superpowers/plans/2026-06-08-inject-llm-provider-instance.md