Skip to content

Commit 74cc24f

Browse files
Set add_security_analyzer=False by default and simplify examples (#846)
Co-authored-by: openhands <openhands@all-hands.dev>
1 parent fcda056 commit 74cc24f

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

examples/01_standalone_sdk/01_hello_world.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@
1818
base_url=base_url,
1919
usage_id="agent",
2020
)
21-
22-
add_security_analyzer = bool(os.getenv("ADD_SECURITY_ANALYZER", "").strip())
23-
if add_security_analyzer:
24-
print("Agent security analyzer added.")
25-
agent = get_default_agent(
26-
llm=llm, cli_mode=True, add_security_analyzer=add_security_analyzer
27-
)
21+
agent = get_default_agent(llm=llm, cli_mode=True)
2822

2923
# Start a conversation and send some messages
3024
cwd = os.getcwd()

examples/01_standalone_sdk/04_confirmation_mode_example.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ def run_until_finished(conversation: BaseConversation, confirmer: Callable) -> N
8888
api_key=SecretStr(api_key),
8989
)
9090

91-
agent = get_default_agent(llm=llm)
91+
add_security_analyzer = bool(os.getenv("ADD_SECURITY_ANALYZER", "").strip())
92+
if add_security_analyzer:
93+
print("Agent security analyzer added.")
94+
agent = get_default_agent(llm=llm, add_security_analyzer=add_security_analyzer)
9295
conversation = Conversation(agent=agent, workspace=os.getcwd())
9396

9497
# 1) Confirmation mode ON

examples/01_standalone_sdk/23_responses_reasoning.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424
logger = get_logger(__name__)
2525

2626

27-
api_key = os.getenv("LLM_API_KEY")
28-
if api_key is None:
29-
api_key = os.getenv("OPENAI_API_KEY")
30-
assert api_key is not None, "Set LLM_API_KEY or OPENAI_API_KEY in your environment."
27+
api_key = os.getenv("LLM_API_KEY") or os.getenv("OPENAI_API_KEY")
28+
assert api_key, "Set LLM_API_KEY or OPENAI_API_KEY in your environment."
3129

3230
model = os.getenv("LLM_MODEL", "openhands/gpt-5-codex")
3331
base_url = os.getenv("LLM_BASE_URL")

0 commit comments

Comments
 (0)