Skip to content

[Feature]: Create plugin-spec conversations from the agent profile at dispatch (local and OHE) #601

Open

Description

@simonrosenberg

Part of #600.

Problem or Use Case

The plugin_spec conversation runner (#580, automation 1.21.0+) launches its conversation from the automation's agent profile: RemoteConversation.create(workspace, StartConversationRequest(agent_profile_id=…)) (openhands/automation/presets/plugin_spec/sdk_main.py). In cloud mode the workspace is OpenHandsCloudWorkspace(local_agent_server_mode=True), so the request goes to the sandbox's own agent-server.

That agent-server resolves agent_profile_id only from its local profile store (SDK openhands-agent-server/openhands/agent_server/launch.py). An unknown id raises ProfileNotFound, which returns 404. On OHE that store has no agent profiles:

  • Profiles live in enterprise (org.agent_profiles).
  • Enterprise copies only LLM profiles into sandboxes, and only when it starts a conversation itself.

The dispatcher's preflight checks the profile against the app server's /api/agent-profiles, so it passes, and the launch inside the sandbox is then expected to fail with 404. Not yet reproduced on a live OHE deployment; the evidence is from the code.

Secret scoping has the same gap. workspace.get_secrets(agent_profile_id=…) passes a parameter that enterprise's sandbox secrets endpoint ignores.

Desired Behavior

For plugin-spec conversation runs, the automation service creates the conversation at dispatch and the runner attaches to it.

  • Creation. After the sandbox is ready, the dispatcher calls a new backend method, create_conversation:
    • LocalAgentServerBackend: agent-server POST /api/conversations with agent_profile_id, plugins and the run's tags.
    • CloudSandboxBackend: enterprise POST /api/v1/app-conversations with the run's sandbox_id, agent_profile_id, plugins, tags and trigger: automation, using the minted user key. It then polls the start task for the conversation id.
  • Follow-ups. Runs that continue a conversation (continue_conversation) reuse the subject's conversation.
  • Provenance check. If the conversation's launched_agent_profile isn't the requested profile, the run fails before the runner starts.
  • Runner. The dispatcher exports AUTOMATION_CONVERSATION_ID. The runner attaches with RemoteConversation.attach(...), then sends the prompt, runs and reports as today. It no longer creates conversations, and no longer passes agent_profile_id to get_secrets on OHE.

Acceptance Criteria

  • Reproduce the current OHE behavior, or reproduce it locally with an agent-server that lacks the profile, and record the error.
  • Locally and on OHE, a plugin-spec conversation run's conversation is created at dispatch through the run's backend, and its launched_agent_profile equals the run's profile.
  • A missing, inaccessible or silently replaced profile fails the run with a visible error before the runner starts.
  • Runs that continue a conversation reuse the existing one.
  • The runner attaches instead of creating, and the existing plugin_spec tests pass once updated for attach.

Additional Context


OpenHands AI triage

The following comments and acceptance criteria were added by the OpenHands AI agent.

Triage

Verified on main 9636764 (= 1.21.0). In cloud mode the plugin_spec runner builds OpenHandsCloudWorkspace(local_agent_server_mode=True) (openhands/automation/presets/plugin_spec/sdk_main.py:158) and then calls RemoteConversation.create(workspace, StartConversationRequest(agent_profile_id=...)) (:247), so the launch goes to the sandbox's own agent-server. The pinned SDK 1.55.1 resolves agent_profile_id only from that server's local profile store (openhands-agent-server/openhands/agent_server/launch.py, get_agent_profile_store()); an enterprise profile id is absent there, so an unknown id raises ProfileNotFound (404). The dispatcher preflight (_validate_plugin_run_agent_profile -> GET /api/agent-profiles on the app server) passes, so the failure surfaces only inside the sandbox. Secret scoping has the same gap: workspace.get_secrets(agent_profile_id=...) (:211) passes a parameter that enterprise's GET /{sandbox_id}/settings/secrets ignores. The issue states this is not yet reproduced on a live OHE deployment; the evidence is from the code, so the first criterion records the reproduction.

Scope: on OHE/Cloud, the plugin_spec runner starts its conversation through enterprise's POST /api/v1/app-conversations (the run's sandbox_id, the agent_profile_id, plugins, tags, trigger: automation, and the task as the initial message) and then attaches to that conversation on the sandbox's agent-server; local mode is unchanged. An unknown or inaccessible profile fails the run visibly, with no fallback to the default agent.

Non-goals: the prompt/plugin preset driver's OHE path, the LLM-profile override, the finish policy / hook_config forwarding (OpenHands/enterprise#868), the capability flag, and preset create/update accepting agent_profile_id are tracked in #600 and #557, not here. No change to manifest fetch, tarball construction, dispatch env vars, run lifecycle, or the plugin-spec create contract.

Dependency: the "one shared launch helper" criterion completes when #600's preset driver lands in this repository; until then the runner's helper is the single launch path for plugin_spec runs.

Acceptance Criteria

  • The current failure is reproduced and recorded: a cloud-mode plugin_spec run whose agent_profile_id is absent from the sandbox agent-server's profile store fails with the ProfileNotFound / 404 error, with the observed error text and the command or deployment that produced it.
  • On OHE/Cloud, a plugin_spec run with a profile starts its conversation through enterprise's POST /api/v1/app-conversations, passing the run's sandbox_id, the agent_profile_id, the plugin sources, the run's tags, and trigger: automation; the run then attaches to that conversation on the sandbox's agent-server rather than creating one there.
  • The launched conversation reports launched_agent_profile equal to the run's agent_profile_id, and carries the run's automation tags (e.g. automationname, automationrunid).
  • The profile's secret scoping applies on OHE: the secrets exposed to the conversation are limited by the profile's secret_refs, and no request passes agent_profile_id to an endpoint that ignores it.
  • An unknown or inaccessible profile fails the run with a visible error (non-success run status and/or an error surfaced to the caller), and no default agent is launched.
  • Local mode is unchanged: a local plugin_spec run still launches via RemoteConversation.create(StartConversationRequest(agent_profile_id=...)) against AGENT_SERVER_URL, and the existing plugin_spec tests still pass.
  • The enterprise start-and-attach launch is implemented once and reused by both the plugin_spec runner and, once Automation runs launch from the selected agent profile, via plugin specs (local and OHE) #600 lands, the preset driver; the runner holds no second copy of the OHE launch sequence.
  • Existing plugin_spec behavior is preserved: tarball contents, entrypoint, and dispatch env vars (including AUTOMATION_AGENT_PROFILE_ID) are unchanged, and uv run pytest tests/test_plugin_specs.py passes.

Activity

  1. added
    enhancement
    on Oct 19, 2026
  2. added
    ready-for-dev
    on Oct 19, 2026
  3. simonrosenberg commented on Oct 19, 2026

    @simonrosenberg
    MemberAuthor

    I'm an AI agent (Claude Code) helping @simonrosenberg. I updated the description to match the third version of #600. The automation service now creates every run's conversation through its per-mode backend (POST /v1/runs/{run_id}/conversation), and the runner attaches to it. Two criteria in the AI triage above therefore change:

    • "Starts its conversation through enterprise's POST /api/v1/app-conversations … then attaches." The service makes that call, not the runner. The runner only calls the automation endpoint and attaches.
    • "Secrets exposed to the conversation are limited by the profile's secret_refs." This can't be met from automation alone. Enterprise doesn't apply secret_refs yet, and that arrives with fix(agent-profiles): align Enterprise launches with the SDK enterprise#763.
  4. changed the title [-][Feature]: Route plugin_spec runs through enterprise's conversation start on OHE[/-] [+][Feature]: Create plugin-spec conversations from the agent profile at dispatch (local and OHE)[/+] on Oct 19, 2026
  5. simonrosenberg commented on Oct 19, 2026

    @simonrosenberg
    MemberAuthor

    I'm an AI agent (Claude Code) helping @simonrosenberg. This issue is now the core implementation piece of the re-scoped #600, which focuses on plugin-spec automations since the presets may be deprecated.

    The service creates the conversation at dispatch on both backends, then the runner attaches. Plugin-spec runners prepare nothing before creating a conversation, so the service can create it up front.

    The AI triage block below predates this re-scope:

  6. simonrosenberg commented on Oct 19, 2026

    @simonrosenberg
    MemberAuthor

    I'm an AI agent (Claude Code) helping @simonrosenberg.

    Confirmed on Beta (2026-10-19), which runs automation 1.21.0 and agent-server 1.55.1, the same versions as OHE 0.82.0/0.83.0.

    I made the same call as the plugin-spec runner's launch, from the sandbox of a real automation run. It was POST /api/conversations with agent_profile_id set to an enterprise profile that enterprise resolves fine for interactive conversations. The response:

    404 {"detail": "Agent profile with id '3d9a7654-…' not found"}
    

    The sandbox's agent-server lists only its own default profile, so a plugin-spec conversation run on OHE fails at creation today. This call created nothing. The test profile, automation and sandboxes were removed afterwards.

  7. added 2 commits that reference this issue on Oct 19, 2026
    f4075c5
    ed4458e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpriority:lowready-for-dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions