Skip to main content
The main VeADK Java entry point is 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.
After construction, call the agent with 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

If modelProvider(...) 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:
Ark example:
You can also encode the provider in the model name:
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 ADK BaseLlm.
Explicit models are a good fit for shared configuration factories. Do not hard-code API keys in source files or docs examples.

Responses API and structured output

The Ark adapter uses Chat Completions by default. Select ArkLlmConfig.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.
After the callbacks are registered, the Responses ID is stored in ADK Session State under the session and agent name. A later request uses 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

Use modelFallbacks(...) 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.
Fallback does not replay a response that has already started, and it does not retry tool execution. Backup models should support the same input formats, tool-calling behavior, and output constraints as the primary model.

Metadata

VeADK Java records model, tool, component, and search-source metadata during agent construction. Use AgentMetadataExtractor to read a snapshot for runtime registration, debugging, or documentation.
Explicit tools are marked as explicit. Tools injected by knowledge bases, long-term memory, Skills, and similar components are marked as auto.

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.

Troubleshooting

Last modified on October 20, 2026