Skip to content

Commit 37108be

Browse files
google-genai-botcopybara-github
authored andcommitted
docs: Add AGENTS.md to provide relevant project context for the Gemini CLI
Including details on the ADK style guide and how to run specific tools. PiperOrigin-RevId: 776827602
1 parent b6c7b5b commit 37108be

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed

.gemini/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"contextFileName": "AGENTS.md"
3+
}

AGENTS.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Gemini CLI / Gemini Code Assist Context
2+
3+
This document provides context for the Gemini CLI and Gemini Code Assist to understand the project and assist with development.
4+
5+
## Project Overview
6+
7+
The Agent Development Kit (ADK) is an open-source, code-first Python toolkit for building, evaluating, and deploying sophisticated AI agents with flexibility and control. While optimized for Gemini and the Google ecosystem, ADK is model-agnostic, deployment-agnostic, and is built for compatibility with other frameworks. ADK was designed to make agent development feel more like software development, to make it easier for developers to create, deploy, and orchestrate agentic architectures that range from simple tasks to complex workflows.
8+
9+
## ADK: Style Guides
10+
11+
### Python Style Guide
12+
13+
The project follows the Google Python Style Guide. Key conventions are enforced using `pylint` with the provided `pylintrc` configuration file. Here are some of the key style points:
14+
15+
* **Indentation**: 2 spaces.
16+
* **Line Length**: Maximum 80 characters.
17+
* **Naming Conventions**:
18+
* `function_and_variable_names`: `snake_case`
19+
* `ClassNames`: `CamelCase`
20+
* `CONSTANTS`: `UPPERCASE_SNAKE_CASE`
21+
* **Docstrings**: Required for all public modules, functions, classes, and methods.
22+
* **Imports**: Organized and sorted.
23+
* **Error Handling**: Specific exceptions should be caught, not general ones like `Exception`.
24+
25+
### Autoformat
26+
27+
We have autoformat.sh to help solve import organize and formatting issues.
28+
29+
```bash
30+
# Run in open_source_workspace/
31+
$ ./autoformat.sh
32+
```
33+
34+
### In ADK source
35+
36+
Below styles applies to the ADK source code (under `src/` folder of the Github.
37+
repo).
38+
39+
#### Use relative imports
40+
41+
```python
42+
# DO
43+
from ..agents.llm_agent import LlmAgent
44+
45+
# DON'T
46+
from google.adk.agents.llm_agent import LlmAgent
47+
```
48+
49+
#### Import from module, not from `__init__.py`
50+
51+
```python
52+
# DO
53+
from ..agents.llm_agent import LlmAgent
54+
55+
# DON'T
56+
from ..agents import LlmAgent # import from agents/__init__.py
57+
```
58+
59+
#### Always do `from __future__ import annotations`
60+
61+
```python
62+
# DO THIS, right after the open-source header.
63+
from __future__ import annotations
64+
```
65+
66+
Like below:
67+
68+
```python
69+
# Copyright 2025 Google LLC
70+
#
71+
# Licensed under the Apache License, Version 2.0 (the "License");
72+
# you may not use this file except in compliance with the License.
73+
# You may obtain a copy of the License at
74+
#
75+
# http://www.apache.org/licenses/LICENSE-2.0
76+
#
77+
# Unless required by applicable law or agreed to in writing, software
78+
# distributed under the License is distributed on an "AS IS" BASIS,
79+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
80+
# See the License for the specific language governing permissions and
81+
# limitations under the License.
82+
83+
from __future__ import annotations
84+
85+
# ... the rest of the file.
86+
```
87+
88+
This allows us to forward-reference a class without quotes.
89+
90+
Check out go/pep563 for details.
91+
92+
### In ADK tests
93+
94+
#### Use absolute imports
95+
96+
In tests, we use `google.adk` same as how our users uses.
97+
98+
```python
99+
# DO
100+
from google.adk.agents.llm_agent import LlmAgent
101+
102+
# DON'T
103+
from ..agents.llm_agent import LlmAgent
104+
```
105+
106+
## ADK: Local testing
107+
108+
### Unit tests
109+
110+
Run below command:
111+
112+
```bash
113+
$ pytest tests/unittests
114+
```

0 commit comments

Comments
 (0)