Use the shared helper in managed ADK or LangGraph agents:
agent.py
OPENAI_MODEL and OPENAI_BASE_URL in the shell that runs Harnest, or replace the example values in config.yaml. For local commands, exported settings take precedence over the two generated example values. Explicit project values take precedence over shell settings. If a configured URL reports a connection error, check that the process running Harnest can reach the model server and that the URL includes its API base path. 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 the process environment. spec.environment takes precedence. Harnest neither loads nor packages .env files; use your CI secret store for credentials.
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 as OPENAI_API_KEY. Local commands require the variable in their process environment. Ensure the deployed agent can reach the endpoint; localhost means its own host or container.
Use explicit model configuration
You can also configure the compatible protocol directly:openai/ prefix: team/your-model becomes openai/team/your-model. Explicit api_base and api_key override environment values. For other providers, use LiteLLMModel("provider/model", ...) with that provider’s configuration.
Reuse an agent’s model client
Compatible eval judges and text simulators reuse yourLiteLLMModel transport, including lifecycle-owned clients, API URLs, credentials, TLS options, and headers. Generation settings remain independent.
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 expose these bindings automatically. Advanced ADK can expose Harnest-created bindings through its agent structure; clients hidden in advanced LangGraph closures are not discoverable.
Borrowed clients retain their existing owner. Playground evaluations leave serving clients open; CLI evaluations close their own resources.
Eval model overrides and native services
Omitted judge and text-simulator model IDs useOPENAI_MODEL, OPENAI_BASE_URL, and optional OPENAI_API_KEY. Explicit IDs override them and use their selected provider’s credentials. For example, judgeModel: "gemini-2.5-flash" selects native Gemini.
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.
API reference
Reference:harnest.agent.