com.volcengine.veadk.Agent.builder(). It builds on ADK Java’s LlmAgent and adds VeADK-style model defaults, metadata, tools, skills, memory, knowledge bases, and runtime integrations.
Minimal agent
Agent.builder() sets a default agent name, description, instruction, and model name. For real applications, configure name, instruction, and the model explicitly so behavior does not depend on local defaults.
There are three common model entry points:
modelName("..."): the VeADK semantic model-name entry point.model("..."): the inherited ADK Java model-name entry point.model(BaseLlm): an explicitly configured model object.
new Runner(agent).run(...), connect it to ADK Web, or expose it through AgentKit Runtime. If the model or tools hold network resources, close the agent with agent.close().blockingAwait() when finished.
Model selection
IfmodelProvider(...) is not set, VeADK Java resolves the provider from the model-name prefix. Supported prefixes are ark/, openai/, openai-compatible/, and openai_compatible/. Without a prefix, the builder creates an OpenAI-compatible client.
OpenAI-compatible example:
modelBaseUrl(...) is an alias of modelApiBase(...). It is often clearer for OpenAI-compatible endpoints, while Ark examples usually use modelApiBase(...).
Explicit model object
Create the model yourself when you need protocol-level Ark options, want to reuse a model instance, or need to plug in a custom ADKBaseLlm.
Responses API and structured output
The Ark adapter uses Chat Completions by default. SelectArkLlmConfig.Api.RESPONSES explicitly when you need response continuation, JSON Schema output, or other Responses API behavior. Register both ArkResponsesSession model callbacks to persist continuation state in the ADK session.
previous_response_id only when the history prefix, model, system instruction, tool declarations, and generation config match. If history is compacted, configuration changes, or the remote response expires, the adapter falls back to a full-history request.
Model fallback
UsemodelFallbacks(...) to configure backup model endpoints for the same agent. Each generation starts with the primary model and attempts the next model only if an exception occurs before any model response is emitted.
Metadata
VeADK Java records model, tool, component, and search-source metadata during agent construction. UseAgentMetadataExtractor to read a snapshot for runtime registration, debugging, or documentation.
Environment variables
Explicit
modelApiKey(...), ArkLlmConfig.apiKey(...), or OpenAiCompatibleLlmConfig.apiKey(...) values take highest priority. In production, inject secrets through a secret manager, CI/CD secret, or runtime environment variable.