Skip to content

Commit 0bdba30

Browse files
Jacksunweicopybara-github
authored andcommitted
docs: format README.md for samples
PiperOrigin-RevId: 822180731
1 parent 6a5eac0 commit 0bdba30

File tree

2 files changed

+49
-31
lines changed

2 files changed

+49
-31
lines changed

contributing/samples/oauth_calendar_agent/README.md

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,45 @@
44

55
This sample tests and demos the OAuth support in ADK via two tools:
66

7-
* 1. list_calendar_events
7+
* 1. list_calendar_events
88

9-
This is a customized tool that calls Google Calendar API to list calendar events.
10-
It pass in the client id and client secrete to ADK and then get back the access token from ADK.
11-
And then it uses the access token to call calendar api.
9+
This is a customized tool that calls Google Calendar API to list calendar
10+
events. It pass in the client id and client secrete to ADK and then get back
11+
the access token from ADK. And then it uses the access token to call
12+
calendar api.
1213

13-
* 2. get_calendar_events
14+
* 2. get_calendar_events
1415

15-
This is an google calendar tool that calls Google Calendar API to get the details of a specific calendar.
16-
This tool is from the ADK built-in Google Calendar ToolSet.
17-
Everything is wrapped and the tool user just needs to pass in the client id and client secret.
16+
This is an google calendar tool that calls Google Calendar API to get the
17+
details of a specific calendar. This tool is from the ADK built-in Google
18+
Calendar ToolSet. Everything is wrapped and the tool user just needs to pass
19+
in the client id and client secret.
1820

1921
## How to use
2022

21-
* 1. Follow https://developers.google.com/identity/protocols/oauth2#1.-obtain-oauth-2.0-credentials-from-the-dynamic_data.setvar.console_name. to get your client id and client secret.
22-
Be sure to choose "web" as your client type.
23+
* 1. Follow
24+
https://developers.google.com/identity/protocols/oauth2#1.-obtain-oauth-2.0-credentials-from-the-dynamic_data.setvar.console_name.
25+
to get your client id and client secret. Be sure to choose "web" as your
26+
client type.
2327

24-
* 2. Configure your `.env` file to add two variables:
28+
* 2. Configure your `.env` file to add two variables:
2529

26-
* OAUTH_CLIENT_ID={your client id}
27-
* OAUTH_CLIENT_SECRET={your client secret}
30+
* OAUTH_CLIENT_ID={your client id}
31+
* OAUTH_CLIENT_SECRET={your client secret}
2832

29-
Note: don't create a separate `.env` file , instead put it to the same `.env` file that stores your Vertex AI or Dev ML credentials
33+
Note: don't create a separate `.env` file , instead put it to the same
34+
`.env` file that stores your Vertex AI or Dev ML credentials
3035

31-
* 3. Follow https://developers.google.com/identity/protocols/oauth2/web-server#creatingcred to add http://localhost/dev-ui/ to "Authorized redirect URIs".
36+
* 3. Follow
37+
https://developers.google.com/identity/protocols/oauth2/web-server#creatingcred
38+
to add http://localhost/dev-ui/ to "Authorized redirect URIs".
3239

33-
Note: localhost here is just a hostname that you use to access the dev ui, replace it with the actual hostname you use to access the dev ui.
40+
Note: localhost here is just a hostname that you use to access the dev ui,
41+
replace it with the actual hostname you use to access the dev ui.
3442

35-
* 4. For 1st run, allow popup for localhost in Chrome.
43+
* 4. For 1st run, allow popup for localhost in Chrome.
3644

3745
## Sample prompt
3846

39-
* `List all my today's meeting from 7am to 7pm.`
40-
* `Get the details of the first event.`
47+
* `List all my today's meeting from 7am to 7pm.`
48+
* `Get the details of the first event.`
Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
11
# Output Schema with Tools Sample Agent
22

3-
This sample demonstrates how to use structured output (`output_schema`) alongside other tools in an ADK agent. Previously, this combination was not allowed, but now it's supported through a special processor that handles the interaction.
3+
This sample demonstrates how to use structured output (`output_schema`)
4+
alongside other tools in an ADK agent. Previously, this combination was not
5+
allowed, but now it's supported through a special processor that handles the
6+
interaction.
47

58
## How it Works
69

710
The agent combines:
8-
- **Tools**: `search_wikipedia` and `get_current_year` for gathering information
9-
- **Structured Output**: `PersonInfo` schema to ensure consistent response format
11+
12+
- **Tools**: `search_wikipedia` and `get_current_year` for gathering
13+
information
14+
- **Structured Output**: `PersonInfo` schema to ensure consistent response
15+
format
1016

1117
When both `output_schema` and `tools` are specified:
12-
1. ADK automatically adds a special `set_model_response` tool
13-
2. The model can use the regular tools for information gathering
14-
3. For the final response, the model uses `set_model_response` with structured data
15-
4. ADK extracts and validates the structured response
18+
19+
1. ADK automatically adds a special `set_model_response` tool
20+
2. The model can use the regular tools for information gathering
21+
3. For the final response, the model uses `set_model_response` with structured
22+
data
23+
4. ADK extracts and validates the structured response
1624

1725
## Expected Response Format
1826

19-
The agent will return information in this structured format for user query "Tell me about Albert Einstein":
27+
The agent will return information in this structured format for user query
28+
29+
> Tell me about Albert Einstein.
2030
2131
```json
2232
{
@@ -30,7 +40,7 @@ The agent will return information in this structured format for user query "Tell
3040

3141
## Key Features Demonstrated
3242

33-
1. **Tool Usage**: Agent can search Wikipedia and get current year
34-
2. **Structured Output**: Response follows strict PersonInfo schema
35-
3. **Validation**: ADK validates the response matches the schema
36-
4. **Flexibility**: Works with any combination of tools and output schemas
43+
1. **Tool Usage**: Agent can search Wikipedia and get current year
44+
2. **Structured Output**: Response follows strict PersonInfo schema
45+
3. **Validation**: ADK validates the response matches the schema
46+
4. **Flexibility**: Works with any combination of tools and output schemas

0 commit comments

Comments
 (0)