An open-source Agent development toolkit that integrates the powerful capabilities of Volcengine.
- JDK
17or above
<dependency>
<groupId>com.volcengine.veadk</groupId>
<artifactId>veadk-java</artifactId>
<version>0.0.1</version>
</dependency>public class QuickstartAgentExample {
public static void main(String[] args) {
// Use an Ark model (replace with a model name available in your Ark Console)
BaseAgent agent = LlmAgent.builder()
.name("quickstart-agent")
.instruction("You are a helpful assistant.")
.model(new ArkLlm("doubao-seed-1-8-preview-251115"))
.build();
Runner runner = new Runner(agent);
Session session = runner.sessionService()
.createSession(runner.appName(), "userId", null, "sessionId")
.blockingGet();
// Build a simple conversation
Content userMsg = Content.fromParts(Part.fromText("hello!"));
RunConfig runConfig = RunConfig.builder().setStreamingMode(RunConfig.StreamingMode.NONE).build();
Flowable<Event> events = runner.runAsync(session.userId(), session.id(), userMsg, runConfig);
// Print the final reply
events.blockingForEach(e -> {
if (e.finalResponse()) System.out.println(e.stringifyContent());
});
}
}The example project requires the following environment variables before running (an explicit error is thrown if missing):
MODEL_AGENT_API_KEY: API Key for Volcengine Ark service (used byArkLlm)
Example setup (macOS / Linux):
export MODEL_AGENT_API_KEY="<your-ark-api-key>"In the repository root, run: ./mvnw clean -DskipTests package
After building, the compiled artifacts needed by the examples will be generated in example/target.
Entry class: com.volcengine.veadk.example.AgentCliRunner.
Run it (without modifying the POM, directly via Maven Exec plugin coordinates):
./mvnw -pl example -q compile exec:java -Dexec.mainClass=com.volcengine.veadk.example.AgentCliRunnerInteraction notes:
- After startup, follow the prompt to input messages and interact with
ArkAgent. - Type
quitto exit.
Start command:
./mvnw -pl example -q compile exec:java \
-Dexec.mainClass="com.google.adk.web.AdkWebServer" \
-Dexec.args="--adk.agents.source-dir=example/target --server.port=8000" - Access URL:
http://localhost:8000
- Import the Maven multi-module project using IntelliJ IDEA or Eclipse.
- Directly run the
mainmethod ofAgentCliRunnerorAdkWeb. - Ensure the required environment variables are injected in your IDE run configuration (or start the IDE from a shell that has them set).
- If you need
web search,Viking Memory, orViking Knowledgebase, configure these environment variables:VOLCENGINE_ACCESS_KEY: Volcengine AccessKeyVOLCENGINE_SECRET_KEY: Volcengine SecretKey
- If you need TLS Trace, besides AK/SK, also configure the TLS topic:
OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME: ID of the TLS service trace log topic
- Python version and documentation: veadk-python.
- Error on startup
Missing required configuration: <ENV_NAME>: indicates a required environment variable is not set; please complete it according to the prompt. - Unable to access memory/knowledgebase/search services: check AK/SK and network connectivity.
- Port occupied: if port
8000is occupied, adjust via--server.portor in the startup parameters ofAdkWeb.main.
This project uses the Apache License 2.0; see the LICENSE file for details.