-
Notifications
You must be signed in to change notification settings - Fork 342
Phase 1: ADK Onboarding journey revision #739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,23 @@ | ||
# Get Started | ||
# Get started | ||
|
||
Agent Development Kit (ADK) is designed to empower developers | ||
to build, manage, evaluate and deploy AI-powered agents. It provides a robust | ||
and flexible environment for creating both conversational and non-conversational | ||
agents, capable of handling complex tasks and workflows. | ||
Agent Development Kit (ADK) is designed to empower developers to quickly build, | ||
manage, evaluate and deploy AI-powered agents. These quick start guides get you | ||
set up and running a simple agent in less than 20 minutes. | ||
|
||
<div class="grid cards" markdown> | ||
|
||
- :material-console-line: **Installation** | ||
- :fontawesome-brands-python:{ .lg .middle } **Python Quickstart** | ||
|
||
--- | ||
Create your first Python ADK agent in minutes. | ||
|
||
Install `google-adk` for Python or Java and get up and running in minutes. | ||
[:octicons-arrow-right-24: Start with Python](/adk-docs/get-started/python) <br> | ||
|
||
[:octicons-arrow-right-24: More information](installation.md) | ||
|
||
- :material-console-line: **Quickstart** | ||
|
||
--- | ||
|
||
Create your first ADK agent with tools in minutes. | ||
|
||
[:octicons-arrow-right-24: More information](quickstart.md) | ||
|
||
- :material-console-line: **Quickstart (streaming)** | ||
|
||
--- | ||
|
||
Create your first streaming ADK agent. | ||
|
||
[:octicons-arrow-right-24: More information](streaming/quickstart-streaming.md) | ||
|
||
- :material-console-line: **Tutorial** | ||
- :fontawesome-brands-java:{ .lg .middle } **Java Quickstart** | ||
|
||
--- | ||
Create your first Java ADK agent in minutes. | ||
|
||
Create your first ADK multi-agent. | ||
|
||
[:octicons-arrow-right-24: More information](../tutorials/index.md) | ||
|
||
- :material-rocket-launch-outline: **Discover sample agents** | ||
|
||
--- | ||
|
||
Discover sample agents for retail, travel, customer service, and more! | ||
|
||
[:octicons-arrow-right-24: Discover adk-samples](https://github.com/google/adk-samples){:target="_blank"} | ||
|
||
- :material-graph: **About** | ||
|
||
--- | ||
|
||
Learn about the key components of building and deploying ADK agents. | ||
|
||
[:octicons-arrow-right-24: More information](about.md) | ||
[:octicons-arrow-right-24: Start with Java](/adk-docs/get-started/java.md) <br> | ||
joefernandez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
</div> |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,131 @@ | ||||||
# Java Quickstart for ADK | ||||||
|
||||||
This guide shows you how to get up and running with the Agent Development Kit | ||||||
joefernandez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
for Java. Before you start, make sure you have the following installed: | ||||||
|
||||||
* Java 17 or later | ||||||
* Maven 3.9 or later | ||||||
|
||||||
## Installation | ||||||
|
||||||
Add the following dependency to your `pom.xml` file: | ||||||
|
||||||
|
||||||
```xml | ||||||
<dependencies> | ||||||
<dependency> | ||||||
<groupId>com.google.adk</groupId> | ||||||
<artifactId>adk-core</artifactId> | ||||||
<version>0.0.1-SNAPSHOT</version> | ||||||
</dependency> | ||||||
</dependencies> | ||||||
``` | ||||||
|
||||||
## Set up your API key | ||||||
|
||||||
This starter project uses the Gemini API, which requires an API key. If you | ||||||
don't already have Gemini API key, create a key in Google AI Studio on the | ||||||
[API Keys](https://aistudio.google.com/app/apikey) page. | ||||||
|
||||||
In a terminal window, write your API key into an `.env` file as an environment variable: | ||||||
|
||||||
=== "Windows" | ||||||
|
||||||
```shell | ||||||
echo 'GOOGLE_API_KEY="YOUR_API_KEY"' > .env | ||||||
``` | ||||||
|
||||||
=== "MacOS / Linux" | ||||||
|
||||||
```shell | ||||||
echo 'export GOOGLE_API_KEY="YOUR_API_KEY"' > .env | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
These are read in as key-value pairs, so no need to export to the current environment. |
||||||
``` | ||||||
|
||||||
## Create an agent project | ||||||
|
||||||
Run the `adk create` command to start a new agent project. | ||||||
|
||||||
```shell | ||||||
adk create my_agent --language java | ||||||
joefernandez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
``` | ||||||
|
||||||
|
||||||
### Explore the agent project | ||||||
|
||||||
The created agent project has the following structure, with the `MyAgent.java` | ||||||
file containing the main control code for the agent. | ||||||
|
||||||
```shell | ||||||
my_agent/ | ||||||
src/main/java/com/example/MyAgent.java # main agent code. | ||||||
pom.xml # project configuration. | ||||||
.env # API keys or project IDs | ||||||
``` | ||||||
|
||||||
The `MyAgent.java` file contains a `main` method which is the entry point for | ||||||
the agent. You can also define tools for the agent to use. The following | ||||||
example includes an additional `getCurrentTime` tool for use by the agent: | ||||||
|
||||||
```java | ||||||
import com.google.adk.agents.Agent; | ||||||
import com.google.adk.tools.FunctionTool; | ||||||
|
||||||
import java.util.Map; | ||||||
|
||||||
public class MyAgent { | ||||||
|
||||||
public static void main(String[] args) { | ||||||
var timeTool = new FunctionTool( | ||||||
"get_current_time", | ||||||
"Returns the current time in a specified city.", | ||||||
MyAgent.class, | ||||||
"getCurrentTime" | ||||||
); | ||||||
|
||||||
var agent = Agent.builder() | ||||||
.setName("time_teller_agent") | ||||||
.setModel("gemini-1.5-flash") | ||||||
.setInstruction("You are a helpful assistant that tells the current time in cities. Use the 'get_current_time' tool for this purpose.") | ||||||
.setDescription("Tells the current time in a specified city.") | ||||||
.setTools(java.util.List.of(timeTool)) | ||||||
.build(); | ||||||
|
||||||
// TODO: Run the agent | ||||||
} | ||||||
|
||||||
public static Map<String, Object> getCurrentTime(String city) { | ||||||
if (city.equalsIgnoreCase("new york")) { | ||||||
return Map.of("status", "success", "time", "10:30 AM EST"); | ||||||
} | ||||||
return Map.of("status", "error", "message", "Time for " + city + " not available."); | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
## Run your agent | ||||||
|
||||||
Run your agent using the `adk run` command-line tool. | ||||||
|
||||||
```shell | ||||||
adk run my_agent | ||||||
``` | ||||||
|
||||||
 | ||||||
|
||||||
### Run agent with web interface | ||||||
|
||||||
The ADK framework provides web interface you can use to test and interact with | ||||||
your agent. You can start the web interface using the following terminal | ||||||
|
||||||
```shell | ||||||
adk web my_agent | ||||||
``` | ||||||
This command starts a web server with a chat interface for your agent: | ||||||
|
||||||
 | ||||||
joefernandez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
||||||
## Next: build your agent | ||||||
joefernandez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
||||||
Now that you have ADK installed and your first agent running, try building | ||||||
your own agent with our intermediate build guides: | ||||||
|
||||||
* [Build your agent](/adk-docs/tutorials/) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
# Python Quickstart for ADK | ||
|
||
This guide shows you how to get up and running with the Agent Development Kit | ||
joefernandez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
(ADK) for Python. Before you start, make sure you have the following installed: | ||
|
||
* Python 3.9 or later | ||
* `pip` for installing packages | ||
|
||
## Installation | ||
|
||
Install ADK by running the following command: | ||
|
||
```shell | ||
pip install google-adk | ||
``` | ||
|
||
??? tip "Recommended: create and activate a Python virtual environment" | ||
|
||
Create a Python virtual environment: | ||
|
||
```shell | ||
python -m venv .venv | ||
``` | ||
|
||
Activate the Python virtual environment: | ||
|
||
=== "Windows CMD" | ||
|
||
```shell | ||
.venv\Scripts\activate.bat | ||
``` | ||
|
||
=== "Windows Powershell" | ||
|
||
```shell | ||
.venv\Scripts\Activate.ps1 | ||
``` | ||
joefernandez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
=== "MacOS / Linux" | ||
|
||
```shell | ||
source .venv/bin/activate | ||
``` | ||
|
||
## Create an agent project | ||
|
||
Run the `adk create` command to start a new agent project. | ||
|
||
```shell | ||
adk create my_agent | ||
``` | ||
|
||
??? tip "Note: API key required" | ||
The created project uses Gemini, which requires an API key. Create a key in | ||
Google AI Studio on the [API Keys](https://aistudio.google.com/app/apikey) page. | ||
You can also use a Google Cloud project ID with access to the Vertex AI. | ||
joefernandez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
joefernandez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
### Explore the agent project | ||
|
||
The created agent project has the following structure, with the `agent.py` | ||
file containing the main control code for the agent. | ||
|
||
```shell | ||
my_agent/ | ||
agent.py # main agent code. | ||
joefernandez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
.env # API keys or project IDs | ||
__init__.py | ||
``` | ||
|
||
The `agent.py` file contains a `root_agent` definition which is the only | ||
required element of an ADK agent. You can also define tools for the agent to | ||
use. The following example includes an additional `get_current_time` tool for | ||
use by the agent: | ||
joefernandez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
```python | ||
from google.adk.agents.llm_agent import Agent | ||
|
||
# Mock tool implementation | ||
def get_current_time(city: str) -> dict: | ||
"""Returns the current time in a specified city.""" | ||
if city.lower() == "new york": | ||
return {"status": "success", "time": "10:30 AM EST"} | ||
return {"status": "error", "message": f"Time for {city} not available."} | ||
|
||
root_agent = Agent( | ||
model='gemini-2.5-flash', | ||
name='root_agent', | ||
description="Tells the current time in a specified city.", | ||
instruction="You are a helpful assistant that tells the current time in cities. Use the 'get_current_time' tool for this purpose.", | ||
tools=[get_current_time] | ||
joefernandez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
) | ||
``` | ||
|
||
## Run your agent | ||
|
||
Run your agent using the `adk run` command-line tool. | ||
|
||
```shell | ||
adk run my_agent | ||
``` | ||
|
||
 | ||
joefernandez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
### Run agent with web interface | ||
|
||
The ADK framework provides web interface you can use to test and interact with | ||
your agent. You can start the web interface using the following terminal | ||
joefernandez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
```shell | ||
adk web my_agent | ||
``` | ||
This command starts a web server with a chat interface for your agent: | ||
joefernandez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
 | ||
|
||
## Next: build your agent | ||
joefernandez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Now that you have ADK installed and your first agent running, try building | ||
your own agent with our intermediate build guides: | ||
|
||
* [Build your agent](/adk-docs/tutorials/) |
Uh oh!
There was an error while loading. Please reload this page.