Document credential access in execute_bash tool #1005
Draft
+96
−8
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
This PR enhances the
execute_bashtool to help agents understand and use the secret manager system effectively.Changes
1. Documentation (Initial Commit)
Added a new "Credential Access" section to the
TOOL_DESCRIPTIONinopenhands-tools/openhands/tools/execute_bash/definition.pythat documents:$GITHUB_TOKEN,$API_KEY)2. Available Secrets in Metadata (New Feature)
Enhanced
ExecuteBashObservationto show agents which secrets are available:available_secretsfield toCmdOutputMetadatato store list of available secret namesconversation.state.secret_registry.secret_sources.keys()in the executorExecuteBashObservation.to_llm_content()showing format:[Available secrets: $SECRET1, $SECRET2, $SECRET3]test_bash_executor_metadata_available_secrets()to verify the functionalityThis helps agents discover what credentials they can access without having to guess or try different secret names.
Implementation Details
The implementation reflects the actual secret manager behavior in
openhands-tools/openhands/tools/execute_bash/impl.py:_export_envs()method callssecret_registry.get_secrets_as_env_vars(action.command)export KEY="value"before the actual command runs<secret-hidden>insteadTesting
tests/tools/execute_bash/test_secrets_masking.py(3 tests)test_bash_executor_metadata_available_secrets()verifies:metadata.available_secrets$prefixExample Output
When an agent executes a bash command with secrets available, they'll now see:
Why This Matters
This enhancement helps agents:
Co-authored-by: openhands [email protected]
Agent Server images for this PR
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.12-nodejs22golang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:588f72f-pythonRun
All tags pushed for this build
About Multi-Architecture Support
588f72f-python) is a multi-arch manifest supporting both amd64 and arm64588f72f-python-amd64) are also available if needed