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
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ test = [
"a2a-sdk>=0.3.0,<0.4.0",
"anthropic>=0.43.0", # For anthropic model tests
"crewai[tools];python_version>='3.11' and python_version<'3.12'", # For CrewaiTool tests; chromadb/pypika fail on 3.12+
"google-cloud-firestore>=2.11.0",
"kubernetes>=29.0.0", # For GkeCodeExecutor
"langchain-community>=0.3.17",
"langgraph>=0.2.60, <0.4.8", # For LangGraphAgent
Expand Down Expand Up @@ -157,6 +158,7 @@ extensions = [
"beautifulsoup4>=3.2.2", # For load_web_page tool.
"crewai[tools];python_version>='3.11' and python_version<'3.12'", # For CrewaiTool; chromadb/pypika fail on 3.12+
"docker>=7.0.0", # For ContainerCodeExecutor
"google-cloud-firestore>=2.11.0", # For Firestore services
"kubernetes>=29.0.0", # For GkeCodeExecutor
"k8s-agent-sandbox>=0.1.1.post3", # For GkeCodeExecutor sandbox mode
"langgraph>=0.2.60, <0.4.8", # For LangGraphAgent
Expand Down
2 changes: 1 addition & 1 deletion src/google/adk/errors/already_exists_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class AlreadyExistsError(Exception):
"""Represents an error that occurs when an entity already exists."""

def __init__(self, message="The resource already exists."):
def __init__(self, message: str = "The resource already exists."):
"""Initializes the AlreadyExistsError exception.

Args:
Expand Down
64 changes: 64 additions & 0 deletions src/google/adk/firestore_database_runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

import os
from typing import Optional
from typing import TYPE_CHECKING

from .artifacts.gcs_artifact_service import GcsArtifactService
from .memory.firestore_memory_service import FirestoreMemoryService
from .runners import Runner
from .sessions.firestore_session_service import FirestoreSessionService

if TYPE_CHECKING:
from .agents.base_agent import BaseAgent


def create_firestore_runner(
agent: BaseAgent,
gcs_bucket_name: Optional[str] = None,
firestore_root_collection: Optional[str] = None,
) -> Runner:
"""Creates a Runner configured with Firestore and GCS services.

Args:
agent: The root agent to run.
gcs_bucket_name: The GCS bucket name for artifacts.
firestore_root_collection: The root collection name for Firestore.

Returns:
A Runner instance configured with Firestore services.
"""
bucket_name = gcs_bucket_name or os.environ.get("ADK_GCS_BUCKET_NAME")
if not bucket_name:
raise ValueError(
"Required property 'ADK_GCS_BUCKET_NAME' is not set. This"
" is needed for the GcsArtifactService."
)
artifact_service = GcsArtifactService(bucket_name=bucket_name)

session_service = FirestoreSessionService(
root_collection=firestore_root_collection
)
memory_service = FirestoreMemoryService()

return Runner(
app_name=agent.name,
agent=agent,
session_service=session_service,
artifact_service=artifact_service,
memory_service=memory_service,
)
Loading
Loading