mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
docs(config): add examples for config agents
PiperOrigin-RevId: 793871778
This commit is contained in:
committed by
Copybara-Service
parent
88114d7c73
commit
d87feb8ddb
@@ -0,0 +1,3 @@
|
||||
# Config-based Agent Sample - Human-In-The-Loop
|
||||
|
||||
http://google3/third_party/py/google/adk/open_source_workspace/contributing/samples/human_in_loop/
|
||||
@@ -0,0 +1,17 @@
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/google/adk-python/refs/heads/main/src/google/adk/agents/config_schemas/AgentConfig.json
|
||||
name: reimbursement_agent
|
||||
model: gemini-2.0-flash
|
||||
instruction: |
|
||||
You are an agent whose job is to handle the reimbursement process for
|
||||
the employees. If the amount is less than $100, you will automatically
|
||||
approve the reimbursement.
|
||||
|
||||
If the amount is greater than $100, you will
|
||||
ask for approval from the manager. If the manager approves, you will
|
||||
call reimburse() to reimburse the amount to the employee. If the manager
|
||||
rejects, you will inform the employee of the rejection.
|
||||
tools:
|
||||
- name: tool_human_in_the_loop.tools.reimburse
|
||||
- name: LongRunningFunctionTool
|
||||
args:
|
||||
func: tool_human_in_the_loop.tools.ask_for_approval
|
||||
@@ -0,0 +1,21 @@
|
||||
from typing import Any
|
||||
|
||||
from google.adk.tools.tool_context import ToolContext
|
||||
|
||||
|
||||
def reimburse(purpose: str, amount: float) -> str:
|
||||
"""Reimburse the amount of money to the employee."""
|
||||
return {
|
||||
'status': 'ok',
|
||||
}
|
||||
|
||||
|
||||
def ask_for_approval(
|
||||
purpose: str, amount: float, tool_context: ToolContext
|
||||
) -> dict[str, Any]:
|
||||
"""Ask for approval for the reimbursement."""
|
||||
return {
|
||||
'status': 'pending',
|
||||
'amount': amount,
|
||||
'ticketId': 'reimbursement-ticket-001',
|
||||
}
|
||||
Reference in New Issue
Block a user