构建一个多功能代理(multi-tool agent)¶
本快速入门指南将指导您完成以下步骤: 1. 安装代理开发工具包(Agent Development Kit,简称 ADK); 2. 使用多种工具配置一个基本的代理程序; 3. 在终端或基于浏览器的交互式开发用户界面中,本地运行该代理程序。
这个快速入门指南假设您已经安装了本地的集成开发环境(IDE,如 VS Code、PyCharm、IntelliJ IDEA 等),并且已经配置好了 Python 3.10 或更高版本、Java 17 或更高版本,同时具备使用终端的权限。该方案完全在您的机器上运行应用程序,因此非常适合内部开发使用。
1. 设置开发环境并安装 ADK(Adobe Digital Kit)。¶
创建并激活虚拟环境(推荐):
# Create
python3 -m venv .venv
# Activate (each new terminal)
# macOS/Linux: source .venv/bin/activate
# Windows CMD: .venv\Scripts\activate.bat
# Windows PowerShell: .venv\Scripts\Activate.ps1
安装 ADK:
创建一个新的项目目录,对其进行初始化,并安装所需的依赖项。
mkdir my-adk-agent
cd my-adk-agent
npm init -y
npm install @google/adk @google/adk-devtools
npm install -D typescript
创建一个…… tsconfig.json 创建一个包含以下内容的文件。此配置可确保您的项目能够正确处理现代 Node.js 模块。
创建一个新的 Go 模块¶
如果你正在启动一个新项目,你可以创建一个新的 Go 模块:
安装 ADK¶
要将 ADK 添加到您的项目中,请运行以下命令:
这会将 ADK 添加为你的项目的依赖项。 go.mod file.
要安装 ADK Java 并配置开发环境,请参阅…… Java 快速入门.
要安装 ADK Kotlin 并配置开发环境,请参阅…… Kotlin 快速入门.
2. 创建代理项目(Agent Project)¶
项目结构¶
您需要创建以下项目结构:
创建该文件夹。 multi_tool_agent:
给 Windows 用户的提示:
在接下来的步骤中,当在 Windows 上使用 ADK 时,我们建议使用文件资源管理器(File Explorer)或集成开发环境(IDE)来创建 Python 文件。因为以下命令需要在这些环境中执行。mkdir, echo这些工具通常会生成包含空字节(null bytes)的文件,或者文件的编码格式不正确。
__init__.py¶
现在,创建一个……(请根据具体需求填写“……”的内容)。 __init__.py 文件夹中的文件:
您的 __init__.py 现在应该看起来像这样:
agent.py¶
创建一个…… agent.py 位于同一文件夹中的文件:
将以下代码复制并粘贴到…… agent.py:
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import datetime
from zoneinfo import ZoneInfo
from google.adk.agents import Agent
def get_weather(city: str) -> dict:
"""Retrieves the current weather report for a specified city.
Args:
city (str): The name of the city for which to retrieve the weather report.
Returns:
dict: status and result or error msg.
"""
if city.lower() == "new york":
return {
"status": "success",
"report": (
"The weather in New York is sunny with a temperature of 25 degrees"
" Celsius (77 degrees Fahrenheit)."
),
}
else:
return {
"status": "error",
"error_message": f"Weather information for '{city}' is not available.",
}
def get_current_time(city: str) -> dict:
"""Returns the current time in a specified city.
Args:
city (str): The name of the city for which to retrieve the current time.
Returns:
dict: status and result or error msg.
"""
if city.lower() == "new york":
tz_identifier = "America/New_York"
else:
return {
"status": "error",
"error_message": (
f"Sorry, I don't have timezone information for {city}."
),
}
tz = ZoneInfo(tz_identifier)
now = datetime.datetime.now(tz)
report = (
f'The current time in {city} is {now.strftime("%Y-%m-%d %H:%M:%S %Z%z")}'
)
return {"status": "success", "report": report}
root_agent = Agent(
name="weather_time_agent",
model="gemini-flash-latest",
description=(
"Agent to answer questions about the time and weather in a city."
),
instruction=(
"You are a helpful agent who can answer user questions about the time and weather in a city."
),
tools=[get_weather, get_current_time],
)
.env¶
创建一个…… .env 位于同一文件夹中的文件:
关于此文件的更多说明,请参阅下一节的内容。 设置模型.
你需要在自己的项目中创建以下项目结构: my-adk-agent directory:
agent.ts¶
创建一个…… agent.ts 将文件放入您的项目文件夹中:
将以下代码复制并粘贴到…… agent.ts:
import 'dotenv/config';
import { FunctionTool, LlmAgent } from '@google/adk';
import { z } from 'zod';
const getWeather = new FunctionTool({
name: 'get_weather',
description: 'Retrieves the current weather report for a specified city.',
parameters: z.object({
city: z.string().describe('The name of the city for which to retrieve the weather report.'),
}),
execute: ({ city }) => {
if (city.toLowerCase() === 'new york') {
return {
status: 'success',
report:
'The weather in New York is sunny with a temperature of 25 degrees Celsius (77 degrees Fahrenheit).',
};
} else {
return {
status: 'error',
error_message: `Weather information for '${city}' is not available.`,
};
}
},
});
const getCurrentTime = new FunctionTool({
name: 'get_current_time',
description: 'Returns the current time in a specified city.',
parameters: z.object({
city: z.string().describe("The name of the city for which to retrieve the current time."),
}),
execute: ({ city }) => {
let tz_identifier: string;
if (city.toLowerCase() === 'new york') {
tz_identifier = 'America/New_York';
} else {
return {
status: 'error',
error_message: `Sorry, I don't have timezone information for ${city}.`,
};
}
const now = new Date();
const report = `The current time in ${city} is ${now.toLocaleString('en-US', { timeZone: tz_identifier })}`;
return { status: 'success', report: report };
},
});
export const rootAgent = new LlmAgent({
name: 'weather_time_agent',
model: 'gemini-flash-latest',
description: 'Agent to answer questions about the time and weather in a city.',
instruction: 'You are a helpful agent who can answer user questions about the time and weather in a city.',
tools: [getWeather, getCurrentTime],
});
.env¶
创建一个…… .env 位于同一文件夹中的文件:
关于此文件的更多说明,请参阅下一节的内容。 设置模型.
您需要创建以下项目结构:
agent.go¶
创建一个…… agent.go 将文件放入您的项目文件夹中:
将以下代码复制并粘贴到…… agent.go:
package main
import (
"context"
"log"
"os"
"strings"
"time"
"google.golang.org/genai"
"google.golang.org/adk/v2/agent"
"google.golang.org/adk/v2/agent/llmagent"
"google.golang.org/adk/v2/cmd/launcher"
"google.golang.org/adk/v2/cmd/launcher/full"
"google.golang.org/adk/v2/model/gemini"
"google.golang.org/adk/v2/tool"
"google.golang.org/adk/v2/tool/functiontool"
)
type CityArgs struct {
City string `json:"city"`
}
func main() {
ctx := context.Background()
// 1. Setup the model.
// Note: Authentication is handled via GOOGLE_API_KEY environment variable.
model, err := gemini.NewModel(ctx, "gemini-flash-latest", &genai.ClientConfig{
APIKey: os.Getenv("GOOGLE_API_KEY"),
})
if err != nil {
log.Fatalf("Failed to create model: %v", err)
}
weatherTool, err := functiontool.New[CityArgs, map[string]any](
functiontool.Config{
Name: "get_weather",
Description: "Retrieves the current weather report for a specified city.",
},
func(ctx agent.Context, args CityArgs) (map[string]any, error) {
if strings.EqualFold(args.City, "new york") {
return map[string]any{
"status": "success",
"report": "The weather in New York is sunny with a temperature of 25 degrees Celsius (77 degrees Fahrenheit).",
}, nil
}
return map[string]any{
"status": "error",
"error_message": "Weather information for '" + args.City + "' is not available.",
}, nil
},
)
if err != nil {
log.Fatalf("Failed to create get_weather tool: %v", err)
}
currentTimeTool, err := functiontool.New[CityArgs, map[string]any](
functiontool.Config{
Name: "get_current_time",
Description: "Returns the current time in a specified city.",
},
func(ctx agent.Context, args CityArgs) (map[string]any, error) {
var tzIdentifier string
if strings.EqualFold(args.City, "new york") {
tzIdentifier = "America/New_York"
} else {
return map[string]any{
"status": "error",
"error_message": "Sorry, I don't have timezone information for " + args.City + ".",
}, nil
}
tz, err := time.LoadLocation(tzIdentifier)
if err != nil {
return nil, err
}
now := time.Now().In(tz)
report := "The current time in " + args.City + " is " + now.Format("2006-01-02 15:04:05 MST-0700")
return map[string]any{
"status": "success",
"report": report,
}, nil
},
)
if err != nil {
log.Fatalf("Failed to create get_current_time tool: %v", err)
}
// 2. Define the agent.
a, err := llmagent.New(llmagent.Config{
Name: "weather_time_agent",
Model: model,
Description: "Agent to answer questions about the time and weather in a city.",
Instruction: "You are a helpful agent who can answer user questions about the time and weather in a city.",
Tools: []tool.Tool{
weatherTool,
currentTimeTool,
},
})
if err != nil {
log.Fatalf("Failed to create agent: %v", err)
}
// 3. Configure the launcher and run.
config := &launcher.Config{
AgentLoader: agent.NewSingleLoader(a),
}
l := full.NewLauncher()
if err = l.Execute(ctx, config, os.Args[1:]); err != nil {
log.Fatalf("Run failed: %v\n\n%s", err, l.CommandLineSyntax())
}
}
.env¶
创建一个…… .env 位于同一文件夹中的文件:
Java 项目通常具有以下项目结构:
project_folder/
├── pom.xml (or build.gradle)
├── src/
├── └── main/
│ └── java/
│ └── agents/
│ └── multitool/
└── test/
创建 MultiToolAgent.java¶
创建一个…… MultiToolAgent.java 源文件位于: agents.multitool `package`
`in the` src/main/java/agents/multitool/ directory.
将以下代码复制并粘贴到…… MultiToolAgent.java:
package agents.multitool;
import com.google.adk.agents.BaseAgent;
import com.google.adk.agents.LlmAgent;
import com.google.adk.events.Event;
import com.google.adk.runner.InMemoryRunner;
import com.google.adk.sessions.Session;
import com.google.adk.tools.Annotations.Schema;
import com.google.adk.tools.FunctionTool;
import com.google.genai.types.Content;
import com.google.genai.types.Part;
import io.reactivex.rxjava3.core.Flowable;
import java.nio.charset.StandardCharsets;
import java.text.Normalizer;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Map;
import java.util.Scanner;
public class MultiToolAgent {
private static String USER_ID = "student";
private static String NAME = "multi_tool_agent";
// The run your agent with Dev UI, the ROOT_AGENT should be a global public static final variable.
public static final BaseAgent ROOT_AGENT = initAgent();
public static BaseAgent initAgent() {
return LlmAgent.builder()
.name(NAME)
.model("gemini-flash-latest")
.description("Agent to answer questions about the time and weather in a city.")
.instruction(
"You are a helpful agent who can answer user questions about the time and weather"
+ " in a city.")
.tools(
FunctionTool.create(MultiToolAgent.class, "getCurrentTime"),
FunctionTool.create(MultiToolAgent.class, "getWeather"))
.build();
}
public static Map<String, String> getCurrentTime(
@Schema(name = "city",
description = "The name of the city for which to retrieve the current time")
String city) {
String normalizedCity =
Normalizer.normalize(city, Normalizer.Form.NFD)
.trim()
.toLowerCase()
.replaceAll("(\\p{IsM}+|\\p{IsP}+)", "")
.replaceAll("\\s+", "_");
return ZoneId.getAvailableZoneIds().stream()
.filter(zid -> zid.toLowerCase().endsWith("/" + normalizedCity))
.findFirst()
.map(
zid ->
Map.of(
"status",
"success",
"report",
"The current time in "
+ city
+ " is "
+ ZonedDateTime.now(ZoneId.of(zid))
.format(DateTimeFormatter.ofPattern("HH:mm"))
+ "."))
.orElse(
Map.of(
"status",
"error",
"report",
"Sorry, I don't have timezone information for " + city + "."));
}
public static Map<String, String> getWeather(
@Schema(name = "city",
description = "The name of the city for which to retrieve the weather report")
String city) {
if (city.toLowerCase().equals("new york")) {
return Map.of(
"status",
"success",
"report",
"The weather in New York is sunny with a temperature of 25 degrees Celsius (77 degrees"
+ " Fahrenheit).");
} else {
return Map.of(
"status", "error", "report", "Weather information for " + city + " is not available.");
}
}
public static void main(String[] args) throws Exception {
InMemoryRunner runner = new InMemoryRunner(ROOT_AGENT);
Session session =
runner
.sessionService()
.createSession(NAME, USER_ID)
.blockingGet();
try (Scanner scanner = new Scanner(System.in, StandardCharsets.UTF_8)) {
while (true) {
System.out.print("\nYou > ");
String userInput = scanner.nextLine();
if ("quit".equalsIgnoreCase(userInput)) {
break;
}
Content userMsg = Content.fromParts(Part.fromText(userInput));
Flowable<Event> events = runner.runAsync(USER_ID, session.id(), userMsg);
System.out.print("\nAgent > ");
events.blockingForEach(event -> System.out.println(event.stringifyContent()));
}
}
}
}
Kotlin 项目通常具有以下项目结构:
project_folder/
├── build.gradle.kts
├── src/
├── └── main/
│ └── kotlin/
│ └── agents/
│ └── multitool/
创建 MultiToolAgent.kt¶
创建一个…… MultiToolAgent.kt 源文件位于: src/main/kotlin/agents/multitool/ directory.
将以下代码复制并粘贴到…… MultiToolAgent.kt:
package agents.multitool
import com.google.adk.kt.agents.Instruction
import com.google.adk.kt.agents.LlmAgent
import com.google.adk.kt.annotations.Param
import com.google.adk.kt.annotations.Tool
import com.google.adk.kt.models.Gemini
import com.google.adk.kt.runners.InMemoryRunner
import com.google.adk.kt.sessions.InMemorySessionService
import com.google.adk.kt.sessions.SessionKey
import com.google.adk.kt.types.Content
import com.google.adk.kt.types.Part
import com.google.adk.kt.types.Role
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
import java.text.Normalizer
import java.time.ZoneId
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import java.util.Scanner
class MultiToolService {
@Tool
fun getCurrentTime(
@Param("The name of the city for which to retrieve the current time") city: String,
): Map<String, String> {
val normalizedCity =
Normalizer.normalize(city, Normalizer.Form.NFD)
.trim()
.lowercase()
.replace(Regex("(\\p{IsM}+|\\p{IsP}+)"), "")
.replace(Regex("\\s+"), "_")
val zoneId =
ZoneId.getAvailableZoneIds()
.firstOrNull { it.lowercase().endsWith("/$normalizedCity") }
return if (zoneId != null) {
val time =
ZonedDateTime.now(ZoneId.of(zoneId))
.format(DateTimeFormatter.ofPattern("HH:mm"))
mapOf(
"status" to "success",
"report" to "The current time in $city is $time.",
)
} else {
mapOf(
"status" to "error",
"report" to "Sorry, I don't have timezone information for $city.",
)
}
}
@Tool
fun getWeather(
@Param("The name of the city for which to retrieve the weather report") city: String,
): Map<String, String> {
return if (city.lowercase() == "new york") {
mapOf(
"status" to "success",
"report" to "The weather in New York is sunny with a temperature of " +
"25 degrees Celsius (77 degrees Fahrenheit).",
)
} else {
mapOf(
"status" to "error",
"report" to "Weather information for $city is not available.",
)
}
}
}
fun main() =
runBlocking {
val model = Gemini(name = "gemini-flash-latest")
val agent =
LlmAgent(
name = "multi_tool_agent",
model = model,
description = "Agent to answer questions about the time and weather in a city.",
instruction =
Instruction(
"You are a helpful agent who can answer user questions about the " +
"time and weather in a city.",
),
tools = MultiToolService().generatedTools(),
)
val sessionService = InMemorySessionService()
val runner =
InMemoryRunner(
agent = agent,
appName = "multi_tool_app",
sessionService = sessionService,
)
val userId = "student"
val sessionId = "session_1"
sessionService.createSession(SessionKey("multi_tool_app", userId, sessionId))
val scanner = Scanner(System.`in`)
while (true) {
print("\nYou > ")
val userInput = scanner.nextLine()
if (userInput.lowercase() == "quit") break
val userContent = Content(role = Role.USER, parts = listOf(Part(text = userInput)))
val events =
runner.runAsync(
userId = userId,
sessionId = sessionId,
newMessage = userContent,
).toList()
print("\nAgent > ")
for (event in events) {
event.content?.parts?.forEach { part ->
part.text?.let { print(it) }
}
}
println()
}
}

3. 设置模型¶
您的代理理解用户请求并生成响应的能力,是由生成式人工智能模型(Generative AI Model)或大型语言模型(Large Language Model, LLM)所提供的。本指南以 Gemini 模型为例进行说明,但 ADK 也与谷歌及其他供应商提供的许多人工智能模型兼容。有关可用模型以及如何配置它们的更多信息,请参阅…… 用于 ADK 代理的 AI 模型.
模型连接与身份验证¶
当通过某些服务(例如 Gemini API 或 Google Cloud 上的 Gemini Enterprise Agent Platform)使用 AI 模型时,您必须提供 API 密钥或通过该服务进行身份验证。提供这些信息的最直接方法是使用环境变量。 .env 以下示例展示了配置代理以用于 Gemini API 或 Gemini Enterprise Agent Platform 的最常见方法。
有关将 ADK 代理连接到由 Google Cloud 托管的模型和服务的更多详细信息(包括 Gemini Enterprise Agent Platform),请参阅…… 连接到 Google Cloud 和 Agent Platform。 guide.
4. 运行您的代理程序(Agent)。¶
使用终端,导航到您的代理项目的父目录(例如:使用以下命令):
```bash
cd /path/to/your/agent/project
``` cd ..):
有多种方式可以与您的代理进行交互:
针对代理平台用户的身份验证设置
如果您选择了…… “Gemini – Google Cloud Agent Platform” 在之前的步骤中,您必须在启动开发用户界面(dev UI)之前先使用 Google Cloud 进行身份验证。
运行此命令并按照提示操作:
注意: 如果您使用的是“Gemini - Google AI Studio”,则可以跳过此步骤。
运行以下命令以启动该程序: 开发人员专用用户界面(Dev UI).
注意:ADK Web 仅适用于开发用途。
ADK Web 是 不适用于生产环境中的部署。您应该仅将 ADK Web 用于开发和调试目的。
给 Windows 用户的提示:
当点击……(When hitting……) _make_subprocess_transport NotImplementedError可以考虑使用…… adk web --no-reload 相反。
步骤 1: 请打开所提供的 URL(通常……) http://localhost:8000 或者
http://127.0.0.1:8000)可以直接在您的浏览器中查看。
步骤 2. 在用户界面的左上角,您可以通过下拉菜单来选择您的代理。请选择 “multi_tool_agent”。
故障排除
如果您在下拉菜单中看不到“multi_tool_agent”,请确保您正在运行相应的程序或服务。 adk web 在……里面;在……期间 父文件夹 从您的代理文件夹中取出该文件(即 `multi_tool_agent` 的父文件夹)。
步骤 3. 现在,您可以使用文本框与您的客服代表进行聊天了。

步骤 4. 通过使用…… Events 点击左侧的标签(tab),您可以通过点击“actions”来查看各个函数调用、相应的响应结果以及模型的输出结果。

在……上;关于…… Events 在“tab”选项卡下,您也可以点击(相应的按钮或链接)。 Trace 一个按钮,用于查看每个事件的跟踪日志(trace logs),这些日志会显示每次函数调用的延迟情况。

步骤 5. 您也可以启用麦克风,然后与客服人员通话。
支持语音/视频流传输的模型
为了在 ADK 中使用语音/视频流功能,您需要使用支持 Live API 的 Gemini 模型。您可以在相关文档或资源中找到这些模型的详细信息。 模型 ID(Model IDs) 该产品/服务在文档中明确说明了其对 Gemini Live API 的支持。
然后你可以替换…… model `string in` root_agent 在……里面;在……期间 agent.py 你之前创建的文件……)跳转到相应章节你的代码应该看起来像这样:

提示(Tip)
在使用时…… adk run 你可以将提示信息注入到代理程序中,从而开始执行相应的操作。具体方法是将文本通过管道(pipe)传递给相应的命令,如下所示:
运行以下命令,与您的天气信息提供者进行聊天。

要退出,请使用 Cmd/Ctrl+C。
adk api_server 该功能允许您通过一个简单的命令创建一个本地的 FastAPI 服务器,从而在部署代理程序之前先测试相关的 cURL 请求。

要学习如何使用…… adk api_server **用于测试,请参考:**
关于如何使用该 API 服务器的文档.
使用终端,导航到您的代理项目目录:
有多种方式可以与您的代理进行交互:
运行以下命令以启动该程序: 开发人员专用用户界面(Dev UI).
步骤 1: 请打开所提供的 URL(通常……) http://localhost:8000 或者
http://127.0.0.1:8000)可以直接在您的浏览器中查看。
步骤 2. 在用户界面的左上角,从下拉菜单中选择您的代理(agent)。代理们是按照它们的文件名来排列的,因此您应该选择 “agent”。
故障排除
如果在下拉菜单中看不到“agent”选项,请确保您正在运行相应的程序或服务。 npx adk web 在包含你的文件的目录中…… agent.ts file.
步骤 3. 现在,您可以使用文本框与您的客服代表进行聊天了。

步骤 4. 通过使用…… Events 点击左侧的标签(tab),您可以通过点击“actions”来查看各个函数调用、相应的响应结果以及模型的输出结果。

在……上;关于…… Events 在“tab”选项卡下,您也可以点击(相应的按钮或链接)。 Trace 一个按钮,用于查看每个事件的跟踪日志(trace logs),这些日志会显示每次函数调用的延迟情况。

npx adk api_server 该功能允许您通过一个简单的命令创建一个本地的 Express.js 服务器,从而在部署代理程序之前先测试相关的 cURL 请求。

要学习如何使用…… api_server **用于测试,请参考:**
关于测试的文档.
使用终端,导航到您的代理项目目录:
有多种方式可以与您的代理进行交互:
运行以下命令以启动该程序: 开发人员专用用户界面(Dev UI)您必须指定要激活哪些子启动器(例如: webui, api).
步骤 1: 请打开所提供的 URL(通常……) http://localhost:8080)可以直接在您的浏览器中查看。
步骤 2. 在用户界面的左上角,从下拉菜单中选择您的代理(agent)。该代理的名称应为 “weather_time_agent”。
步骤 3. 现在,您可以使用文本框与您的客服代表进行聊天。
使用终端,导航到您的代理项目的父目录(例如:使用以下命令):
```bash
cd /path/to/your/agent/project
``` cd ..):
project_folder/ <-- navigate to this directory
├── pom.xml (or build.gradle)
├── src/
├── └── main/
│ └── java/
│ └── agents/
│ └── multitool/
│ └── MultiToolAgent.java
└── test/
从终端中运行以下命令,以启动开发用户界面(Dev UI)。
请勿更改 Dev UI 服务器的主类名称。
mvn exec:java \
-Dexec.mainClass="com.google.adk.web.AdkWebServer" \
-Dexec.args="--adk.agents.source-dir=src/main/java" \
-Dexec.classpathScope="compile"
步骤 1: 请打开所提供的 URL(通常……) http://localhost:8080 或者
http://127.0.0.1:8080)可以直接在您的浏览器中查看。
步骤 2. 在用户界面的左上角,您可以通过下拉菜单来选择您的代理。请选择 “multi_tool_agent”。
故障排除
如果您在下拉菜单中看不到“multi_tool_agent”,请确保您正在运行相应的程序或服务。 mvn 在您的 Java 源代码所在的目录中执行该命令(通常情况下)。 src/main/java).
步骤 3. 现在,您可以使用文本框与您的客服代表进行聊天了。

步骤 4. 您还可以通过点击相应的操作按钮来查看单个函数调用、响应结果以及模型的输出结果。

注意:ADK Web 仅适用于开发用途。
ADK Web 是 不适用于生产环境中的部署。您应该仅将 ADK Web 用于开发和调试目的。
使用 Maven,运行以下命令: main() 使用以下命令来调用您 Java 类中的该方法:
使用终端,导航到您的代理项目目录:
project_folder/ <-- navigate to this directory
├── build.gradle.kts
├── src/
├── └── main/
│ └── kotlin/
│ └── agents/
│ └── multitool/
│ └── MultiToolAgent.kt
运行您的代理程序(Agent)。¶
您可以运行该程序。 main() 在 Kotlin 类中,可以使用 Gradle 来实现某种方法(function)。
或者,如果你使用的是 IntelliJ IDEA,只需点击旁边的绿色“运行”按钮即可。 main() function.
📝 一些可供尝试的示例提示:¶
- 纽约的天气怎么样?
- 纽约现在的时间是多少?
- 巴黎的天气怎么样?
- 巴黎现在的时间是多少?
🎉 恭喜您!¶
您已经成功使用 ADK 创建了第一个代理,并与该代理进行了交互!
🛣️ 下一步行动¶
- 前往教程页面。:学习如何为您的代理程序添加内存、会话管理功能以及状态存储机制: 教程.
- 深入了解高级配置选项: 探索…… `setup` 该部分提供了更深入的讲解,内容涉及项目结构、配置以及其他相关接口的详细信息。
- 理解核心概念: 了解关于……的信息 代理(Agents)概念.