Repository navigation
Description
SDK/Agent Server implementation complete (2026-10-13). #5406, #5408 and #5409 are merged. Remaining cross-repository work is tracked in OpenHands/OpenHands#17991 (Canvas default-path unification, global-settings migration and catalog parity), OpenHands/enterprise#759 (Cloud resolve-once/finalize boundary and fail-closed behavior), and OpenHands/enterprise#59 / #758 (context/tool preservation and migration/rollout validation). The cross-repository parity test remains part of those follow-ups. #4960 is a separate additive skills channel and does not establish catalog parity.
Is there an existing feature request for this?
- I have searched existing issues and feature requests, and this is not a duplicate.
This supersedes #5141 and PR #5154. The goals and live evidence in #5141 still stand: two profiles with identical contents, one named default, launch different agents. This issue replaces its design. #4958 depends on it.
Problem or Use Case
The agent you get depends on which code path the start request takes. #5141 shows it live. Two Agent Profiles with identical contents, one of them named default, launch with different tools, suffix, MCP servers and skills, and one of them gets a stale timestamp.
No single path is the root cause. Nothing in the codebase enforces that a launch agent is built in one place. Every fix so far only centralised some of the code: #3967, #4014, #4016, #4029, #4542, and the single-function refactor in #5154. None of them added anything that fails when a new path or a new field bypasses the shared code.
On main (5ffdd29):
Four places build a launch agent:
- The
agent_settingsvalidator onStartConversationRequest(request.py#L340). ConversationSettings.create_request(settings/model.py#L1172). The OpenAI-compatible gateway uses it to build its agent from global settings and ignores the active profile (openai/service.py#L309)._resolve_agent_from_profile(conversation_service.py#L447).- Docker
prepare_start(mediation.py#L56-L102). It builds the agent on the host using the host's runtime facts (browser availability, ACP skill sourcing), then sends the finished agent into the container.
The agent is still changed after it is built. _start_conversation rewrites request.agent four more times: load_memory, ACP skill sourcing, the suffix append and the Codex secret strip (conversation_service.py#L1717-L1764). Each of these is a launch step that lives outside any launch function.
The preview is a copy maintained by hand. materialize re-implements the skill rule, and its comment says it "mirrors" the launch (agent_profiles_router.py#L536-L538).
Nothing checks that a profile can express every setting. #4287 (merged 2026-09-24) added enable_classify_and_switch_llm_tool, active_meta_profile, meta_profile and meta_profile_llms to OpenHandsAgentSettings (settings/model.py#L1318). It added none of them to OpenHandsAgentProfile (agent_profile.py#L136). As a result, meta-profile routing works on an agent_settings launch and is silently missing from a profile launch. No test failed.
Why #5154 was closed rather than fixed. It put the four paths behind one prepare_agent_launch function, with four problems:
- It converts
agent_settings, which is already a fully resolved settings object, into a fake profile, then puts the lost fields back withbase_settings. Every builder then needs separate branches for the with-base and without-base cases. - A single function has to run in one process. For Docker, the host resolves the profile twice and asks the container's
/server_infofor runtime facts the container already has. If a step fails after that call, the container is stopped, even a live one whose conversation was re-posted. - Meta-profile routing receives only the meta-profile's name, so it fails in any runtime that has no meta-profile store (Docker, cloud).
- Nothing fails when the next field or path bypasses the function. The OpenAI gateway already does.
Desired Behavior
A launch has two stages with a typed value passed between them. Code outside those two stages cannot build or change a launch agent.
agent_profile_id ──┐
agent_profile ─────┴─► resolve(stores) ─► ResolvedLaunch ──┐
agent_settings (already reference-free) ──────────────────┼─► finalize(runtime) ─► LaunchedAgent ─► _start_event_service
agent (raw, SDK users) ──────────────────────────┘
runs where the stores live runs where the agent runs
(host, cloud control plane) (local server, container, sandbox)
resolve(source, stores, additions) → ResolvedLaunchruns where the stores live.- Input: a stored profile id or an inline profile draft.
- Output: settings with no references left (
OpenHandsAgentSettings | ACPAgentSettings), plusLaunchedAgentProfileprovenance and the resolved secret scope. - It resolves every reference:
llm_profile_ref(or the per-launch override),mcp_server_refs, the user and marketplace skill catalog minusdisabled_skills, andmeta_profile_reftogether with the LLMs it routes to. All of them are copied into the output, so the runtime needs no stores. - It collects every dangling reference into one structured 422. Store failures such as a lock timeout or a decrypt failure are 5xx, not 422.
- It knows nothing about the runtime.
finalize(resolved, runtime) → LaunchedAgentruns in the process that will run the agent. It uses that process's ownis_tool_usable, ACP skill sourcing and workspace.- It builds the agent and sets every launch-owned field:
- default tools, plus browser when usable (only when
toolsis unset) - forced streaming
current_datetime, computed at launch (unless suppressed)- project skills
load_memory- ACP skill sourcing
system_message_suffix_append- the Codex secret strip
- default tools, plus browser when usable (only when
- It is the only function that returns a
LaunchedAgent.
- It builds the agent and sets every launch-owned field:
- Each source enters at the stage that fits it, with no conversions.
agent_profile_idand inlineagent_profilego throughresolve, thenfinalize.agent_settingsalready has no references, so it goes straight tofinalize. It remains the wire format from a control plane to a runtime. Only clients that assemble it themselves are deprecated (canvas'sbuildConfigured*AgentSettings).- A raw
agent(SDK users building agents in code) goes throughfinalize's post-build steps, so it also gets a freshcurrent_datetime,load_memoryand the additions. - Inline profiles are recorded as inline in provenance and are not given a new id.
- Where each stage runs:
- Local agent-server: both stages, in the same process.
- Docker runtime: the host resolves and forwards the
ResolvedLaunch, and the container finalizes. The host builds no agent, makes no/server_infocall and resolves only once. A failed build therefore gives the host no reason to stop a container. - Cloud: the control plane resolves and the sandbox agent-server finalizes. Cloud stops sending a pre-built
agent. - OpenAI-compatible gateway: resolves the active profile and finalizes, like any other launch.
materialize: runsresolveexactly as a launch does, thenfinalizeagainst a declared description of the target runtime. It is the same code as a launch, so it cannot drift.
- Tests enforce the boundary. It no longer relies on convention.
-
_start_event_serviceaccepts only aLaunchedAgent. Nothing changes the agent afterfinalize. -
Architecture test: fails on any
create_agent()call or agent construction inopenhands-agent-serveroutside the launch module, and on anymodel_copy(update={"agent": …})on a start request. -
Field-ownership test: every field on
OpenHandsAgentSettingsandACPAgentSettingsmust be classified as one of:- profile-owned: must exist on the matching profile model;
- resolved from a reference:
llmfromllm_profile_ref,mcp_configfrommcp_server_refs, the meta-profile fields frommeta_profile_ref; - launch-owned: set by
finalize; - legacy: with a removal version.
An unclassified field fails CI. This test would have caught Add Pareto prompt meta-profile routing #4287.
-
Parity test: for each source (stored, inline,
agent_settings, anddefaultcompared withdefault-copy),materializeand a real launch produce the sameResolvedLaunch, and the same agent for the same runtime description. This includestools: null, where browser depends on the runtime.
-
The product goals from #5141 carry over unchanged:
defaultis an ordinary profile.- Product clients send a profile on every launch.
- Launch additions only add, and cannot widen a profile's scope.
- Failures are explicit, with no silent fallback.
- Derived launches (child conversations,
/new, sub-conversations) keep the parent's profile.
Acceptance Criteria
-
resolveandfinalizeare the only code that turns a start request into an agent. Each of the four build sites above is removed or calls them. -
_start_event_serviceaccepts only aLaunchedAgent, and_start_conversationno longer rewritesrequest.agent. - The architecture test runs in CI with an empty allow-list.
- The field-ownership test runs in CI with every settings field classified. The Add Pareto prompt meta-profile routing #4287 meta-profile fields can be set on a profile through
meta_profile_ref. - A profile with
meta_profile_refroutes in a Docker runtime whose HOME has no meta-profile store. A danglingmeta_profile_reffails the launch with the structured error. -
agent_settingslaunches go straight tofinalize, with no profile conversion. - Docker: the host never builds an agent or calls
/server_info, and the container finalizes. A failedfinalizenever stops a conversation that was already running. -
materializematches a real launch under the parity test above, in both local and Docker runtimes. -
current_datetimeis computed at launch for every source, including rawagentand the OpenAI gateway. - All dangling references are returned together in one 422. Store and infrastructure failures are 5xx.
- The OpenAI-compatible gateway launches the active profile through the pipeline.
- Inline profiles are recorded as inline in
LaunchedAgentProfile, and no id is created for them. - Follow-up in OpenHands/OpenHands (from [Agent Profile] The
defaultprofile and named profiles build different agents — collapse launch into one pipeline #5141): canvas sends a profile on every launch. It deletes thedefaultname rule, its fallbacks, the copied rule inuse-llm-configured, and client-side agent assembly. - Follow-up for cloud: the control plane calls
resolveand the sandbox callsfinalize. Cloud no longer overwrites profile fields, and resolution failures are shown to the user. - One-time migration (from [Agent Profile] The
defaultprofile and named profiles build different agents — collapse launch into one pipeline #5141): refreshdefaultfrom globalagent_settingsonce the settings pages edit the active profile. - A cross-repo e2e test reproduces the table in [Agent Profile] The
defaultprofile and named profiles build different agents — collapse launch into one pipeline #5141, and every row matches.
Alternatives Considered
- One
prepare_agent_launchfor every source (PR feat(agent-profiles): one launch pipeline for every conversation start #5154). Rejected, for three reasons:- Converting
agent_settingsinto a profile loses fields, which then have to be put back throughbase_settings. - A single function runs in a single process. For Docker, that means either resolving with the host's runtime facts or calling into the container to ask for them.
- Without the tests above, the next path (the gateway) or the next field (Add Pareto prompt meta-profile routing #4287) goes around it.
- Converting
- Keep fixing fields path by path (Profile-resolved OpenHands agents have no exec tools (and no public skills) #3967, Profile-launched conversations never enable LLM streaming — on_token crash on switch_llm #4014, Profile-launched conversations never load project skills (load_project_skills stuck False in resolver) #4016, Allow client-supplied launch-time agent overrides on the
agent_profile_idpath (carry canvas-only enrichments like<RUNTIME_SERVICES>) #4029, Global agent_context.load_memory preference is ignored unless the conversation is launched from an agent profile #4542). Each fix closed one gap, and every new field starts the cycle again. - Generate the profile model from the settings model instead of writing the field-ownership test. The profile holds references where the settings hold values (
llm_profile_refinstead ofllm). A generated model would hide exactly the mapping that needs to be explicit.
Priority / Severity
High - Significant impact on productivity
Estimated Scope
Large - Significant feature requiring architecture changes
Feature Area
- Agent API / Core functionality
- Tools / Tool system
- Skills / Plugins
- Agent Server
- Workspace management
- Configuration / Settings
- Examples / Templates
- Documentation
- Testing / Development tools
- Performance / Optimization
- Integrations (GitHub, APIs, etc.)
- Other
Technical Implementation Ideas (Optional)
Suggested order. Each step can ship on its own:
- Tests first. Land the architecture test and the field-ownership test, with today's violations listed in an explicit allow-list. Drift is visible from day one, and the allow-list doubles as the to-do list.
finalize. Move two things intofinalize: the runtime half of_resolve_agent_from_profile, and the post-build rewrites in_start_conversation. Send every source through it and require aLaunchedAgentin_start_event_service. This step alone fixes the stale timestamp onagent_settingsand raw-agent launches.resolve. Move the store half intoresolve. Add inlineagent_profile,meta_profile_ref(copying in the meta-profile and its LLMs), the per-launchllm_profile_refand the structured error.materializebecomesresolve+finalize.- Docker. The host resolves and forwards, and the container finalizes. Delete the host-side build in
prepare_start. - Gateway and remaining paths. Move the OpenAI gateway onto the pipeline and empty the allow-lists.
- Canvas, cloud and the
defaultmigration, as described in [Agent Profile] Thedefaultprofile and named profiles build different agents — collapse launch into one pipeline #5141.
These pieces of #5154 can be reused:
- moving
SendMessageRequestout ofrequest.py, which breaks an import cycle UnresolvedProfileReferencesfor the structured 422- the inline
agent_profilefield - the
.pr/launch_parity_e2e.pyrig
Decisions to settle:
- How
materializedescribes the runtime. A Docker or cloud server has to describe the target runtime without starting one. Options: a capability descriptor for each image, or reporting runtime-dependent fields as "decided at launch". - Wire format for
ResolvedLaunch. Either reuseagent_settingstogether with the existing secrets and provenance fields, or add a new explicit field. Provenance in a forwarded launch should be trusted only when it comes from the runtime's own control plane. - Carried over from [Agent Profile] The
defaultprofile and named profiles build different agents — collapse launch into one pipeline #5141:- skill model: global allow-list or per-profile
disabled_skills - chat LLM picker: per-launch override or an edit to the profile
- MCP servers outside profile scope (the cloud platform server, plugin servers)
- cloud fallback policy when resolution fails
- skill model: global allow-list or per-profile
Additional Context
- Supersedes [Agent Profile] The
defaultprofile and named profiles build different agents — collapse launch into one pipeline #5141 (goals and evidence) and PR feat(agent-profiles): one launch pipeline for every conversation start #5154 (implementation). - [Agent Profile] Clients can't ask what tools an agent will get, or which tools are pickable #4958 / PR feat(agent-profiles): tools is the only tool control, selected from one server catalog #5151: the tool catalog. It needs
materializeto match the launch. - Add Pareto prompt meta-profile routing #4287: meta-profile routing (see above).
- [Agent Profile] Sub-agent delegation bypasses a profile's tool and MCP restrictions #4953: sub-agents bypass profile scope.
- [Agent Profile] Profiles can only append to the system prompt, not replace it #4956: prompt templates.
- [Agent Profile] The profile model isn't self-describing — clients hardcode version numbers to guess which fields a server accepts #4964: self-describing profile schema.
- [Agent Profile] Profiles can't scope which secrets an agent receives #5030 / fix(agent-server): enforce profile secret scope on runtime-launched conversations #5193: secret scoping.
- Conversation launch drops LLM api_key when the seeded
defaultagent profile is active (litellm AuthenticationError) #4533: the seededdefaultprofile drops the LLM key. - bug: preserve runtime services context for agent-profile conversation launches OpenHands#16205: runtime services are missing on profile launches.
- [Bug]: Centralize effective configuration for the next Home conversation OpenHands#16951: home-page readiness and launch disagree.
Activity
all-hands-bot commentedon Sep 30, 2026
The following comments were added by the OpenHands AI agent.
Decision needed
This issue is a large architecture proposal that supersedes #5141 and PR #5154, and its own "Decisions to settle" list contains load-bearing choices that are not inferable from the repository. Before it can be marked ready-for-dev, please resolve:
How
materializedescribes the target runtime. A Docker or cloud preview must describe a runtime it has not started. Should it use a per-image capability descriptor, or report runtime-dependent fields (for example browser availability whentools: null) as "decided at launch"? This determines what the "materializematches a real launch, in both local and Docker runtimes" criterion can actually assert.The
ResolvedLaunchwire format. Reuse the existingagent_settingspayload together with the current secrets and provenance fields, or add a new explicit field? And when the host forwards aResolvedLaunchinto a container, which provenance and secrets fields are trusted — only when the payload comes from the runtime's own control plane?In-repo scope versus follow-ups. Should [Agent Profile] Four code paths build a launch agent and nothing enforces one — split launch into resolve + finalize and guard the boundary #5398 be scoped to the SDK and agent-server pipeline, the
_start_event_service/architecture/field-ownership/parity tests, andmaterialize, with the canvas (OpenHands/OpenHands) and cloud control-plane items tracked as separate follow-ups? Please also confirm the carried-over [Agent Profile] Thedefaultprofile and named profiles build different agents — collapse launch into one pipeline #5141 choices the criteria depend on: a per-launchllm_profile_refoverride versus editing the profile, and whether MCP servers outside profile scope (the cloud platform server, plugin servers) are in or out.simonrosenberg commentedon Oct 2, 2026
Status after #5406 merged (
35410b3af): the 10 acceptance items it delivers are ticked above.Still open:
main(23e3cb720), CI is green, and it is ready for review.finalize.<RUNTIME_SERVICES>on profile launches. fix: send the bundled skill set on agent-profile launches too OpenHands#17282 sends skills there too and needs feat(agent-server): accept additional skills when launching an agent #4960.resolve), the one-timedefaultrefresh, and the cross-repo e2e test for the [Agent Profile] Thedefaultprofile and named profiles build different agents — collapse launch into one pipeline #5141 table.simonrosenberg commentedon Oct 13, 2026
The SDK/Agent Server implementation is complete: #5406, #5408 and #5409 are merged, including the active-profile gateway and inline provenance. I checked off those last two SDK criteria. Real API, model/MCP, and Docker QA exercised stored/default-copy/inline profiles, overrides, gateway launches and runtime finalization.
The remaining cross-repository work now has explicit owners:
Closing the completed SDK tracker; these downstream acceptance criteria remain open in their owning repositories.