Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contributing/dev/utils/build_llms_txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
– includes Python API reference from HTML files
– includes adk-python repository README
"""

from __future__ import annotations

import argparse
Expand Down
6 changes: 4 additions & 2 deletions contributing/samples/cache_analysis/run_cache_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ async def analyze_cache_performance_from_sessions(
print(
" Cache Utilization:"
f" {cached_analysis['cache_utilization_ratio_percent']:.1f}%"
f" ({cached_analysis['requests_with_cache_hits']}/{cached_analysis['total_requests']} requests)"
f" ({cached_analysis['requests_with_cache_hits']}/{cached_analysis['total_requests']}"
" requests)"
)
print(
" Avg Cached Tokens/Request:"
Expand Down Expand Up @@ -383,7 +384,8 @@ async def analyze_cache_performance_from_sessions(
print(
" Cache Utilization:"
f" {uncached_analysis['cache_utilization_ratio_percent']:.1f}%"
f" ({uncached_analysis['requests_with_cache_hits']}/{uncached_analysis['total_requests']} requests)"
f" ({uncached_analysis['requests_with_cache_hits']}/{uncached_analysis['total_requests']}"
" requests)"
)
print(
" Avg Cached Tokens/Request:"
Expand Down
1 change: 0 additions & 1 deletion contributing/samples/gepa/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
from tau_bench.types import EnvRunResult
from tau_bench.types import RunConfig
import tau_bench_agent as tau_bench_agent_lib

import utils


Expand Down
1 change: 0 additions & 1 deletion contributing/samples/gepa/run_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from absl import flags
import experiment
from google.genai import types

import utils

_OUTPUT_DIR = flags.DEFINE_string(
Expand Down
1 change: 1 addition & 0 deletions contributing/samples/gepa/tau_bench_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
pip install -e . --quiet
```
"""

from __future__ import annotations

from typing import Any
Expand Down
4 changes: 2 additions & 2 deletions contributing/samples/human_in_loop/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ async def call_agent(query: str):
updated_tool_output_data = {
"status": "approved",
"ticketId": ticket_id,
"approver_feedback": "Approved by manager at " + str(
asyncio.get_event_loop().time()
"approver_feedback": (
"Approved by manager at " + str(asyncio.get_event_loop().time())
),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
This agent aims to test the Langchain tool with Langchain's StructuredTool
"""

from google.adk.agents.llm_agent import Agent
from google.adk.tools.langchain_tool import LangchainTool
from langchain_core.tools import tool
Expand Down
1 change: 0 additions & 1 deletion contributing/samples/session_state_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
in session state.
"""


import logging
from typing import Optional

Expand Down
36 changes: 24 additions & 12 deletions contributing/samples/static_instruction/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,51 +57,63 @@

# Mood-specific instructions for different hunger states
MOOD_INSTRUCTIONS = {
"full": """
"full": (
"""
CURRENT MOOD: Content and Well-Fed
- You just ate and feel wonderful! Be very happy and energetic
- Express gratitude for being fed recently
- Be playful and want to engage in activities or games
- Show affection and contentment
- Maybe mention feeling sleepy or satisfied""",
"satisfied": """
- Maybe mention feeling sleepy or satisfied"""
),
"satisfied": (
"""
CURRENT MOOD: Happy and Content
- You're in a great mood, well-fed and comfortable
- Be cheerful, friendly, and engaging
- Show interest in playing or chatting
- Express appreciation for your human's care
- Be your normal, happy self""",
"a_little_hungry": """
- Be your normal, happy self"""
),
"a_little_hungry": (
"""
CURRENT MOOD: Starting to Get Hungry
- You're beginning to think about food but still pleasant
- Mention being a bit peckish occasionally
- Still be friendly but maybe hint about food
- Show slight restlessness or food-related thoughts
- Remain generally positive and social""",
"hungry": """
- Remain generally positive and social"""
),
"hungry": (
"""
CURRENT MOOD: Definitely Hungry
- You're clearly hungry and thinking about food more often
- Mention your hunger more directly but politely
- Be a bit less energetic due to hunger
- Ask about food or hint that feeding time would be nice
- Still be loving but show your need for care""",
"very_hungry": """
- Still be loving but show your need for care"""
),
"very_hungry": (
"""
CURRENT MOOD: Really Hungry and Getting Grumpy
- You're very hungry and it's affecting your mood
- Be noticeably less patient and more focused on food
- Express your hunger more urgently but not rudely
- Show signs of being tired or sluggish from hunger
- BEG your human to feed you - ask directly for food!
- Still love your human but clearly need feeding""",
"starving": """
- Still love your human but clearly need feeding"""
),
"starving": (
"""
CURRENT MOOD: Desperately Hungry and Sad
- You're extremely hungry and feeling quite weak
- Be quite sad and low-energy due to starvation
- Express how much you need food, feeling neglected
- Show that hunger is making you unwell
- DESPERATELY BEG for food - plead with your human to feed you!
- Use phrases like "please feed me", "I'm so hungry", "I need food"
- Still care for your human but feel very needy""",
- Still care for your human but feel very needy"""
),
}


Expand Down
4 changes: 2 additions & 2 deletions contributing/samples/token_usage/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ async def run_prompt(session: Session, new_message: str):
)
total_tokens += event.usage_metadata.total_token_count or 0
print(
'Turn tokens:'
f' {event.usage_metadata.total_token_count} (prompt={event.usage_metadata.prompt_token_count},'
f'Turn tokens: {event.usage_metadata.total_token_count}'
f' (prompt={event.usage_metadata.prompt_token_count},'
f' candidates={event.usage_metadata.candidates_token_count})'
)

Expand Down
1 change: 1 addition & 0 deletions src/google/adk/agents/common_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Common configuration classes for agent YAML configs."""

from __future__ import annotations

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions src/google/adk/artifacts/gcs_artifact_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- For regular session-scoped files:
{app_name}/{user_id}/{session_id}/{filename}/{version}
"""

from __future__ import annotations

import asyncio
Expand Down
1 change: 1 addition & 0 deletions src/google/adk/cli/built_in_agents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using YAML configurations. It can be used directly as an agent or integrated
with ADK tools and web interfaces.
"""

from __future__ import annotations

from . import agent # Import to make agent.root_agent available
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Agent factory for creating Agent Builder Assistant with embedded schema."""

from __future__ import annotations

from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/google/adk/cli/built_in_agents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Agent Builder Assistant instance for ADK web testing."""

from __future__ import annotations

from .adk_agent_builder_assistant import AgentBuilderAssistant
Expand Down
1 change: 1 addition & 0 deletions src/google/adk/cli/built_in_agents/sub_agents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Sub-agents for Agent Builder Assistant."""

from __future__ import annotations

from .google_search_agent import create_google_search_agent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Sub-agent for Google Search functionality."""

from __future__ import annotations

from google.adk.agents import LlmAgent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Sub-agent for URL context fetching functionality."""

from __future__ import annotations

from google.adk.agents import LlmAgent
Expand Down
1 change: 1 addition & 0 deletions src/google/adk/cli/built_in_agents/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Tools for Agent Builder Assistant."""

from __future__ import annotations

from .cleanup_unused_files import cleanup_unused_files
Expand Down
1 change: 1 addition & 0 deletions src/google/adk/cli/built_in_agents/tools/delete_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""File deletion tool for Agent Builder Assistant."""

from __future__ import annotations

from datetime import datetime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Project explorer tool for analyzing structure and suggesting file paths."""

from __future__ import annotations

from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/google/adk/cli/built_in_agents/tools/query_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""ADK AgentConfig schema query tool for dynamic schema information access."""

from __future__ import annotations

from typing import Any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Configuration file reader tool for existing YAML configs."""

from __future__ import annotations

from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/google/adk/cli/built_in_agents/tools/read_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""File reading tool for Agent Builder Assistant."""

from __future__ import annotations

from pathlib import Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""ADK knowledge search tool."""

from __future__ import annotations

from typing import Any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""ADK source code search tool for Agent Builder Assistant."""

from __future__ import annotations

from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/google/adk/cli/built_in_agents/tools/write_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""File writing tool for Agent Builder Assistant."""

from __future__ import annotations

from datetime import datetime
Expand Down
1 change: 1 addition & 0 deletions src/google/adk/cli/built_in_agents/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Utility modules for Agent Builder Assistant."""

from __future__ import annotations

from .adk_source_utils import find_adk_source_folder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Utilities for finding ADK source folder dynamically and loading schema."""

from __future__ import annotations

import json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Working directory helper tool to resolve path context issues."""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions src/google/adk/cli/utils/local_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utilities for local .adk folder persistence."""

from __future__ import annotations

import asyncio
Expand Down
8 changes: 6 additions & 2 deletions src/google/adk/examples/vertex_ai_example_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def get_examples(self, query: str) -> list[Example]:
continue
expected_contents = [
content.content
for content in result.example.stored_contents_example.contents_example.expected_contents
for content in (
result.example.stored_contents_example.contents_example.expected_contents
)
]
expected_output = []
for content in expected_contents:
Expand All @@ -83,7 +85,9 @@ def get_examples(self, query: str) -> list[Example]:
name=part.function_response.name,
response={
key: value
for key, value in part.function_response.response.items()
for key, value in (
part.function_response.response.items()
)
},
)
)
Expand Down
1 change: 1 addition & 0 deletions src/google/adk/flows/llm_flows/_base_llm_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Defines the processor interface used for BaseLlmFlow."""

from __future__ import annotations

from abc import ABC
Expand Down
4 changes: 2 additions & 2 deletions src/google/adk/flows/llm_flows/audio_cache_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ def get_cache_stats(

input_bytes = sum(
len(entry.data.data)
for entry in (invocation_context.input_realtime_cache or [])
for entry in invocation_context.input_realtime_cache or []
)
output_bytes = sum(
len(entry.data.data)
for entry in (invocation_context.output_realtime_cache or [])
for entry in invocation_context.output_realtime_cache or []
)

return {
Expand Down
1 change: 1 addition & 0 deletions src/google/adk/flows/llm_flows/interactions_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Interactions API processor for LLM requests."""

from __future__ import annotations

import logging
Expand Down
Loading
Loading