mirror of
https://github.com/google/adk-docs.git
synced 2026-09-14 16:16:59 +08:00
124 lines
3.4 KiB
Markdown
124 lines
3.4 KiB
Markdown
# Installing ADK
|
|
|
|
=== "Python"
|
|
|
|
## Create & activate virtual environment
|
|
|
|
We recommend creating a virtual Python environment using
|
|
[venv](https://docs.python.org/3/library/venv.html):
|
|
|
|
```shell
|
|
python -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
|
|
```
|
|
|
|
=== "Go"
|
|
|
|
## 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
|
|
|
|
To add the ADK to your project, run the following command:
|
|
|
|
```shell
|
|
go get google.golang.org/adk
|
|
```
|
|
|
|
This will add the ADK as a dependency to your `go.mod` file.
|
|
|
|
(Optional) Verify your installation by checking your `go.mod` file for the `google.golang.org/adk` entry.
|
|
|
|
=== "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>0.3.0</version>
|
|
</dependency>
|
|
<!-- The ADK dev web UI to debug your agent -->
|
|
<dependency>
|
|
<groupId>com.google.adk</groupId>
|
|
<artifactId>google-adk-dev</artifactId>
|
|
<version>0.3.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:0.2.0'
|
|
implementation 'com.google.adk:google-adk-dev:0.2.0'
|
|
}
|
|
```
|
|
|
|
You should also configure Gradle to pass `-parameters` to `javac`. (Alternatively, use `@Schema(name = "...")`).
|
|
|
|
|
|
## Next steps
|
|
|
|
* Try creating your first agent with the [**Quickstart**](quickstart.md)
|