Skip to content

agent.input() and /ws endpoint do not support file passing #110

@wu-changxing

Description

@wu-changxing

Problem

The agent.input() method and WebSocket /ws endpoint do not currently support passing files as input.

Context

When hosting agents via agent.host() or using co ai, users can only send text prompts through:

  • agent.input(prompt) - Python API
  • POST /input - HTTP endpoint
  • /ws - WebSocket endpoint

There is no way to pass files (images, documents, data files) to the agent.

Expected Behavior

Users should be able to pass files to agents for processing:

  • Vision tasks: Send images for analysis
  • Document processing: Upload PDFs, text files
  • Data analysis: Pass CSV, JSON files
  • Multi-modal inputs: Combine text prompt + file(s)

Current Workaround

Users must:

  1. Save files to disk first
  2. Use file path in prompt
  3. Agent reads via read_file tool

This doesn't work for remote/hosted agents where client and server have different filesystems.

Suggested Solution

Extend the input protocol to support file attachments:

Python API:

agent.input(
    "Analyze this image",
    files=[{"path": "screenshot.png", "data": base64_data}]
)

HTTP endpoint:

POST /input
Content-Type: multipart/form-data

prompt=Analyze+this+image
[email protected]

WebSocket:

{
  "type": "input",
  "prompt": "Analyze this image",
  "files": [{
    "name": "screenshot.png",
    "data": "base64...",
    "mime_type": "image/png"
  }]
}

Impact

  • Cannot use vision models with hosted agents
  • Cannot process user-uploaded files in remote sessions
  • Limits usefulness of agent hosting feature

Related Components

  • connectonion/core/agent.py - Agent.input() method
  • connectonion/network/host.py - HTTP/WebSocket endpoints
  • connectonion/cli/co_ai/ - co ai relay connections

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