Use the shared helper in managed ADK or LangGraph agents:
agent.py
your-model and https://models.example.invalid/v1 placeholders in config.yaml before live model calls. Select a tool-capable model for agents that use Agent Tools. Compilation and offline tests do not contact this endpoint.
OllamaModel has been removed. Replace its import and from_environment() call with LiteLLMModel.from_openai_environment(). Rename OLLAMA_MODEL, OLLAMA_BASE_URL, and any OLLAMA_API_KEY configuration to the OPENAI_ names above. Set the compatible API URL, not the native API root: for a local Ollama server, use http://localhost:11434/v1. Review explicit constructor options against your endpoint’s compatible API; native chat=False is not a compatible chat option. Existing agents require this explicit migration; Harnest does not guess a new endpoint or credential mapping.Local agent and evals
spec.environment, or export them when they are not configured there. spec.environment overrides matching values from the parent process. Use the same credential pattern in CI through its secret store. Harnest does not load .env files. It also excludes .env and .env.* files from the authored source tree.
For a protected endpoint, export OPENAI_API_KEY before the command or inject it through the deployment engine. If omitted, Harnest sends the non-secret not-required SDK placeholder; this does not grant access to a protected server.
For a protected deployment endpoint, map the optional credential variable to an opaque secret reference:
config.yaml
secretRef and injects its value as OPENAI_API_KEY. Local test, run, and serve commands do not resolve spec.secrets; export the variable in their process environment even when the deployment mapping exists. The endpoint must be reachable from the deployed agent; localhost refers to that agent’s own host or container.
Use explicit model configuration
You can also configure the compatible protocol directly:openai/ prefix without changing namespaced IDs: team/your-model becomes openai/team/your-model. It captures the endpoint and credentials for both framework adapters. Explicit api_base and api_key arguments override environment values. Other native providers remain available through LiteLLMModel("provider/model", ...); unlike the environment helper, that lower-level constructor uses the selected provider’s own configuration rules.
Reuse an agent’s model client
When yourLiteLLMModel uses a lifecycle-owned client or explicit transport settings, compatible eval judges and text simulators reuse that transport automatically. Supported settings include custom clients (including ADK llm_client), API base URLs, provider authentication and TLS options, and request headers. This is not a blanket copy of arbitrary model arguments. Eval calls borrow the existing lifecycle controller, including its initialization and hooks, rather than creating a second owner. No additional CLI flag is required.
Judges and simulators keep their own generation settings. Reusing a transport does not copy the agent’s temperature, sampling, or output options over the authored eval settings.
Choosing a transport does not change the eval model ID. For example, an explicitly configured openai/my-judge-model can use an agent’s custom OpenAI-compatible gateway while still requesting my-judge-model.
Managed ADK and LangGraph agents propagate these bindings through their runtime targets. Advanced ADK targets are traversed through their app, agents, subagents, and model objects to find Harnest-created bindings. An opaque advanced LangGraph graph cannot automatically expose a connector hidden inside a closure or node implementation. Do not assume that an arbitrary native client is discoverable.
The runtime retains ownership of borrowed clients. A playground eval does not close the serving agent’s clients when it finishes; the CLI closes its own model resources after evaluation. Unrelated native-provider models, Vertex evaluation services, and Cloud TTS keep their existing authentication paths.
Eval model overrides and native services
When you omitjudgeModelOptions.judgeModel or the text simulator’s model from evals/test_config.json, Harnest uses the configured OPENAI_MODEL and OPENAI_BASE_URL, with optional OPENAI_API_KEY. Scenario suites use this configuration even when the entire userSimulatorConfig block is absent. An explicitly authored model ID wins. For example, judgeModel: "gemini-2.5-flash" opts into ADK’s native Gemini provider and requires its own credentials. Explicit model IDs do not require unused compatible-API settings.
Vertex Gen AI evaluation metrics are a separate Google service, not calls to the configured judge model. The ADK evaluation facade uses GOOGLE_API_KEY when set. Otherwise, set GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION and make Application Default Credentials available. The cloud_tts audio simulator also uses Application Default Credentials and treats GOOGLE_CLOUD_PROJECT as its quota project when present.
OPENAI_API_KEY does not authenticate these native Google services. Keep model and metric selection in source or test_config.json; keep every credential in the process environment or deployment secret mapping.