wooden-umbrella-84098
02/22/2026, 3:49 PMwooden-umbrella-84098
02/22/2026, 3:50 PMnutritious-balloon-65098
02/22/2026, 4:03 PMnutritious-balloon-65098
02/22/2026, 4:06 PMsoftware-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?wooden-umbrella-84098
02/22/2026, 4:07 PMnutritious-balloon-65098
02/22/2026, 4:07 PMnutritious-balloon-65098
02/22/2026, 4:12 PMopenhands/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**