mirror of
https://github.com/google/adk-docs.git
synced 2026-09-14 16:16:59 +08:00
eb989519a7
* Upgrade Kotlin docs to adk-kotlin 0.9.0 and move off AdkWebServer adk-kotlin 0.9.0 split the web server into AdkApiServer, which serves the agent runtime contract headlessly, and AdkDevServer, which adds the development UI. AdkWebServer is deprecated in that release and goes away at 1.0, so WebMain.kt as written here stops compiling the day 1.0 ships. The quickstart snippet now builds an AdkDevServer from an AdkServerConfig. That drops three imports: AdkServerConfig.inMemory() supplies the agent loader and the in-memory session and artifact services the old constructor took one by one. Two behaviour notes come with the split. AdkWebServer pinned host to 0.0.0.0; the new classes bind loopback, which is a visible change for anyone reaching the server from a container or a remote box, so the page now says so and names the host parameter in prose. It prints no worked example on purpose: the only value such a snippet could carry is either 127.0.0.1, which overrides the default with itself, or 0.0.0.0, which is a copyable way to publish an unauthenticated server on every interface, and AdkDevServer construction is already shown in full earlier on the page. And AdkApiServer is the headless half of the same config, so it gets a short section rather than a bare mention - the bundled Kotlin API reference is still generated at 0.5.0 and documents none of these classes, so a link there would not have helped. The "not meant for production" warning now sits directly after the screenshot, where go.md, java.md and python.md put it. The dependency blocks readers copy from still pinned 0.8.0, and so did the examples project. Verified on Maven Central that 0.9.0 is published for every artifact named across these pages: -core, -processor, -webserver, -litertlm, -a2a and -integrations. Checked the 0.9.0 POMs before bumping: Ktor still resolves to 2.3.13 and a2a-java-sdk-client to 1.0.0.Final, so the explicit pins stay correct and the two comments citing them only needed their version reference moved. The `Kotlin v0.x` support badges are deliberately left alone: they record the release a feature landed in, not the current version. Verified by compiling: every snippet added here was compiled verbatim against the published 0.9.0 artifacts on JDK 17, and the whole examples project still builds at 0.9.0. As a negative control, the old snippet still compiles at 0.9.0 but emits the deprecation warning, which is what makes this a 1.0 break rather than a present-day one. Note the Kotlin snippet check only builds .kt files changed in the PR, so it will not cover a markdown-only change like this. * Apply suggestion from @joefernandez * Apply suggestion from @joefernandez * Removing information bloat from the Get Started see comments for where to locate this information --------- Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com>
4.8 KiB
4.8 KiB
hide
| hide | |
|---|---|
|
Advanced setup
This page provides detailed installation and configuration instructions for ADK across supported languages. For a guided introduction, start with the quickstart for your language.
=== "Python"
**Create & activate virtual environment**
We recommend creating a virtual Python environment using
[venv](https://docs.python.org/3/library/venv.html):
```shell
python3 -m venv .venv
```
Now, you can activate the virtual environment using the appropriate command
for your operating system and environment:
```
# Mac / Linux
source .venv/bin/activate
# Windows CMD:
.venv\Scripts\activate.bat
# Windows PowerShell:
.venv\Scripts\Activate.ps1
```
**Install ADK**
```bash
pip install google-adk
```
(Optional) Verify your installation:
```bash
pip show google-adk
```
=== "TypeScript"
**Install ADK and ADK DevTools**
```bash
npm install @google/adk @google/adk-devtools
```
=== "Go"
**Prerequisites:** Go 1.25 or later is required for ADK Go v2.0.0.
**Create a new Go module**
If you are starting a new project, you can create a new Go module:
```shell
go mod init example.com/my-agent
```
**Install ADK Go v2.0.0**
To add ADK Go v2.0.0 to your project, run the following command:
```shell
go get google.golang.org/adk/v2
```
This will add ADK Go v2.0.0 as a dependency to your `go.mod` file.
(Optional) Verify your installation by checking your `go.mod` file for the
`google.golang.org/adk/v2` entry.
??? tip "Still using ADK Go v1.x?"
If you are not yet ready to upgrade to v2.0.0, you can continue using
the v1.x release line:
```shell
go get google.golang.org/adk@v1
```
See the [ADK 2.0 release page](/2.0/) for upgrade guidance, including
breaking changes and migration steps for ADK Go 1.x projects.
=== "Java"
You can either use maven or gradle to add the `google-adk` and
`google-adk-dev` package.
`google-adk` is the core Java ADK library. Java ADK also comes with a
pluggable example SpringBoot server to run your agents seamlessly. This
optional package is present as part of `google-adk-dev`.
If you are using maven, add the following to your `pom.xml`:
```xml title="pom.xml"
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.agent</groupId>
<artifactId>adk-agents</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- Specify the version of Java you'll be using -->
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- The ADK core dependency -->
<dependency>
<groupId>com.google.adk</groupId>
<artifactId>google-adk</artifactId>
<version>1.6.0</version>
</dependency>
<!-- The ADK dev web UI to debug your agent -->
<dependency>
<groupId>com.google.adk</groupId>
<artifactId>google-adk-dev</artifactId>
<version>1.6.0</version>
</dependency>
</dependencies>
</project>
```
Here's a [complete
pom.xml](https://github.com/google/adk-docs/tree/main/examples/java/cloud-run/pom.xml)
file for reference.
If you are using gradle, add the dependency to your build.gradle:
```title="build.gradle"
dependencies {
implementation 'com.google.adk:google-adk:1.6.0'
implementation 'com.google.adk:google-adk-dev:1.6.0'
}
```
You should also configure Gradle to pass `-parameters` to `javac`.
(Alternatively, use `@Schema(name = "...")`).
=== "Kotlin"
**Use ADK Kotlin on the JVM**
For Kotlin on the JVM, add the ADK core library and the KSP annotation
processor to your `build.gradle.kts`:
```kotlin title="build.gradle.kts"
plugins {
kotlin("jvm") version "2.1.20"
id("com.google.devtools.ksp") version "2.1.20-2.0.1"
}
dependencies {
implementation("com.google.adk:google-adk-kotlin-core:0.9.0")
ksp("com.google.adk:google-adk-kotlin-processor:0.9.0")
}
```
The KSP processor generates code for the `@Tool` annotation used to
register function tools. See the [Kotlin Quickstart](/get-started/kotlin/)
for a complete project setup.