Skip to content

docs: add get_llm() and get_secrets() to OpenHands Cloud Workspace guide#401

Merged
enyst merged 4 commits intomainfrom
feat/cloud-workspace-saas-credentials-docs
Mar 19, 2026
Merged

docs: add get_llm() and get_secrets() to OpenHands Cloud Workspace guide#401
enyst merged 4 commits intomainfrom
feat/cloud-workspace-saas-credentials-docs

Conversation

@xingyaoww
Copy link
Contributor

@xingyaoww xingyaoww commented Mar 16, 2026

Summary

Updates the OpenHands Cloud Workspace documentation to cover the new get_llm() and get_secrets() methods for SaaS credential inheritance.

Changes

sdk/guides/agent-server/cloud-workspace.mdx

  • New section: "Inheriting SaaS Credentials" — Documents get_llm() and get_secrets() methods with usage examples and security notes
    • get_llm(): Fetches LLM settings from the user's SaaS account and returns a ready-to-use LLM instance
    • get_secrets(): Builds LookupSecret references where raw values never transit through the SDK client
  • New section: "SaaS Credentials Example" — Full expandable example (examples/02_remote_agent_server/10_cloud_workspace_share_credentials.py) showing the simplified flow where only OPENHANDS_CLOUD_API_KEY is needed
  • Updated page description metadata

Note: A matching branch feat/cloud-workspace-get-llm-secrets has also been pushed to this repo so the SDK CI check (check-examples) can find the docs.

Companion PR

- Add 'Inheriting SaaS Credentials' section documenting get_llm() and
  get_secrets() methods for credential inheritance
- Add SaaS Credentials example section with the full expandable example
- Update page description to mention SaaS credential inheritance

Companion SDK PR: OpenHands/software-agent-sdk#2409

Co-authored-by: openhands <openhands@all-hands.dev>
Matches rename in OpenHands/software-agent-sdk#2409.

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
@xingyaoww xingyaoww marked this pull request as ready for review March 17, 2026 13:22
@xingyaoww xingyaoww requested a review from enyst as a code owner March 17, 2026 13:22
@xingyaoww xingyaoww requested a review from malhotra5 March 17, 2026 13:22
Copy link
Contributor

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Needs improvement - Documentation claims to be auto-synced but doesn't match the actual SDK example file.

@xingyaoww
Copy link
Contributor Author

@OpenHands please fix all issues #401 (review)

@openhands-ai
Copy link

openhands-ai bot commented Mar 17, 2026

I'm on it! xingyaoww can track my progress at all-hands.dev

- Sync get_llm() call to match actual SDK example (simple call, no kwargs)
- Sync else branch prompt to match actual SDK example
- Clarify dual auth description with specific header names

Co-authored-by: openhands <openhands@all-hands.dev>
@openhands-ai
Copy link

openhands-ai bot commented Mar 17, 2026

Looking at the work done, all changes have already been committed and pushed to the remote branch in commit c125f0e. Let me summarize:

Summary of Changes

All 3 issues from the PR review (#401 (review)) have been addressed in a single commit (c125f0e), pushed to feat/cloud-workspace-saas-credentials-docs:

Changes made to sdk/guides/agent-server/cloud-workspace.mdx:

  1. ✅ Code sync fix — get_llm() call (line ~317): Replaced the diverged llm_kwargs pattern with the simple llm = workspace.get_llm() to match the actual SDK example file.

  2. ✅ Code sync fix — else branch prompt (line ~357): Replaced the verbose multi-line prompt with the simpler prompt = "Tell me, is there any secret configured for you?" plus a comment, matching the actual SDK example.

  3. ✅ Auth description clarification (line 101): Updated the dual authentication description to be more precise — specifying that the Bearer token goes in the Authorization header and the session key (unique per sandbox) in the X-Session-API-Key header.

Checklist:

  • ✅ All 3 unresolved review threads addressed
  • ✅ All 5 review threads on the PR are now resolved
  • ✅ Code block now matches the actual SDK example at examples/02_remote_agent_server/10_cloud_workspace_share_credentials.py from the companion PR
  • ✅ Changes are concise — only the 3 specific issues were touched, no extraneous modifications
  • ✅ Committed and pushed to the PR branch

@xingyaoww xingyaoww requested a review from all-hands-bot March 17, 2026 14:29
Copy link
Contributor

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Good taste — Accurate documentation of an elegant feature that eliminates credential complexity.

You can override any parameter:

```python icon="python"
llm = workspace.get_llm(model="gpt-4o", temperature=0.5)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic job on supporting this override

Copy link
Contributor

@malhotra5 malhotra5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

llm = workspace.get_llm(model="gpt-4o", temperature=0.5)
```

Under the hood, `get_llm()` calls `GET /api/v1/users/me?expose_secrets=true` with dual authentication: the Bearer token (from your Cloud API key) in the `Authorization` header and the session key (unique per sandbox) in the `X-Session-API-Key` header.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m really not sure we should let the agent say “dual auth” when one is sent to the client via the other… 😿


#### `get_secrets()`

Builds `LookupSecret` references for your SaaS-configured secrets. Raw values **never transit through the SDK client** — they are resolved lazily by the agent-server inside the sandbox:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very interesting and cool!

@enyst enyst merged commit 48ac8b0 into main Mar 19, 2026
6 checks passed
@enyst enyst deleted the feat/cloud-workspace-saas-credentials-docs branch March 19, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants