Skip to content

Commit 9394dc6

Browse files
authored
Merge branch 'main' into feat/configurable-health-check-timeout-1571
2 parents 9a5365d + 7d2db6e commit 9394dc6

File tree

28 files changed

+2574
-314
lines changed

28 files changed

+2574
-314
lines changed

examples/01_standalone_sdk/46_agent_settings.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
"""Create, serialize, and deserialize AgentSettings, then build a working agent.
1+
"""Create, serialize, and deserialize LLMAgentSettings, then build a working agent.
22
33
Demonstrates:
4-
1. Configuring an agent entirely through AgentSettings (LLM, tools, condenser).
4+
1. Configuring an agent entirely through LLMAgentSettings (LLM, tools, condenser).
55
2. Serializing settings to JSON and restoring them.
66
3. Building an Agent from settings via ``create_agent()``.
77
4. Running a short conversation to prove the settings take effect.
@@ -13,7 +13,7 @@
1313

1414
from pydantic import SecretStr
1515

16-
from openhands.sdk import LLM, AgentSettings, Conversation, Tool
16+
from openhands.sdk import LLM, Conversation, LLMAgentSettings, Tool
1717
from openhands.sdk.settings import CondenserSettings
1818
from openhands.tools.file_editor import FileEditorTool
1919
from openhands.tools.terminal import TerminalTool
@@ -23,7 +23,7 @@
2323
api_key = os.getenv("LLM_API_KEY")
2424
assert api_key is not None, "LLM_API_KEY environment variable is not set."
2525

26-
settings = AgentSettings(
26+
settings = LLMAgentSettings(
2727
llm=LLM(
2828
model=os.getenv("LLM_MODEL", "anthropic/claude-sonnet-4-5-20250929"),
2929
api_key=SecretStr(api_key),
@@ -42,7 +42,7 @@
4242
print(json.dumps(payload, indent=2, default=str)[:800], "…")
4343
print()
4444

45-
restored = AgentSettings.model_validate(payload)
45+
restored = LLMAgentSettings.model_validate(payload)
4646
assert restored.condenser.enabled is True
4747
assert restored.condenser.max_size == 50
4848
assert len(restored.tools) == 2
@@ -73,7 +73,7 @@
7373

7474
# ── 4. Different settings → different behavior ───────────────────────────
7575
# Now create settings with ONLY the terminal tool and condenser disabled.
76-
terminal_only_settings = AgentSettings(
76+
terminal_only_settings = LLMAgentSettings(
7777
llm=settings.llm,
7878
tools=[Tool(name=TerminalTool.name)],
7979
condenser=CondenserSettings(enabled=False),

openhands-agent-server/openhands/agent_server/models.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ class _ConversationInfoBase(BaseModel):
121121
default_factory=list,
122122
description="List of activated knowledge skills name",
123123
)
124+
invoked_skills: list[str] = Field(
125+
default_factory=list,
126+
description=(
127+
"Names of progressive-disclosure skills explicitly invoked via the "
128+
"`invoke_skill` tool."
129+
),
130+
)
124131
blocked_actions: dict[str, str] = Field(
125132
default_factory=dict,
126133
description="Actions blocked by PreToolUse hooks, keyed by action ID",

openhands-agent-server/openhands/agent_server/settings_router.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,24 @@
22

33
from fastapi import APIRouter
44

5-
from openhands.sdk.settings import AgentSettings, ConversationSettings, SettingsSchema
5+
from openhands.sdk.settings import (
6+
ConversationSettings,
7+
SettingsSchema,
8+
export_agent_settings_schema,
9+
)
610

711

812
settings_router = APIRouter(prefix="/settings", tags=["Settings"])
913

1014

1115
@lru_cache(maxsize=1)
1216
def _get_agent_settings_schema() -> SettingsSchema:
13-
return AgentSettings.export_schema()
17+
# ``AgentSettings`` is now a discriminated union over
18+
# ``LLMAgentSettings`` and ``ACPAgentSettings``; the combined
19+
# schema tags sections with a ``variant`` so the frontend can
20+
# show LLM-only or ACP-only sections based on the active
21+
# ``agent_kind`` value.
22+
return export_agent_settings_schema()
1423

1524

1625
@lru_cache(maxsize=1)

openhands-sdk/openhands/sdk/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,21 @@
4545
)
4646
from openhands.sdk.plugin import Plugin
4747
from openhands.sdk.settings import (
48+
ACPAgentSettings,
4849
AgentSettings,
50+
AgentSettingsConfig,
4951
CondenserSettings,
5052
ConversationSettings,
53+
LLMAgentSettings,
5154
SettingsChoice,
5255
SettingsFieldSchema,
5356
SettingsSchema,
5457
SettingsSectionSchema,
5558
VerificationSettings,
59+
default_agent_settings,
60+
export_agent_settings_schema,
5661
export_settings_schema,
62+
validate_agent_settings,
5763
)
5864
from openhands.sdk.settings.metadata import (
5965
SettingProminence,
@@ -140,7 +146,13 @@
140146
"CondenserSettings",
141147
"ConversationSettings",
142148
"VerificationSettings",
149+
"ACPAgentSettings",
143150
"AgentSettings",
151+
"AgentSettingsConfig",
152+
"LLMAgentSettings",
153+
"default_agent_settings",
154+
"export_agent_settings_schema",
155+
"validate_agent_settings",
144156
"SettingsChoice",
145157
"SettingProminence",
146158
"SettingsFieldMetadata",

0 commit comments

Comments
 (0)