It seems the SDK agent doesn't know what secrets i...
# proj-agent
w
It seems the SDK agent doesn't know what secrets it has access to by default. Are we not putting those in the system prompt? I think the web agent knows--did we hack it in there?
@nutritious-balloon-65098 investigate. Look at repo openhands/software-agent-sdk and see if the secrets available are put into the prompt at all. look at openhands/openhands to see how the secrets get into the prompt there
n
I'm on it! Robert Brennan can track my progress here.
## Final Summary I investigated how secrets are handled in both repositories to answer why the SDK agent doesn't know what secrets it has access to. ### Key Finding: The Bug In
software-agent-sdk
, when secrets are passed to
LocalConversation
(via the
secrets
parameter or
update_secrets()
method), they are only added to the
secret_registry
for environment variable injection during command execution. They are NOT added to
agent.agent_context.secrets
, so they don't appear in the system prompt. ### How OpenHands Web Does It (Correctly) In `openhands/openhands`: 1. Secrets are stored with both value and description 2.
get_custom_secrets_descriptions()
extracts the descriptions 3. These are passed to
RuntimeInfo.custom_secrets_descriptions
4. The
additional_info.j2
template renders them into a
<CUSTOM_SECRETS>
section ### The SDK Already Has the Infrastructure The SDK has all the pieces but they're not connected: -
AgentContext.secrets
field exists -
AgentContext.get_secret_infos()
extracts name/description pairs -
system_message_suffix.j2
template has
<CUSTOM_SECRETS>
section that renders
secret_infos
### The Fix Needed In
openhands-sdk/openhands/sdk/conversation/impl/local_conversation.py
, the
update_secrets()
method (and constructor) should be updated to also merge secrets into
agent.agent_context.secrets
so they appear in the system prompt - not just the
secret_registry
. --- No code changes were made - this was an investigation task. Would you like me to implement the fix in the software-agent-sdk repository?
w
@nutritious-balloon-65098 modify the software-agent-sdk to put the secrets into the prompt in a similar way. open a pull request
n
I'm on it! Robert Brennan can continue tracking my progress here.
## Final Summary ### Investigation Complete ✅ I investigated how secrets are handled in both repositories and found the root cause: In
openhands/openhands
(web):
Secrets are properly passed to
RuntimeInfo.custom_secrets_descriptions
and rendered in the prompt via
additional_info.j2
template. In `software-agent-sdk`: Secrets passed to
LocalConversation
were only added to
secret_registry
for env var injection during command execution, but NOT to
agent.agent_context.secrets
for prompt inclusion. The infrastructure for showing secrets in the prompt already existed but wasn't being used. ### Fix Implemented ✅ Modified
update_secrets()
in
LocalConversation
to also update
agent.agent_context.secrets
, ensuring secrets appear in the system prompt's
<CUSTOM_SECRETS>
section. ### Checklist - [x] Investigated how secrets get into prompt in openhands/openhands - [x] Investigated how secrets are handled in software-agent-sdk - [x] Implemented fix to include secrets in prompt - [x] Added 5 new tests to verify the fix - [x] All 14 tests pass - [x] Changes pushed to remote branch - [x] Pull request created ### Changes Made -
local_conversation.py
: Added
_update_agent_context_secrets()
helper and updated
update_secrets()
to call it -
test_agent_secrets_integration.py
: Added 5 tests for prompt inclusion ### PR **https://github.com/OpenHands/software-agent-sdk/pull/2171**