Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 73 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ An open-source Agent development toolkit that integrates the powerful capabiliti
<dependency>
<groupId>com.volcengine.veadk</groupId>
<artifactId>veadk-java</artifactId>
<version>0.0.1</version>
<version>0.0.2</version>
</dependency>
```
```java
Expand Down Expand Up @@ -56,6 +56,78 @@ export MODEL_AGENT_API_KEY="<your-ark-api-key>"

## Run the Project Examples

### Local Knowledge and Long-term Memory

The backend-neutral local implementations do not require cloud credentials:

```java
KnowledgeBase knowledgeBase = new KnowledgeBase("docs");
knowledgeBase.addFromText("VeADK supports deterministic local retrieval.");

LongTermMemory longTermMemory = new LongTermMemory("my_app");
ShortTermMemory shortTermMemory = new ShortTermMemory();
Agent agent = Agent.builder()
.name("memory-agent")
.model(new ArkLlm("doubao-seed-1-8-preview-251115"))
.knowledgebase(knowledgeBase)
.shortTermMemory(shortTermMemory)
.longTermMemory(longTermMemory)
.build();

Runner runner = agent.newRunner();
```

Existing `VikingMemoryService` and `VikingKnowledgebaseService` entry points remain supported.

Ark LLM also accepts an ordered model list for Python-style fallbacks. The first model is tried
first; later models are only used when an attempt fails before any streaming output is emitted.

```java
ArkLlm model = new ArkLlm(List.of("doubao-seed-1-8-251228", "deepseek-r1-250528"));
```

ADK generation config values such as temperature, top-p, max output tokens, stop sequences,
penalties, candidate count, log probabilities and JSON/JSON-schema response formats are forwarded
to Ark requests when set. Text, inline image bytes, image URLs and video URLs from ADK `Part`
values are also mapped into Ark chat content parts. Tool-call history is round-tripped through Ark
assistant `tool_calls` and tool-result messages, including ids and parallel streaming tool calls.

To automatically copy completed sessions into long-term memory, enable `autoSaveSession` when a
long-term memory service is configured. The default policy matches Python's thresholds: first save
immediately, then save after 10 new events or 60 seconds, and flush the previous session when the
active session changes.

Direct construction of `SaveSessionToMemoryCallback()` keeps the original Java behavior: every
invocation starts a background save and returns immediately. Use the policy constructor when the
save must participate in the reactive callback chain.

```java
Agent agent = Agent.builder()
.name("memory-agent")
.model(new ArkLlm("doubao-seed-1-8-preview-251115"))
.longTermMemory(longTermMemory)
.autoSaveSession(true)
.build();
```

For persistent local sessions, add the optional SQLite module:

```xml
<dependency>
<groupId>com.volcengine.veadk</groupId>
<artifactId>veadk-memory-sqlite</artifactId>
<version>0.0.2</version>
</dependency>
```

```java
ShortTermMemory shortTermMemory = new ShortTermMemory(
new SQLiteShortTermMemoryBackend(Path.of("./data/sessions.db")));
```

The core artifact does not transitively require the SQLite JDBC driver. SQLite appends reload the
canonical stored session before writing, so stale loaded views do not replace newer history.

### Build the Project
In the repository root, run: `./mvnw clean -DskipTests package`

Expand Down
9 changes: 9 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ limitations under the License.
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down Expand Up @@ -72,6 +76,10 @@ limitations under the License.
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
</dependency>
</dependencies>

<build>
Expand All @@ -82,6 +90,7 @@ limitations under the License.
<configuration>
<argLine>
@{argLine}
-javaagent:${settings.localRepository}/net/bytebuddy/byte-buddy-agent/${byte-buddy.version}/byte-buddy-agent-${byte-buddy.version}.jar
--add-opens java.base/java.util=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED
</argLine>
Expand Down
Loading