Repository navigation
adk-local-models: a direct local inference adapter for Google ADK #7807
AubinGil
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone! I've been experimenting with Google ADK agents using locally hosted models, and built adk-local-models, an Apache-2.0 Python adapter implementing ADK's
BaseLlminterface.ADK already supports local OpenAI-compatible servers through its native
google.adk.integrations.openai.OpenAILlmclass, using the OpenAI SDK, as well as through LiteLLM. The native integration is a good default for most users. I wanted a small, explicit adapter using ADK's existinghttpxdependency, with neither LiteLLM nor the OpenAI SDK and with specific response and recording behavior.The adapter maps ADK's text and function-tool requests to
/v1/chat/completionsand maps replies back to ADK responses. It provides:vllm,ollamaandllama_serverprofiles with validation for documented profile knobs.Pass the instance as
LlmAgent(model=llm, ...)to use it with ADK'sRunner. Streamed final responses contain the complete output, so don't append them to accumulated partial text.Evidence and scope: Live tests covered text and function calls, plain and streamed, and Runner round trips on one model per backend: vLLM with
nemotron-3.5-bolt-e4b, Ollama withgemma4:e4b, and llama-server with LFM3-1.7B Q4_K_M on llama.cpp 0.8.0 (b11960), using--jinja --reasoning off. The native comparison exercised both adapters live on vLLM and Ollama; its llama-server comparison was fixture-only. Later llama-server runs validated this adapter live. Failure cases, including truncated streams, were checked with fake-server fixtures. This is compatibility evidence for those configurations, not a benchmark or a guarantee for every model/template.Limitations: Text and function tools only; no images, audio, live bidirectional API, strict output-schema enforcement, reasoning-content replay or reasoning-token usage mapping. JSON mode maps to
json_object. llama-server tools require--jinjaand a suitable template; on the tested build,reasoning_format="none"with JSON mode produces HTTP 400, so the adapter rejects that combination before I/O. It never configures or manages servers.Native
OpenAILlmoffers broader image, strict-schema and reasoning support; those broader paths were reviewed in source, not exercised in the comparison. Its HTTP client can also be configured to capture bytes. This adapter focuses on the particular error, streaming, profile-validation and metadata contracts above. "Lightweight" refers to incremental transport dependencies; ADK's own dependency tree remains. I see it as an optional direct alternative alongside the existing integrations.Try v0.1.1: Python 3.11+; tested with ADK 2.13.0 and google-genai 2.33.0. There is no PyPI release. In a fresh virtual environment, install the tagged source:
python -m pip install "git+https://github.com/AubinGil/adk-local-models.git@v0.1.1"Minimal example, assuming an already configured vLLM server; replace
your-modelwith its served model name. The API root includes/v1:The README has Ollama and llama-server examples and knob prerequisites; the feature comparison links the evidence.
I'd welcome feedback on the response contracts and compatibility reports from others using local models with ADK!
All reactions