Hey everyone! This may have already been asked som...
# questions
e
Hey everyone! This may have already been asked somewhere but can't seem to find the answer. I'm using a full sized Qwen/Qwen3-Coder-480B-A35B-Instruct fp16 model served using vllm. I've been trying to use it in openhands, and while chats are working, any time the agent actually tries to take an action, I get
openhands.sdk.conversation.exceptions.ConversationRunError: Conversation run failed for id=12d337ed-ed3d-4603-932e-8f3e7181601e: litellm.APIError: APIError: OpenAIException - Payload Too Large
The context size I've set for the vllm server is 256k tokens, so I doubt the payload is actually too large. I think I'm misconfiguring something with the tool calling. I'm passing in the flag
--tool-call-parser qwen3_coder
. The qwen3coder_tool_parser.py is in the same directory as the safetensors. Unsure what I'm doing wrong.
l
Thanks @eager-appointment-68614! Could you share the full commands that you ran for both vllm and openhands?
e
I am serving via kserve. The vllm serve command with the environment variables:
Copy code
VLLM_CMD="vllm serve \"${MODEL}\" \
        --served-model-name \"${MODEL_NAME_RESOLVED}\" \
        --host 0.0.0.0 --port 8080 \
        --tensor-parallel-size ${TENSOR_PARALLEL_SIZE:-8} \
        --pipeline-parallel-size ${PIPELINE_PARALLEL_SIZE:-1} \
        --max-model-len ${MAX_MODEL_LEN:-131072} \
        --gpu-memory-utilization ${GPU_MEM_UTIL:-0.85} \
        --enable-expert-parallel \
        --enforce-eager \
        --disable-log-requests \
        --uvicorn-log-level warning"
      
      # Add tool calling flags if enabled
      if [ "${ENABLE_AUTO_TOOL_CHOICE:-false}" = "true" ]; then
        VLLM_CMD="${VLLM_CMD} --enable-auto-tool-choice"
      fi
      if [ -n "${TOOL_CALL_PARSER:-}" ]; then
        VLLM_CMD="${VLLM_CMD} --tool-call-parser ${TOOL_CALL_PARSER}"
      fi
      
    Environment:
      MODEL_NAME:               qwen3
      HF_HUB_CACHE:             /tmp
      VLLM_LOGGING_LEVEL:       WARNING
      POD_IP:                    (v1:status.podIP)
      POD_NAMESPACE:            sunny (v1:metadata.namespace)
      TENSOR_PARALLEL_SIZE:     8
      PIPELINE_PARALLEL_SIZE:   1
      MAX_MODEL_LEN:            262144
      ENABLE_AUTO_TOOL_CHOICE:  true
      TOOL_CALL_PARSER:         qwen3_coder
      GPU_MEM_UTIL:             0.85
I have verified that all the environment variables are being passed in correctly. Here is the chat in openhands:
Copy code
Message from User ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Hello

Tokens: ↑ input 0 • cache hit N/A • ↓ output 0 • $ 0.00

Message from Agent ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Hello! How can I help you today?

Tokens: ↑ input 6.03K • cache hit 0.00% • ↓ output 10 • $ 0.00


> Can you read the README in the current directory?

Agent running... (Press Ctrl-P to pause)

Message from User ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Can you read the README in the current directory?

Tokens: ↑ input 6.03K • cache hit 0.00% • ↓ output 10 • $ 0.00

Agent Action ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Predicted Security Risk: LOW

Thought:
I'll help you read the README in the current directory. Let me check what files are available first.



Action: FileEditorAction

Arguments:
  kind: "FileEditorAction"
  command: "view"
  path: "/Users/sunny/Documents/openhands_test"

Tokens: ↑ input 12.1K • cache hit 0.00% • ↓ output 80 • $ 0.00

🔍 Agent created 1 action(s) and is waiting for confirmation:
  1. file_editor: kind='FileEditorAction' command='view' path='/Users/sunny/Documents/openhands_test' file_text=None old_str...
Choose an option:

> Yes, proceed
  Reject
  Always proceed (don't ask again)
  Auto-confirm LOW/MEDIUM risk, ask for HIGH risk
Hitting yes on that command returns the payload too large error.
l
Hey @eager-appointment-68614, sorry about the late reply. Here’s a long message from OpenHands on our logging options for LLM calls. I’d suggest starting with
DEBUG_LLM=true
to try to see the payload that’s being sent to the LM. Maybe there’s something really large in there? If you can’t find anything weird in the payload, maybe you could hit vllm directly (outside of openhands) and try to send the same prompt. And if you want to open up an issue on the repo we’d also be happy to have it recorded as well.
1. Enable LLM Completions Logging (Recommended)
The OpenHands agent-sdk has built-in support for logging LLM completions to files. You can enable this by setting environment variables:
```# Enable completions logging
export LOG_COMPLETIONS=true
# Optional: Specify where to save the logs (default is ./logs/completions)
export LOG_COMPLETIONS_FOLDER=/path/to/your/log/folder
# Then run the CLI
openhands```
This will create JSON files for each LLM call containing:
• The full request and response
• Token usage
• Cost information
• Timestamp and latency
2. Enable Debug Mode for LiteLLM (Advanced - Use with Caution)
For more verbose debugging that shows every detail of LLM interactions:
```# WARNING: This will expose sensitive information like API keys
export DEBUG_LLM=true
# You will be prompted to confirm you understand the risks
openhands```
⚠️ Never use this in production as it logs API keys and sensitive data.
3. Enable General Debug Logging
For more general logging output from OpenHands:
```# Enable debug mode
export DEBUG=true
# Or set a specific log level
export LOG_LEVEL=DEBUG
# Optionally enable file logging
export LOG_TO_FILE=true
export LOG_DIR=./logs
openhands```
👀 1
e
Thank you! I'll try it out and report any findings.
🙏 1
@limited-student-10747 so before I even get to tool calling, every single prompt I send sends the full starter prompt. Each completion request sends 6k more tokens than the last. What's causing this? This isn't dependent on the model I'm using, right? This is something with my openhands configuration?
l
Hmm, that’s very weird. The starter prompt should be sent at the beginning every time, but 6k more tokens than the last is surprising. If there is a way to get the full command/config that you used to confirm the misbehavior we can try to repro
e
Alright. What do you mean by full command/config? I am using the default installation of openhands via
uv tool install openhands
and launching openhands cli with just
openhands
. Providing the base url to the api and traffic is getting routed to a vllm server running fp16 Qwen/Qwen3-Coder-480B-A35B-Instruct. Critical flags for the vllm server are
--enable-auto-tool-choice
,
--trust-remote-code
, and
--tool-call-parser qwen3_coder
. I suspect the issue may be qwen3-coder-480B's chat_template.jinja https://huggingface.co/Qwen/Qwen3-Coder-480B-A35B-Instruct/blob/main/chat_template.jinja I wonder if it is a matter of me simply trying to do something that openhands is not meant for? Seems that openhands is meant for either chatgpt/claude api, or local llms. Not for full sized self hosted models.
l
No, it’s definitely OK with self-hosted models! I’d like to check this out, but we’ll have to get a hosting setup for that model, which is a bit heavy
If we can reproduce with a smaller model we’ll try that, but we have tried with qwen-3-coder-30b and not had issues
e
Okay. I will try spinning up an instance of qwen-3-coder-30b and see if there are differences.
Tried using the 30b model. Having the same issue. Here is an example conversation:
Copy code
Message from User ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Hello

Tokens: ↑ input 0 • cache hit N/A • ↓ output 0 • $ 0.00

Message from Agent ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Hello! How can I help you today?

Tokens: ↑ input 6.03K • cache hit 0.00% • ↓ output 10 • $ 0.00


> How are you doing?

Agent running... (Press Ctrl-P to pause)

Message from User ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

How are you doing?

Tokens: ↑ input 6.03K • cache hit 0.00% • ↓ output 10 • $ 0.00

Agent Action ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Thought:
I'm doing well, thank you for asking! I'm here and ready to help with whatever you'd like to work on. How can I assist you today?


🤔 Thinking: The user is just greeting me. This is a simple conversation starter. I should respond politely and be ready to help with whatever task the user wants to accomplish. There's nothing
specific to do here beyond the initial greeting.

Tokens: ↑ input 12.09K • cache hit 0.00% • ↓ output 107 • $ 0.00

Agent Action ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Predicted Security Risk: LOW

Thought:
I'm doing well, thank you for asking! I'm here and ready to help with whatever you'd like to work on. How can I assist you today?


👀 View Task List

Tokens: ↑ input 18.27K • cache hit 0.00% • ↓ output 175 • $ 0.00
The input on the first message is 6k tokens, second is 12k tokens, third is 18k tokens. Tool calls result in the "payload too large" error.
l
Thanks a lot, we’ll try to repro
e
I'm having trouble understanding the token metrics in the terminal. I'm now trying a local instance of devstral via lmstudio, and while I'm not hitting the "payload too large" error, I am seeing the input tokens metric balloon on every prompt. 6k tokens per message initially. By the 30th message (really just 3 messages with tool calls for the model to read some files in the codebase), each message is adding an additional 70k tokens to the input metric. Which confuses me because my max model length is 130k tokens, and I've exceeded that several times over.