Self-Hosted Low-Latency Inference: vLLM Endpoints for ADK Agents
Deploying vLLM as an OpenAI-compatible endpoint and wiring it into ADK — launch flags for tool calling, performance tuning, scaling, and when vLLM beats Ollama or cloud APIs.
Published on • November 25, 2026
AI Assistant

Ollama gets a model onto your GPU in one command; it isn’t built to be a production inference service. When an ADK agent needs sustained throughput, predictable latency, and an OpenAI-compatible API that many clients can share, the standard answer is vLLM — the high-throughput serving engine from UC Berkeley that pioneered PagedAttention and continuous batching.
The path from “vLLM running” to “ADK agent pointed at vLLM, with tool calls working” has a few real gotchas — chiefly the launch flags that enable tool calling, which silently determines whether your agent can use tools at all. Here’s the full route.
Why vLLM for agents
Three properties matter for agent workloads specifically:
- Continuous batching — agent traffic arrives in bursts (fan-out swarms, background queues), exactly the pattern vLLM’s scheduler optimizes.
- High throughput per GPU — PagedAttention keeps KV cache efficient, so more concurrent streams fit on the same hardware.
- OpenAI-compatible API —
/v1/chat/completionsspeaks the same protocol LiteLLM (and therefore ADK) already understands, so integration is configuration, not code.
Compared with Ollama: Ollama is a developer tool with a server mode; vLLM is the server. Compared with cloud APIs: you trade managed scaling for cost control and data locality — the same trade Ollama posts describe, at production scale.
Launching vLLM
pip install vllm
vllm serve meta-llama/Llama-3.1-8B-Instruct \
--host 0.0.0.0 \
--port 8000 \
--gpu-memory-utilization 0.9 \
--max-model-len 16384 \
--enable-auto-tool-choice \
--tool-call-parser hermes
The two flags at the bottom are the ones that matter most for ADK:
--enable-auto-tool-choice— turns on tool/function-calling support. Without it, the server won’t emit tool calls no matter what your agent declares.--tool-call-parser <name>— tells vLLM how to extract tool calls from the model’s output. Parsers are model-family-specific (hermes,llama3_json,mistral,openai-style, etc.). The wrong parser for your weights = malformed or missing tool calls. Check vLLM’s docs for your model family before assuming.
Other flags worth knowing:
| Flag | Purpose |
|---|---|
--max-model-len | Context ceiling — size it for your longest agent conversation + tool results |
--gpu-memory-utilization | Fraction of VRAM vLLM may claim (leave headroom if sharing the GPU) |
--tensor-parallel-size | Shard across multiple GPUs |
--max-num-seqs | Max concurrent sequences — tune to latency goals |
--dtype / --quantization | Precision and quantization trade-offs |
Pointing ADK at the endpoint
ADK reaches it through the LiteLLM connector with an explicit api_base (the openai/ prefix + custom base URL pattern):
from google.adk.agents import Agent
from google.adk.models.litellm import LiteLlm
vllm_model = LiteLlm(
model="openai/meta-llama/Llama-3.1-8B-Instruct", # openai-compat prefix
api_base="http://vllm-host.internal:8000/v1",
api_key="not-needed", # server ignores it by default
)
agent = Agent(
model=vllm_model,
name="local_reviewer",
instruction=REVIEW_INSTRUCTION,
tools=[fetch_pr, analyze_diff], # requires the tool parser flags
output_schema=Review, # parse defensively
)
Verification order — don’t debug the agent before the endpoint works:
# 1. endpoint alive
curl http://vllm-host.internal:8000/v1/models
# 2. plain generation
curl .../v1/chat/completions -d '{"model":"...","messages":[{"role":"user","content":"hi"}]}'
# 3. tool calling — the step most people skip
curl .../v1/chat/completions -d '{"model":"...","tools":[{"type":"function","function":{"name":"get_weather","parameters":{"type":"object","properties":{"city":{"type":"string"}}}}}],"messages":[{"role":"user","content":"weather in Paris?"}]}'
Step 3 returning a tool_calls block (not prose describing a tool call) means your parser flags are right.
Tuning for latency
Agent latency is dominated by two vLLM behaviors:
- TTFT (time to first token) grows with prompt length and queue depth. For interactive agents, cap
--max-num-seqsso bursts don’t queue behind each other, and keep prompts lean (trim history and tool payloads). - Continuous batching pays off under load — that’s the swarm/background-work case. A fan-out of 10 workers is more efficient per request on vLLM than 10 sequential calls.
Practical rules:
- Warm the model at deploy time (a health-check generation) so the first user request doesn’t pay load time.
- Set
max_tokensper request type — unbounded generation blocks the sequence slot and hurts everyone’s queue time. - Separate pools by workload class if interactive and background traffic fight — one endpoint each, routed by dynamic routing.
- Monitor
num_requests_running,num_requests_waiting, TTFT, and tokens/sec — vLLM exposes Prometheus metrics natively.
Scaling beyond one box
- Horizontal: multiple vLLM replicas behind a load balancer — stateless from the client’s view, so ADK just gets a pool URL.
- Vertical:
--tensor-parallel-sizeacross GPUs on one host for bigger models. - Autoscale: scale on queue depth or TTFT rather than CPU; inference load doesn’t correlate with CPU utilization.
- Hybrid failover: keep a cloud model in the fallback chain — an endpoint that’s down should route to LiteLLM third-party providers rather than fail the user.
When to choose what
| Option | Choose it when |
|---|---|
| Ollama | Single developer, occasional local runs, simplest setup |
| vLLM | Production throughput, multi-client endpoints, tuned tool calling |
| Cloud API | Peak quality, no ops, elastic scale — or as the failover tier |
A common production shape: vLLM serving a mid-size model for high-volume routine work, cloud models for depth, Ollama on laptops for dev — all behind one routing policy.
Checklist
-
--enable-auto-tool-choice+ correct--tool-call-parserfor your weights — verified with a live tool-call request -
--max-model-lensized for conversations + tool results, not just chat -
api_baseexplicit in the ADK model config -
max_tokensbounded per request class - Prometheus metrics scraped; alerts on waiting-requests and TTFT
- Failover to a cloud provider tested
- Model tag pinned; upgrades gated by your eval suite
Where to go next
vLLM is the serving half; the request half is covered in dynamic model routing and LiteLLM third-party connectors. To bound what each request can consume on your hardware, continue with max output tokens and truncation strategies.