google-adk-extras 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. google_adk_extras-0.1.1/LICENSE +202 -0
  2. google_adk_extras-0.1.1/MANIFEST.in +10 -0
  3. google_adk_extras-0.1.1/PKG-INFO +175 -0
  4. google_adk_extras-0.1.1/README.md +145 -0
  5. google_adk_extras-0.1.1/examples/README.md +69 -0
  6. google_adk_extras-0.1.1/examples/artifact/README.md +41 -0
  7. google_adk_extras-0.1.1/examples/artifact/example.py +198 -0
  8. google_adk_extras-0.1.1/examples/artifact/local_folder_artifact_example.py +97 -0
  9. google_adk_extras-0.1.1/examples/artifact/mongodb_artifact_example.py +80 -0
  10. google_adk_extras-0.1.1/examples/artifact/s3_artifact_example.py +46 -0
  11. google_adk_extras-0.1.1/examples/artifact/sql_artifact_example.py +112 -0
  12. google_adk_extras-0.1.1/examples/artifact_service_example.py +196 -0
  13. google_adk_extras-0.1.1/examples/google_adk_integration.py +91 -0
  14. google_adk_extras-0.1.1/examples/memory/README.md +41 -0
  15. google_adk_extras-0.1.1/examples/memory/example.py +243 -0
  16. google_adk_extras-0.1.1/examples/memory/mongodb_memory_example.py +96 -0
  17. google_adk_extras-0.1.1/examples/memory/redis_memory_example.py +96 -0
  18. google_adk_extras-0.1.1/examples/memory/sql_memory_example.py +105 -0
  19. google_adk_extras-0.1.1/examples/memory/yaml_memory_example.py +93 -0
  20. google_adk_extras-0.1.1/examples/session/README.md +40 -0
  21. google_adk_extras-0.1.1/examples/session/example.py +229 -0
  22. google_adk_extras-0.1.1/examples/session/mongodb_session_example.py +77 -0
  23. google_adk_extras-0.1.1/examples/session/redis_session_example.py +70 -0
  24. google_adk_extras-0.1.1/examples/session/sql_session_example.py +87 -0
  25. google_adk_extras-0.1.1/examples/session/yaml_session_example.py +76 -0
  26. google_adk_extras-0.1.1/examples/session_service_example.py +118 -0
  27. google_adk_extras-0.1.1/examples/test_session_service.py +75 -0
  28. google_adk_extras-0.1.1/pyproject.toml +29 -0
  29. google_adk_extras-0.1.1/setup.cfg +4 -0
  30. google_adk_extras-0.1.1/setup.py +64 -0
  31. google_adk_extras-0.1.1/src/__init__.py +0 -0
  32. google_adk_extras-0.1.1/src/google_adk_extras/__init__.py +1 -0
  33. google_adk_extras-0.1.1/src/google_adk_extras/artifacts/__init__.py +15 -0
  34. google_adk_extras-0.1.1/src/google_adk_extras/artifacts/base_custom_artifact_service.py +207 -0
  35. google_adk_extras-0.1.1/src/google_adk_extras/artifacts/local_folder_artifact_service.py +242 -0
  36. google_adk_extras-0.1.1/src/google_adk_extras/artifacts/mongo_artifact_service.py +221 -0
  37. google_adk_extras-0.1.1/src/google_adk_extras/artifacts/s3_artifact_service.py +323 -0
  38. google_adk_extras-0.1.1/src/google_adk_extras/artifacts/sql_artifact_service.py +255 -0
  39. google_adk_extras-0.1.1/src/google_adk_extras/memory/__init__.py +15 -0
  40. google_adk_extras-0.1.1/src/google_adk_extras/memory/base_custom_memory_service.py +90 -0
  41. google_adk_extras-0.1.1/src/google_adk_extras/memory/mongo_memory_service.py +174 -0
  42. google_adk_extras-0.1.1/src/google_adk_extras/memory/redis_memory_service.py +188 -0
  43. google_adk_extras-0.1.1/src/google_adk_extras/memory/sql_memory_service.py +213 -0
  44. google_adk_extras-0.1.1/src/google_adk_extras/memory/yaml_file_memory_service.py +176 -0
  45. google_adk_extras-0.1.1/src/google_adk_extras/py.typed +0 -0
  46. google_adk_extras-0.1.1/src/google_adk_extras/sessions/__init__.py +13 -0
  47. google_adk_extras-0.1.1/src/google_adk_extras/sessions/base_custom_session_service.py +183 -0
  48. google_adk_extras-0.1.1/src/google_adk_extras/sessions/mongo_session_service.py +243 -0
  49. google_adk_extras-0.1.1/src/google_adk_extras/sessions/redis_session_service.py +271 -0
  50. google_adk_extras-0.1.1/src/google_adk_extras/sessions/sql_session_service.py +308 -0
  51. google_adk_extras-0.1.1/src/google_adk_extras/sessions/yaml_file_session_service.py +245 -0
  52. google_adk_extras-0.1.1/src/google_adk_extras.egg-info/PKG-INFO +175 -0
  53. google_adk_extras-0.1.1/src/google_adk_extras.egg-info/SOURCES.txt +56 -0
  54. google_adk_extras-0.1.1/src/google_adk_extras.egg-info/dependency_links.txt +1 -0
  55. google_adk_extras-0.1.1/src/google_adk_extras.egg-info/requires.txt +15 -0
  56. google_adk_extras-0.1.1/src/google_adk_extras.egg-info/top_level.txt +1 -0
  57. google_adk_extras-0.1.1/src/main.py +0 -0
  58. google_adk_extras-0.1.1/tests/test_basic.py +7 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,10 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
4
+ include setup.py
5
+ recursive-include src *.py
6
+ recursive-include examples *.py *.md
7
+ global-exclude __pycache__
8
+ global-exclude *.pyc
9
+ global-exclude *.pyo
10
+ global-exclude *~
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: google-adk-extras
3
+ Version: 0.1.1
4
+ Summary: Custom implementations of Google ADK services (Session, Artifact, Memory) with multiple storage backends
5
+ Home-page: https://github.com/DeadMeme5441/google-adk-extras
6
+ Author: Your Name
7
+ Author-email: your.email@example.com
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: google-genai>=1.0.0
12
+ Requires-Dist: sqlalchemy>=2.0.0
13
+ Requires-Dist: pymongo>=4.0.0
14
+ Requires-Dist: redis>=4.0.0
15
+ Requires-Dist: pyyaml>=6.0.0
16
+ Requires-Dist: typing-extensions>=4.0.0
17
+ Requires-Dist: pytest>=8.4.2
18
+ Requires-Dist: pytest-asyncio>=1.1.0
19
+ Requires-Dist: google-adk>=1.13.0
20
+ Requires-Dist: boto3>=1.0.0
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=6.0; extra == "dev"
23
+ Requires-Dist: pytest-asyncio>=0.15.0; extra == "dev"
24
+ Requires-Dist: google-genai>=1.0.0; extra == "dev"
25
+ Dynamic: author
26
+ Dynamic: author-email
27
+ Dynamic: home-page
28
+ Dynamic: license-file
29
+ Dynamic: requires-python
30
+
31
+ # Google ADK Custom Services
32
+
33
+ [![CI](https://github.com/DeadMeme5441/google-adk-extras/actions/workflows/ci.yml/badge.svg)](https://github.com/DeadMeme5441/google-adk-extras/actions/workflows/ci.yml)
34
+ [![PyPI version](https://badge.fury.io/py/google-adk-extras.svg)](https://badge.fury.io/py/google-adk-extras)
35
+
36
+ Custom implementations of Google ADK services (Session, Artifact, Memory) with multiple storage backends.
37
+
38
+ ## Features
39
+
40
+ This package provides custom implementations for Google ADK services with various storage backends:
41
+
42
+ ### Session Services
43
+ - **SQLSessionService**: Store sessions in SQL databases (SQLite, PostgreSQL, MySQL, etc.)
44
+ - **MongoSessionService**: Store sessions in MongoDB
45
+ - **RedisSessionService**: Store sessions in Redis
46
+ - **YamlFileSessionService**: Store sessions in YAML files
47
+
48
+ ### Artifact Services
49
+ - **SQLArtifactService**: Store artifacts in SQL databases
50
+ - **MongoArtifactService**: Store artifacts in MongoDB
51
+ - **LocalFolderArtifactService**: Store artifacts in local file system
52
+ - **S3ArtifactService**: Store artifacts in AWS S3 or S3-compatible services
53
+
54
+ ### Memory Services
55
+ - **SQLMemoryService**: Store memories in SQL databases
56
+ - **MongoMemoryService**: Store memories in MongoDB
57
+ - **RedisMemoryService**: Store memories in Redis
58
+ - **YamlFileMemoryService**: Store memories in YAML files
59
+
60
+ ## Installation
61
+
62
+ ```bash
63
+ pip install google-adk-extras
64
+ ```
65
+
66
+ ## Usage
67
+
68
+ ### Session Services
69
+
70
+ ```python
71
+ from google_adk_extras.sessions import SQLSessionService
72
+
73
+ # Initialize SQL session service
74
+ session_service = SQLSessionService("sqlite:///sessions.db")
75
+ await session_service.initialize()
76
+
77
+ # Create a session
78
+ session = await session_service.create_session(
79
+ app_name="my_app",
80
+ user_id="user_123",
81
+ state={"theme": "dark"}
82
+ )
83
+ ```
84
+
85
+ ### Artifact Services
86
+
87
+ ```python
88
+ from google_adk_extras.artifacts import LocalFolderArtifactService
89
+ from google.genai import types
90
+
91
+ # Initialize local folder artifact service
92
+ artifact_service = LocalFolderArtifactService("./artifacts")
93
+ await artifact_service.initialize()
94
+
95
+ # Save an artifact
96
+ text_blob = types.Blob(data=b"Hello, world!", mime_type="text/plain")
97
+ text_part = types.Part(inline_data=text_blob)
98
+ version = await artifact_service.save_artifact(
99
+ app_name="my_app",
100
+ user_id="user_123",
101
+ session_id="session_456",
102
+ filename="hello.txt",
103
+ artifact=text_part
104
+ )
105
+ ```
106
+
107
+ ### Memory Services
108
+
109
+ ```python
110
+ from google_adk_extras.memory import RedisMemoryService
111
+ from google.adk.sessions.session import Session
112
+ from google.adk.events.event import Event
113
+
114
+ # Initialize Redis memory service
115
+ memory_service = RedisMemoryService(host="localhost", port=6379)
116
+ await memory_service.initialize()
117
+
118
+ # Add a session to memory
119
+ session = Session(id="session_1", app_name="my_app", user_id="user_123", events=[])
120
+ await memory_service.add_session_to_memory(session)
121
+
122
+ # Search memory
123
+ response = await memory_service.search_memory(
124
+ app_name="my_app",
125
+ user_id="user_123",
126
+ query="important information"
127
+ )
128
+ ```
129
+
130
+ ## Examples
131
+
132
+ See the [examples](examples/) directory for complete working examples of each service.
133
+
134
+ ## Requirements
135
+
136
+ - Python 3.10+
137
+ - Google ADK
138
+ - Storage backend dependencies (installed automatically):
139
+ - SQLAlchemy for SQL services
140
+ - PyMongo for MongoDB services
141
+ - redis-py for Redis services
142
+ - PyYAML for YAML file services
143
+ - boto3 for S3 services
144
+
145
+ ## Development
146
+
147
+ ### Setup
148
+
149
+ ```bash
150
+ # Clone the repository
151
+ git clone https://github.com/DeadMeme5441/google-adk-extras.git
152
+ cd google-adk-extras
153
+
154
+ # Install with uv (recommended)
155
+ uv sync
156
+
157
+ # Or install with pip
158
+ pip install -e .
159
+ ```
160
+
161
+ ### Running Tests
162
+
163
+ ```bash
164
+ # Run all tests
165
+ uv run pytest tests/
166
+
167
+ # Run specific test suite
168
+ uv run pytest tests/unit/
169
+ uv run pytest tests/integration/
170
+ uv run pytest tests/e2e/
171
+ ```
172
+
173
+ ## License
174
+
175
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,145 @@
1
+ # Google ADK Custom Services
2
+
3
+ [![CI](https://github.com/DeadMeme5441/google-adk-extras/actions/workflows/ci.yml/badge.svg)](https://github.com/DeadMeme5441/google-adk-extras/actions/workflows/ci.yml)
4
+ [![PyPI version](https://badge.fury.io/py/google-adk-extras.svg)](https://badge.fury.io/py/google-adk-extras)
5
+
6
+ Custom implementations of Google ADK services (Session, Artifact, Memory) with multiple storage backends.
7
+
8
+ ## Features
9
+
10
+ This package provides custom implementations for Google ADK services with various storage backends:
11
+
12
+ ### Session Services
13
+ - **SQLSessionService**: Store sessions in SQL databases (SQLite, PostgreSQL, MySQL, etc.)
14
+ - **MongoSessionService**: Store sessions in MongoDB
15
+ - **RedisSessionService**: Store sessions in Redis
16
+ - **YamlFileSessionService**: Store sessions in YAML files
17
+
18
+ ### Artifact Services
19
+ - **SQLArtifactService**: Store artifacts in SQL databases
20
+ - **MongoArtifactService**: Store artifacts in MongoDB
21
+ - **LocalFolderArtifactService**: Store artifacts in local file system
22
+ - **S3ArtifactService**: Store artifacts in AWS S3 or S3-compatible services
23
+
24
+ ### Memory Services
25
+ - **SQLMemoryService**: Store memories in SQL databases
26
+ - **MongoMemoryService**: Store memories in MongoDB
27
+ - **RedisMemoryService**: Store memories in Redis
28
+ - **YamlFileMemoryService**: Store memories in YAML files
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install google-adk-extras
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ### Session Services
39
+
40
+ ```python
41
+ from google_adk_extras.sessions import SQLSessionService
42
+
43
+ # Initialize SQL session service
44
+ session_service = SQLSessionService("sqlite:///sessions.db")
45
+ await session_service.initialize()
46
+
47
+ # Create a session
48
+ session = await session_service.create_session(
49
+ app_name="my_app",
50
+ user_id="user_123",
51
+ state={"theme": "dark"}
52
+ )
53
+ ```
54
+
55
+ ### Artifact Services
56
+
57
+ ```python
58
+ from google_adk_extras.artifacts import LocalFolderArtifactService
59
+ from google.genai import types
60
+
61
+ # Initialize local folder artifact service
62
+ artifact_service = LocalFolderArtifactService("./artifacts")
63
+ await artifact_service.initialize()
64
+
65
+ # Save an artifact
66
+ text_blob = types.Blob(data=b"Hello, world!", mime_type="text/plain")
67
+ text_part = types.Part(inline_data=text_blob)
68
+ version = await artifact_service.save_artifact(
69
+ app_name="my_app",
70
+ user_id="user_123",
71
+ session_id="session_456",
72
+ filename="hello.txt",
73
+ artifact=text_part
74
+ )
75
+ ```
76
+
77
+ ### Memory Services
78
+
79
+ ```python
80
+ from google_adk_extras.memory import RedisMemoryService
81
+ from google.adk.sessions.session import Session
82
+ from google.adk.events.event import Event
83
+
84
+ # Initialize Redis memory service
85
+ memory_service = RedisMemoryService(host="localhost", port=6379)
86
+ await memory_service.initialize()
87
+
88
+ # Add a session to memory
89
+ session = Session(id="session_1", app_name="my_app", user_id="user_123", events=[])
90
+ await memory_service.add_session_to_memory(session)
91
+
92
+ # Search memory
93
+ response = await memory_service.search_memory(
94
+ app_name="my_app",
95
+ user_id="user_123",
96
+ query="important information"
97
+ )
98
+ ```
99
+
100
+ ## Examples
101
+
102
+ See the [examples](examples/) directory for complete working examples of each service.
103
+
104
+ ## Requirements
105
+
106
+ - Python 3.10+
107
+ - Google ADK
108
+ - Storage backend dependencies (installed automatically):
109
+ - SQLAlchemy for SQL services
110
+ - PyMongo for MongoDB services
111
+ - redis-py for Redis services
112
+ - PyYAML for YAML file services
113
+ - boto3 for S3 services
114
+
115
+ ## Development
116
+
117
+ ### Setup
118
+
119
+ ```bash
120
+ # Clone the repository
121
+ git clone https://github.com/DeadMeme5441/google-adk-extras.git
122
+ cd google-adk-extras
123
+
124
+ # Install with uv (recommended)
125
+ uv sync
126
+
127
+ # Or install with pip
128
+ pip install -e .
129
+ ```
130
+
131
+ ### Running Tests
132
+
133
+ ```bash
134
+ # Run all tests
135
+ uv run pytest tests/
136
+
137
+ # Run specific test suite
138
+ uv run pytest tests/unit/
139
+ uv run pytest tests/integration/
140
+ uv run pytest tests/e2e/
141
+ ```
142
+
143
+ ## License
144
+
145
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,69 @@
1
+ # Google ADK Custom Services Examples
2
+
3
+ This directory contains end-to-end examples for all custom Google ADK services.
4
+
5
+ ## Directory Structure
6
+
7
+ - [`session/`](session/) - Examples for custom session services
8
+ - [`artifact/`](artifact/) - Examples for custom artifact services
9
+ - [`memory/`](memory/) - Examples for custom memory services
10
+
11
+ ## Overview
12
+
13
+ Each directory contains:
14
+
15
+ 1. `example.py` - A comprehensive example demonstrating the service
16
+ 2. `README.md` - Instructions for running the example
17
+
18
+ ## Requirements
19
+
20
+ - Python 3.10+
21
+ - Google ADK installed
22
+ - UV package manager
23
+
24
+ Some examples require additional services:
25
+ - MongoDB examples need a running MongoDB instance
26
+ - Redis examples need a running Redis instance
27
+ - S3 examples need AWS credentials configured
28
+
29
+ ## Running Examples
30
+
31
+ To run any example:
32
+
33
+ ```bash
34
+ cd /path/to/google-adk-extras
35
+ uv run python examples/[service_type]/example.py
36
+ ```
37
+
38
+ For example:
39
+ ```bash
40
+ uv run python examples/session/example.py
41
+ uv run python examples/artifact/example.py
42
+ uv run python examples/memory/example.py
43
+ ```
44
+
45
+ ## Service Coverage
46
+
47
+ ### Session Services
48
+ - SQLSessionService (SQLite, PostgreSQL, MySQL, etc.)
49
+ - MongoSessionService (MongoDB)
50
+ - RedisSessionService (Redis)
51
+ - YamlFileSessionService (File-based)
52
+
53
+ ### Artifact Services
54
+ - SQLArtifactService (SQLite, PostgreSQL, MySQL, etc.)
55
+ - MongoArtifactService (MongoDB)
56
+ - LocalFolderArtifactService (File-based)
57
+ - S3ArtifactService (AWS S3 and S3-compatible services)
58
+
59
+ ### Memory Services
60
+ - SQLMemoryService (SQLite, PostgreSQL, MySQL, etc.)
61
+ - MongoMemoryService (MongoDB)
62
+ - RedisMemoryService (Redis)
63
+ - YamlFileMemoryService (File-based)
64
+
65
+ ## Notes
66
+
67
+ - Examples that require external services (MongoDB, Redis, S3) will gracefully skip if those services aren't available
68
+ - All examples use temporary files/databases where possible to avoid side effects
69
+ - Examples demonstrate both basic operations and integration with Google ADK runners
@@ -0,0 +1,41 @@
1
+ # Artifact Services Examples
2
+
3
+ This directory contains examples for all custom artifact service implementations.
4
+
5
+ ## Examples
6
+
7
+ - [`sql_artifact_example.py`](sql_artifact_example.py) - SQLArtifactService (SQLite)
8
+ - [`mongodb_artifact_example.py`](mongodb_artifact_example.py) - MongoArtifactService (MongoDB)
9
+ - [`local_folder_artifact_example.py`](local_folder_artifact_example.py) - LocalFolderArtifactService (File-based)
10
+ - [`s3_artifact_example.py`](s3_artifact_example.py) - S3ArtifactService (AWS S3)
11
+
12
+ ## Requirements
13
+
14
+ - Python 3.10+
15
+ - Google ADK installed
16
+ - For MongoDB example: Running MongoDB instance
17
+ - For S3 example: AWS credentials configured
18
+
19
+ ## Running Examples
20
+
21
+ To run any example:
22
+
23
+ ```bash
24
+ cd /path/to/google-adk-extras
25
+ uv run python examples/artifact/[example_name].py
26
+ ```
27
+
28
+ For example:
29
+ ```bash
30
+ uv run python examples/artifact/sql_artifact_example.py
31
+ uv run python examples/artifact/mongodb_artifact_example.py
32
+ uv run python examples/artifact/local_folder_artifact_example.py
33
+ uv run python examples/artifact/s3_artifact_example.py
34
+ ```
35
+
36
+ ## Notes
37
+
38
+ - MongoDB and S3 examples will be skipped if their respective services aren't configured
39
+ - All examples use temporary files/databases where possible to avoid side effects
40
+ - Examples demonstrate artifact operations: save, load, list keys, list versions
41
+ - Both text and binary artifacts are demonstrated