Skip to content

Commit 63ddcfc

Browse files
authored
fix: expense reimbursement sample agent env var reference and function parsing errors (#286)
* #212 fix typo in README.md related to LiteLLM env var reqs * #212 fix runtime issue related to dynamic functions param parsing - google/adk-python#1634 * #212 update dependencies for expense reimbursement sample * #212 fix reference to env var
1 parent a032187 commit 63ddcfc

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

samples/python/agents/adk_expense_reimbursement/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This agent takes text requests from the client and, if any details are missing,
2121
2. Create an environment file with your API key:
2222

2323
```bash
24-
echo "GOOGLE_API_KEY=your_api_key_here" > .env
24+
echo "GEMINI_API_KEY=your_api_key_here" > .env
2525
```
2626

2727
3. Run an agent:

samples/python/agents/adk_expense_reimbursement/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ def main(host, port):
3333
try:
3434
# Check for API key only if Vertex AI is not configured
3535
if not os.getenv('GOOGLE_GENAI_USE_VERTEXAI') == 'TRUE':
36-
if not os.getenv('GOOGLE_API_KEY'):
36+
if not os.getenv('GEMINI_API_KEY'):
3737
raise MissingAPIKeyError(
38-
'GOOGLE_API_KEY environment variable not set and GOOGLE_GENAI_USE_VERTEXAI is not TRUE.'
38+
'GEMINI_API_KEY environment variable not set and GOOGLE_GENAI_USE_VERTEXAI is not TRUE.'
3939
)
4040

4141
capabilities = AgentCapabilities(streaming=True)

samples/python/agents/adk_expense_reimbursement/agent.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22
import os
33
import random
4+
from typing import Optional
45

56
from collections.abc import AsyncIterable
67
from typing import Any
@@ -20,9 +21,9 @@
2021

2122

2223
def create_request_form(
23-
date: str | None = None,
24-
amount: str | None = None,
25-
purpose: str | None = None,
24+
date: Optional[str] = None,
25+
amount: Optional[str] = None,
26+
purpose: Optional[str] = None,
2627
) -> dict[str, Any]:
2728
"""Create a request form for the employee to fill out.
2829
@@ -49,7 +50,7 @@ def create_request_form(
4950
def return_form(
5051
form_request: dict[str, Any],
5152
tool_context: ToolContext,
52-
instructions: str | None = None,
53+
instructions: Optional[str] = None,
5354
) -> dict[str, Any]:
5455
"""Returns a structured json object indicating a form to complete.
5556

samples/python/agents/adk_expense_reimbursement/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ name = "a2a-sample-agent-adk"
33
version = "0.1.0"
44
description = "Sample Google ADK-based Expense Reimbursement agent hosted as an A2A server."
55
readme = "README.md"
6-
requires-python = ">=3.12"
6+
requires-python = ">=3.13"
77
dependencies = [
88
"a2a-sdk>=0.2.16",
99
"click>=8.1.8",
10-
"google-adk>=1.0.0",
11-
"google-genai>=1.9.0",
10+
"google-adk>=1.8.0",
11+
"google-genai>=1.27.0",
1212
"python-dotenv>=1.1.0",
1313
"litellm",
1414
]

0 commit comments

Comments
 (0)