Skip to content

[FEATURE] Open a daemon thread as a named Markdown agent #1750

Description

@edenreich

Summary

A client of infer daemon should be able to open a thread as a named Markdown agent: an agent: <name> thread option on new_session / resume_conversation. The thread then runs as that agent - its front-matter model (fixed for the thread), its body as the system prompt, and its tools / disallowedTools allowlist. It is the same overlay the Agent tool already gives a named subagent (applyNamedAgent).

Today the CLI interprets agent files only for subagents. A client that wants an "agent chat" has to reimplement that interpretation itself. The desktop app does exactly that: its own model rule, the body sent as system_prompt, no tools allowlist. Nothing keeps the model fixed, because any select_model switches it. The desktop side is tracked in inference-gateway/desktop (follow-up issue linked below).

Current state, verified in the code:

  • internal/tools/mdagent.go loads .infer/agents/*.md then ~/.infer/agents/*.md (loadMarkdownAgents, resolveMarkdownAgentModel, resolveMarkdownAgentTools).
  • internal/tools/agent.go applyNamedAgent overlays the agent onto a subagent's task spec. Only the Agent tool calls it.
  • internal/sessions/domain/sessions.go ThreadOptions carries model, mode, system_prompt, custom_instructions, sandbox_directories, max_turns, subagent, workspace, workspace_dir - no agent.
  • cmd/daemon/daemon.go builds the registry on teleports.LaunchWorker, the seam every launch goes through, local or relayed to a workspace. internal/sessions/infrastructure/worker.go maps the options onto headless --serve flags and INFER_ env.
  • internal/presentation/headless/panel.go modelPicker.selectModel switches the worker's model on any select_model.

The agent must resolve on the daemon the thread is opened on, which has the user's agent files and the project dir. A thread placed on a remote workspace runs where those files do not exist, so it has to receive the resolved options.

Acceptance Criteria

  • new_session / resume_conversation accept an agent thread option. The daemon resolves it against the frame's project_dir (.infer/agents, then ~/.infer/agents) with the existing loader before the worker launches. The resolved model, system prompt and tool allowlist travel as thread options, so a workspace relay and a teleport (Portable()) keep them.
  • An unknown agent fails the thread with a RUN_ERROR naming the available agents.
  • The thread runs on the agent's front-matter model. Empty, inherit or a bare alias falls back to the thread's own model, as for subagents. The body is the system prompt, custom_instructions still append, and the tools allowlist restricts the worker's tools like a named subagent's.
  • When the agent pins a model, select_model on that thread leaves it unchanged, and the models reply reports the pinned model.
  • Unit tests cover option parsing and relay, resolution (known, unknown, inherit, tools), and the pinned select_model. internal/sessions/README.md and docs/browser-extension-protocol.md document the option.

Activity

  1. added
    enhancement
    on Nov 7, 2026
  2. added theissue type on Nov 7, 2026
  3. edenreich commented on Nov 7, 2026

    @edenreich
    ContributorAuthor
  4. moved this from Todo to In progress in 2026on Nov 7, 2026
  5. moved this from In progress to QA in 2026on Nov 7, 2026
  6. inference-gateway-releaser commented on Nov 7, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.247.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  7. moved this from QA to Done in 2026on Nov 7, 2026
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

    enhancementreleased

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions