Skip to content

Commit 63e0d57

Browse files
authored
docs: update day-02.md with api usage and a few challenges (#2)
Update day-02.md with api usage and a few challenges
1 parent 5cfd811 commit 63e0d57

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

notes/day-02.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
## Challenges Faced
1818

1919
- 网站上给的 command 是错误的,运行 `uvx --from google-adk adk web` 时默认时读取 a directory of agents,而不是在 agent directory。
20+
- Tutorial: AI agent with Google Search(YAML) instruction 也是错的. `adk web` 运行的时候directory应该在agent的parent folder里。
21+
- Tutorial: Multi-agent app with MCP (YAML) 要安装Node.Js 是firecrawl的dependency。firecrawl需要注册,free tier不需要花钱,api key能在设置里找到。
2022

2123
## Code Examples
2224

@@ -40,6 +42,20 @@ description: A helpful assistant for user questions.
4042
instruction: Answer user questions to the best of your knowledge.
4143
model: gemini-2.5-flash
4244
```
45+
### `adk api_server` 的使用
46+
以调取api的模式使用agent不能直接点击网页或者和UI直接交互。just in case有人和我一样不懂怎么调取api,下面是使用范例。
47+
48+
输入`adk api_server` 之后新开一个terminal
49+
```bash
50+
curl -X POST http://localhost:8000/apps/my_agent/users/u_123/sessions/s_123 -H "Content-Type: application/json"
51+
```
52+
apps 后面是agent的名字,user后面是userId,session后面是sessionId.
53+
54+
```bash
55+
curl -X POST http://localhost:8000/run -H "Content-Type: application/json" -d '{"appName":"my_agent", "userId":"u_123", "sessionId":"s_123", "newMessage": {"role": "user", "parts":[{"text": "hello"}]}}'
56+
```
57+
app_name、userId、sessionId需要和上文对应。text后输入user想说的话。
58+
你会在这个terminal看到model的回复。
4359

4460
## Resources
4561

0 commit comments

Comments
 (0)