# vLLM tool calling for agents: flags, parsers and errors

vLLM tool calling needs two server flags, --enable-auto-tool-choice and a --tool-call-parser that matches the model; without them a request with tool_choice auto fails with a 400 error, and with the wrong parser the tool call arrives as plain text.

Updated: 2026-12-03

An agent such as OpenHands or Paperclip works only when the model server returns structured `tool_calls`. This page lists the exact vLLM error strings, the parser for each model family, the settings our agent Launchables use, and one request that proves tool calling works. Error strings are quoted from the vLLM v0.27.1 source, read 2026-12-03.

## What does "auto" tool choice requires --enable-auto-tool-choice and --tool-call-parser to be set mean?

It means the request asked the model to choose a tool, but the server was started without a tool parser. vLLM rejects the request before generation and returns HTTP 400 with error type `BadRequestError`.

| Request | Exact vLLM v0.27.1 error text | Fix |
|---|---|---|
| `tools` sent, `tool_choice` "auto" or not set | `"auto" tool choice requires --enable-auto-tool-choice and --tool-call-parser to be set` | Restart `vllm serve` with both flags |
| `tool_choice` "required" | `tool_choice="required" requires --tool-call-parser to be set` | Add `--tool-call-parser` |
| `tool_choice` naming one function | `tool_choice=function "NAME" requires --tool-call-parser to be set` | Add `--tool-call-parser` |

- A request that sets `tool_choice` without a `tools` array fails with a different message: When using `tool_choice`, `tools` must be set.
- The three strings in the table come from `vllm/renderers/online_renderer.py` at tag v0.27.1, not from the older `serving_chat.py` path.
- When a request carries `tools` and no `tool_choice`, vLLM sets `tool_choice` to "auto", so a plain agent request hits the first error.
- vLLM skips this check for models with a Mistral tokenizer and for gpt-oss models, which use their own tool format.
- The error is a server setting, not a client bug: changing the agent's settings does not clear it.

## Which flags turn on vLLM tool calling?

The vLLM v0.27.1 tool calling page names one mandatory flag and three supporting ones.

| Flag | Required | What the vLLM docs say it does |
|---|---|---|
| `--enable-auto-tool-choice` | yes, for "auto" | Lets the model generate its own tool calls when it deems it appropriate |
| `--tool-call-parser NAME` | yes | Selects the parser that turns the model's output into OpenAI-style `tool_calls` |
| `--chat-template PATH` | optional | A template that handles `tool` messages and earlier tool calls; Hermes, Mistral and Llama models ship one |
| `--tool-parser-plugin PATH` | optional | Registers your own parser, then name it in `--tool-call-parser` |

The docs add two limits worth knowing for agents. With "auto", vLLM extracts tool calls from raw text unless at least one tool sets `strict: true`, "so arguments may occasionally be malformed". With "required" or a named function, vLLM uses structured outputs: "You are guaranteed a validly-parsable function call - not a high-quality one."

## Which --tool-call-parser matches my model?

Use the parser the model card or the vLLM docs name for that family. With a parser for the wrong family, the tool call can show up as text.

| Model family | `--tool-call-parser` | Also needed | Source, read 2026-12-03 |
|---|---|---|---|
| NVIDIA Nemotron 3.5 Lightning 30B-A3B | `qwen3_coder` | `--reasoning-parser nemotron_v3` | NVIDIA model card, vLLM v0.27.1 |
| NVIDIA Nemotron 3 Nano 30B-A3B FP8 | `qwen3_coder` | `--reasoning-parser nano_v3` with the card's parser plugin file | NVIDIA model card, vLLM 0.12.0 or later |
| Llama 3.1 and 3.3 | `llama3_json` | the Llama 3.1 JSON chat template | vLLM docs v0.27.1 |
| Llama 4 | `llama4_pythonic` | the Llama 4 pythonic chat template | vLLM docs v0.27.1 |
| Qwen2.5 and Hermes models | `hermes` | none | vLLM docs v0.27.1 |
| Qwen3-Coder | `qwen3_xml` | none | vLLM docs v0.27.1 |
| Mistral | `mistral` | none | vLLM docs v0.27.1 |
| gpt-oss | `openai` | none | vLLM docs v0.27.1 |
| DeepSeek-V3 / V3.1 | `deepseek_v3` / `deepseek_v31` | none | vLLM docs v0.27.1 |
| Kimi-K2 | `kimi_k2` | none | vLLM docs v0.27.1 |

The vLLM v0.27.1 parser list has no Nemotron heading; NVIDIA's model cards name `qwen3_coder` for both Nemotron models above. The same docs page lists `qwen3_xml` under Qwen3-Coder models. Our Nemotron Launchables use `qwen3_coder`, as the model card says, and their tests returned tool calls.

## How do our agent Launchables configure tool calling?

Each Launchable sets the flags in its Compose file, so the model server starts with tool calling on. Read from the Compose files on 2026-12-03:

| Launchable | Server and version | Served model name | Tool-calling flags | Test on NVIDIA Brev, one run |
|---|---|---|---|---|
| [OpenHands Coding Agent on Nemotron](https://www.9owls.com/launchables/openhands-nemotron/) | vLLM `v0.27.1` image | `coder` | `--enable-auto-tool-choice --tool-call-parser qwen3_coder`, plus `--reasoning-parser nemotron_v3` for Nemotron 3.5 Lightning | 2026-11-15: `finish_reason` was `tool_calls`; `add` called with `{"a": 2, "b": 3}` |
| [Paperclip Multi-Agent Team on Nemotron](https://www.9owls.com/launchables/paperclip-nemotron/) | vLLM `v0.27.1` image | `agent-model` | `--enable-auto-tool-choice` always; `qwen3_coder` and `nemotron_v3` for Nemotron models, `hermes` for any other model | 2026-11-15: `tool_calls` with `get_weather` and `{"city": "Paris"}` |
| [Hermes Agent on Nemotron 3.5 Bolt](https://www.9owls.com/launchables/hermes-agent-nemotron-bolt/) | llama.cpp `server-cuda-b12464` | `nemotron-bolt` | not vLLM: llama.cpp runs with `--jinja` | 2026-11-19: tool-call check passed |

- Both vLLM stacks set `--max-num-seqs 16` and a default `--max-model-len` of 65536.
- Each test checked one tool call on the default model, not a full agent task.
- Both vLLM tests ran on one NVIDIA L40S 48GB (AWS `g6e.xlarge`).

## How do I test that vLLM returns a real tool call?

Send one request with a single tool and read two fields of the answer. This is the shape of the check our Launchable tests use.

1. Start the server with both flags, for example `vllm serve MODEL --served-model-name coder --enable-auto-tool-choice --tool-call-parser qwen3_coder`.
2. POST to the server's `/v1/chat/completions` on port `8000` with `"model": "coder"`, a user message such as "What is 2 plus 3? Use the add tool.", and a `tools` array holding one function `add` with integer parameters `a` and `b`.
3. Check that `choices[0].finish_reason` is `tool_calls`.
4. Check that `choices[0].message.tool_calls[0].function.name` is `add` and its `arguments` string parses as JSON.
5. If `finish_reason` is `stop` and the `content` holds JSON or tags, the parser does not match the model: change `--tool-call-parser`.

The Nemotron 3.5 Lightning model card adds one note for coding agents: pass the chat template option `force_nonempty_content` set to `True` through `chat_template_kwargs` in the request's `extra_body`.

## Why does the tool call appear as text instead of tool_calls?

The server answered, but no parser turned the model's tool-call text into `tool_calls`. NVIDIA's NemoClaw troubleshooting page describes this symptom: a JSON object such as a tool name and arguments appears in the chat, and no tool runs.

| What you see | Likely cause | What to check |
|---|---|---|
| HTTP 400 with the "auto" tool choice error | Flags missing | Both flags on `vllm serve` |
| JSON or tool tags inside `content`, `finish_reason` is `stop` | Parser does not match the model | The model card's parser name |
| The model answers in text and never calls a tool | The model may not be trained for tool calls | The model card's tool-calling section |
| The agent stops mid-task or loses earlier steps | Context window too small for the agent's prompt and tools | `--max-model-len` against the agent's minimum |

NVIDIA's page says agent loops with several tools, long instructions or multi-turn dispatch need a server that returns structured tool calls consistently, and names vLLM for that case. For OpenHands, its local-model docs ask for a context of at least 22000 tokens, and 32768 is recommended.

## How do I connect OpenHands to vLLM tool calling?

Set three values in OpenHands under Settings, LLM, Advanced. The OpenHands local-model docs, read 2026-12-03, give this pattern:

| OpenHands setting | Value |
|---|---|
| Custom Model | `openai/` plus the served model name, for example `openai/coder` |
| Base URL | the vLLM address ending in `/v1`, for example `http://vllm:8000/v1` inside our Compose network |
| API Key | the key given to `vllm serve --api-key`; our OpenHands Launchable starts vLLM without `--api-key` |

The full walkthrough is in [how to run OpenHands with a local Nemotron model](https://www.9owls.com/guides/run-openhands-with-a-local-nemotron-model/). Model and harness choices for Nemotron are compared in [Nemotron coding agent: models, harnesses and tool calling](https://www.9owls.com/guides/nemotron-coding-agents/).

## What else do people ask about vLLM tool calling?

### Does vLLM support tool calling?

Yes. vLLM v0.27.1 supports named function calling and the `auto`, `required` and `none` values of `tool_choice` in its OpenAI-compatible chat API. Only `auto` needs `--enable-auto-tool-choice`; all three that call tools need a parser.

### What is the difference between tool_choice auto and required?

With `auto` the model decides whether to call a tool. With `required` vLLM uses structured outputs, so the model returns one or more tool calls from the `tools` list.

### Which tool call parser does Nemotron use in vLLM?

NVIDIA's model cards for Nemotron 3.5 Lightning and Nemotron 3 Nano name `qwen3_coder`. Lightning adds `--reasoning-parser nemotron_v3`; Nano adds `nano_v3` through a plugin file from its model card.

### Does tool_choice none still send the tools to the model?

Yes, by default. The vLLM docs say tool definitions are included in the prompt regardless of `tool_choice`; start the server with `--exclude-tools-when-tool-choice-none` to leave them out.

### Can I use a local model for tool calling with an agent?

Yes, if the model supports tool calls and the server returns structured `tool_calls`. Our OpenHands and Paperclip Launchables each returned a tool call from a local Nemotron model on one GPU in 2026-11-15 tests.

## Sources: where do these facts come from?

- [vLLM tool calling documentation, v0.27.1](https://docs.vllm.ai/en/v0.27.1/features/tool_calling/), read 2026-12-03
- [vLLM source, vllm/renderers/online_renderer.py at v0.27.1](https://github.com/vllm-project/vllm/blob/v0.27.1/vllm/renderers/online_renderer.py), read 2026-12-03
- [vLLM source, chat completion protocol at v0.27.1](https://github.com/vllm-project/vllm/blob/v0.27.1/vllm/entrypoints/openai/chat_completion/protocol.py), read 2026-12-03
- [NVIDIA Nemotron 3.5 Lightning 30B-A3B NVFP4 model card](https://huggingface.co/nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-NVFP4), read 2026-12-03
- [NVIDIA Nemotron 3 Nano 30B-A3B FP8 model card](https://huggingface.co/nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8), read 2026-12-03
- [NVIDIA NemoClaw troubleshooting, tool calls appear as assistant text](https://docs.nvidia.com/nemoclaw/latest/user-guide/openclaw/inference/tool-calling-reliability), read 2026-12-03
- [OpenHands local LLMs documentation](https://docs.openhands.dev/openhands/usage/llms/local-llms), read 2026-12-03
- Compose files of our OpenHands, Paperclip and Hermes Agent Launchables, read 2026-12-03
- 9owls fresh-deploy test records: OpenHands and Paperclip 2026-11-15, Hermes Agent 2026-11-19, one run each

## How was this page made?

9owls published this page. Error strings were read from the vLLM v0.27.1 source and docs; parser names from the vLLM docs and NVIDIA model cards; Launchable settings from their Compose files; and the tool-call results from our own fresh-deploy tests, one run each, on the dates shown. We did not benchmark tool-call accuracy for this page. No other site's text was reused. Found an error? Tell us on the [company page](https://www.9owls.com/company/#contact).

## Related pages

- [Nemotron coding agent: models, harnesses and tool calling](https://www.9owls.com/guides/nemotron-coding-agents/)
- [Serve an OpenAI-compatible API with vLLM](https://www.9owls.com/guides/serve-an-openai-compatible-api-with-vllm/)
- [How to run OpenHands with a local Nemotron model](https://www.9owls.com/guides/run-openhands-with-a-local-nemotron-model/)
- [OpenHands Coding Agent on Nemotron](https://www.9owls.com/launchables/openhands-nemotron/)
- [Paperclip Multi-Agent Team on Nemotron](https://www.9owls.com/launchables/paperclip-nemotron/)
- [Hermes Agent on Nemotron 3.5 Bolt](https://www.9owls.com/launchables/hermes-agent-nemotron-bolt/)

[All guides](https://www.9owls.com/guides/)
