Skip to content

Commit 408d3df

Browse files
seanzhougooglecopybara-github
authored andcommitted
chore: refactor discussion answering agent to merge answer_discussions.py into main.py
mainly to dedup duplicated functionality in both file. PiperOrigin-RevId: 802291102
1 parent 831e2e6 commit 408d3df

File tree

4 files changed

+141
-199
lines changed

4 files changed

+141
-199
lines changed

.github/workflows/discussion_answering.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,5 @@ jobs:
4141
OWNER: 'google'
4242
REPO: 'adk-python'
4343
INTERACTIVE: 0
44-
DISCUSSION_NUMBER: ${{ github.event.discussion.number }}
4544
PYTHONPATH: contributing/samples
46-
run: python -m adk_answering_agent.main
45+
run: python -m adk_answering_agent.main --discussion_number ${{ github.event.discussion.number }}

contributing/samples/adk_answering_agent/README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This agent can be operated in three distinct modes:
66

77
- An interactive mode for local use.
88
- A batch script mode for oncall use.
9-
- A fully automated GitHub Actions workflow (TBD).
9+
- A fully automated GitHub Actions workflow.
1010

1111
---
1212

@@ -31,26 +31,30 @@ This will start a local server and provide a URL to access the agent's web inter
3131

3232
## Batch Script Mode
3333

34-
The `answer_discussions.py` is created for ADK oncall team to batch process discussions.
34+
The `main.py` script supports batch processing for ADK oncall team to process discussions.
3535

3636
### Features
37-
* **Batch Process**: Taken either a number as the count of the recent discussions or a list of discussion numbers, the script will invoke the agent to answer all the specified discussions in one single run.
37+
* **Single Discussion**: Process a specific discussion by providing its number.
38+
* **Batch Process**: Process the N most recently updated discussions.
3839

39-
### Running in Interactive Mode
40-
To run the agent in batch script mode, first set the required environment variables. Then, execute the following command in your terminal:
40+
### Running in Batch Script Mode
41+
To run the agent in batch script mode, first set the required environment variables. Then, execute one of the following commands:
4142

4243
```bash
4344
export PYTHONPATH=contributing/samples
44-
python -m adk_answering_agent.answer_discussions --numbers 27 36 # Answer specified discussions
45-
```
4645

47-
Or `python -m adk_answering_agent.answer_discussions --recent 10` to answer the 10 most recent updated discussions.
46+
# Answer a specific discussion
47+
python -m adk_answering_agent.main --discussion_number 27
48+
49+
# Answer the 10 most recent updated discussions
50+
python -m adk_answering_agent.main --recent 10
51+
```
4852

4953
---
5054

5155
## GitHub Workflow Mode
5256

53-
The `main.py` is reserved for the Github Workflow. The detailed setup for the automatic workflow is TBD.
57+
The `main.py` script is automatically triggered by GitHub Actions when new discussions are created in the Q&A category. The workflow is configured in `.github/workflows/discussion_answering.yml` and automatically processes discussions using the `--discussion_number` flag.
5458

5559
---
5660

contributing/samples/adk_answering_agent/answer_discussions.py

Lines changed: 0 additions & 172 deletions
This file was deleted.

0 commit comments

Comments
 (0)