Skip to content

[Feature]: Add image attachment support to sessions_spawn tool #16344

@goranobradovic

Description

@goranobradovic

Feature Request

Allow the sessions_spawn tool to attach images to spawned subagent sessions.

Current Behavior

The sessions_spawn tool currently only accepts a task string parameter. There's no way to pass images to a spawned subagent, which limits the ability to use subagents for image analysis tasks.

Current API:

sessions_spawn({
  task: string,
  agentId?: string,
  model?: string,
  thinking?: string,
  runTimeoutSeconds?: number,
  timeoutSeconds?: number,
  cleanup?: "delete" | "keep"
})

Use Case

Spawn a subagent to analyze images (e.g., OCR, document analysis, photo description) using vision-capable models like zai/glm-4.5v, openai/gpt-4o, or ollama/llava.

Example scenario:

  • Main session receives an image from user
  • Main session spawns a subagent with a vision model to analyze it
  • Subagent returns analysis to main session
  • Main session delivers result to user

Proposed Solution

Add an images parameter to sessions_spawn that accepts image paths or data URIs:

sessions_spawn({
  task: string,
  images?: Array<{
    path?: string,      // Local file path
    url?: string,       // Remote URL
    data?: string,      // Base64 data URI
    mimeType?: string   // Optional: image/jpeg, image/png, etc.
  }>,
  // ... existing params
})

Example usage:

sessions_spawn({
  task: "Extract all text from this document image",
  images: [{ path: "/home/user/.openclaw/media/inbound/document.jpg" }],
  model: "zai/glm-4.5v",
  cleanup: "delete"
})

Alternative Considered

Passing image paths in the task string, but this is inconsistent with how images are handled elsewhere in the system and would require parsing logic.

Impact

This would enable:

  • Vision subagents for image analysis
  • OCR/document processing workflows
  • Multi-modal task delegation
  • Better resource management (using smaller vision models only when needed)

Environment

  • OpenClaw version: 2026.2.13
  • Node.js: v22.22.0
  • OS: Linux 6.17.9-76061709-generic (x64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions