-
Notifications
You must be signed in to change notification settings - Fork 42
fix(examples): allow all examples to run with same LLM_API_KEY #1065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jpshackelford
wants to merge
5
commits into
main
Choose a base branch
from
jps/same-settings-for-all-examples
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+37
−37
Conversation
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
Allow hello world example to use the same LLM_API_KEY and LLM_BASE_URL environment variables as other examples, enabling consistent configuration across all examples. Changes: - Use os.getenv() for model with default 'openhands/claude-sonnet-4-5-20250929' - Add base_url parameter from LLM_BASE_URL environment variable - Add usage_id for better tracking - Add comments about API key configuration
dfa6594 to
7f3ad3c
Compare
enyst
reviewed
Nov 6, 2025
enyst
reviewed
Nov 6, 2025
rbren
requested changes
Nov 6, 2025
Contributor
rbren
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will give feedback in a min :)
- Update all example files to use anthropic/claude-sonnet-4-5-20250929 as the default model - Remove comments about obtaining credits from hello world example - Model and API key can be overridden via LLM_MODEL and LLM_API_KEY environment variables
Contributor
Author
|
Based on feedback via slack, added a commit that:
This commit DOES NOT address with the few cases where a model besides |
enyst
reviewed
Nov 7, 2025
…LM routing example Ensures both primary and secondary LLMs use the same provider/key by default. Co-authored-by: openhands <[email protected]>
…M_MODEL Restores in-line env read for API key with model still read from env with fallback. Co-authored-by: openhands <[email protected]>
enyst
approved these changes
Nov 9, 2025
Contributor
🔄 Running Examples with
|
| Example | Status | Duration | Cost |
|---|---|---|---|
| 01_standalone_sdk/02_custom_tools.py | ✅ PASS | 26s | $0.03 |
| 01_standalone_sdk/03_activate_skill.py | ✅ PASS | 11s | $0.01 |
| 01_standalone_sdk/05_use_llm_registry.py | ✅ PASS | 8s | $0.01 |
| 01_standalone_sdk/07_mcp_integration.py | ✅ PASS | 43s | $0.02 |
| 01_standalone_sdk/09_pause_example.py | ✅ PASS | 13s | $0.01 |
| 01_standalone_sdk/10_persistence.py | ✅ PASS | 37s | $0.03 |
| 01_standalone_sdk/11_async.py | ✅ PASS | 32s | $0.03 |
| 01_standalone_sdk/12_custom_secrets.py | ✅ PASS | 14s | $0.01 |
| 01_standalone_sdk/13_get_llm_metrics.py | ✅ PASS | 31s | $0.02 |
| 01_standalone_sdk/14_context_condenser.py | ✅ PASS | 198s | $0.40 |
| 01_standalone_sdk/17_image_input.py | ✅ PASS | 19s | $0.02 |
| 01_standalone_sdk/18_send_message_while_processing.py | ✅ PASS | 20s | $0.01 |
| 01_standalone_sdk/19_llm_routing.py | ✅ PASS | 16s | $0.01 |
| 01_standalone_sdk/20_stuck_detector.py | ✅ PASS | 16s | $0.01 |
| 01_standalone_sdk/21_generate_extraneous_conversation_costs.py | ❌ FAIL (exit: 1) | 10s | $0.00 |
| 01_standalone_sdk/22_anthropic_thinking.py | ✅ PASS | 14s | $0.01 |
| 01_standalone_sdk/23_responses_reasoning.py | ✅ PASS | 36s | $0.01 |
| 01_standalone_sdk/24_planning_agent_workflow.py | ✅ PASS | 312s | $0.42 |
| 01_standalone_sdk/25_agent_delegation.py | ❌ FAIL (exit: 1) | 45s | $0.00 |
| 01_standalone_sdk/26_custom_visualizer.py | ✅ PASS | 19s | $0.00N/A |
| 02_remote_agent_server/01_convo_with_local_agent_server.py | ✅ PASS | 55s | $0.04 |
| 02_remote_agent_server/02_convo_with_docker_sandboxed_server.py | ✅ PASS | 116s | $0.04 |
| 02_remote_agent_server/03_browser_use_with_docker_sandboxed_server.py | ✅ PASS | 63s | $0.04 |
| 02_remote_agent_server/04_convo_with_api_sandboxed_server.py | ❌ FAIL (exit: 1) | 3s | $0.00 |
❌ Some tests failed
Total: 24 | Passed: 21 | Failed: 3
…osts example Ensures CI uses the same provider/key by reading model from LLM_MODEL for both LLMs. Co-authored-by: openhands <[email protected]>
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.
Problem
The hello world example uses a hardcoded Anthropic model name instead of reading from environment variables like other examples. This creates an inconsistent experience:
LLM_API_KEYdepending on which example they want to runSolution
This change makes hello world consistent with other examples by:
LLM_MODELenvironment variable with defaultopenhands/claude-sonnet-4-5-20250929Now users can set up their environment once and run all examples with the same configuration, making the SDK more approachable for first-time users and smoother for demos.
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:76dbec2-pythonRun
All tags pushed for this build
About Multi-Architecture Support
76dbec2-python) is a multi-arch manifest supporting both amd64 and arm6476dbec2-python-amd64) are also available if needed