google-adk 0.0.2__py3-none-any.whl → 0.0.3__py3-none-any.whl
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.
- google/adk/._version.py +0 -0
- google/adk/cli/agent_graph.py +31 -5
- google/adk/cli/browser/index.html +1 -1
- google/adk/cli/browser/{main-XUU6OGCC.js → main-SY2WYYGV.js} +1 -1
- google/adk/cli/cli_tools_click.py +51 -6
- google/adk/cli/fast_api.py +19 -9
- google/adk/docs/Makefile +20 -0
- google/adk/docs/build/doctrees/google-adk.doctree +0 -0
- google/adk/docs/build/html/_sources/google-adk.rst.txt +98 -0
- google/adk/docs/build/html/_sources/index.rst.txt +7 -0
- google/adk/docs/build/html/_static/autodoc_pydantic.css +27 -0
- google/adk/docs/build/html/_static/basic.css +925 -0
- google/adk/docs/build/html/_static/debug.css +85 -0
- google/adk/docs/build/html/_static/doctools.js +156 -0
- google/adk/docs/build/html/_static/documentation_options.js +29 -0
- google/adk/docs/build/html/_static/file.png +0 -0
- google/adk/docs/build/html/_static/language_data.js +199 -0
- google/adk/docs/build/html/_static/minus.png +0 -0
- google/adk/docs/build/html/_static/plus.png +0 -0
- google/adk/docs/build/html/_static/pygments.css +274 -0
- google/adk/docs/build/html/_static/scripts/furo-extensions.js +16 -0
- google/adk/docs/build/html/_static/scripts/furo.js +19 -0
- google/adk/docs/build/html/_static/scripts/furo.js.LICENSE.txt +7 -0
- google/adk/docs/build/html/_static/scripts/furo.js.map +1 -0
- google/adk/docs/build/html/_static/searchtools.js +620 -0
- google/adk/docs/build/html/_static/skeleton.css +312 -0
- google/adk/docs/build/html/_static/sphinx_highlight.js +170 -0
- google/adk/docs/build/html/_static/styles/furo-extensions.css +18 -0
- google/adk/docs/build/html/_static/styles/furo-extensions.css.map +1 -0
- google/adk/docs/build/html/_static/styles/furo.css +18 -0
- google/adk/docs/build/html/_static/styles/furo.css.map +1 -0
- google/adk/docs/build/html/genindex.html +861 -0
- google/adk/docs/build/html/google-adk.html +5461 -0
- google/adk/docs/build/html/index.html +567 -0
- google/adk/docs/build/html/objects.inv +0 -0
- google/adk/docs/build/html/py-modindex.html +373 -0
- google/adk/docs/build/html/search.html +333 -0
- google/adk/docs/build/html/searchindex.js +17 -0
- google/adk/docs/source/conf.py +133 -0
- google/adk/docs/source/google-adk.rst +98 -0
- google/adk/docs/source/index.rst +7 -0
- google/adk/version.py +1 -1
- {google_adk-0.0.2.dist-info → google_adk-0.0.3.dist-info}/METADATA +1 -1
- {google_adk-0.0.2.dist-info → google_adk-0.0.3.dist-info}/RECORD +46 -14
- google/adk/cli/media_streamer/__init__.py +0 -19
- google/adk/cli/media_streamer/index.html +0 -228
- google/adk/tests/integration/fixture/flow_complex_spark/sample.debug.log +0 -243
- google_adk-0.0.2.dist-info/LICENSE +0 -202
- {google_adk-0.0.2.dist-info → google_adk-0.0.3.dist-info}/WHEEL +0 -0
- {google_adk-0.0.2.dist-info → google_adk-0.0.3.dist-info}/entry_points.txt +0 -0
@@ -13,6 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
import asyncio
|
16
|
+
from contextlib import asynccontextmanager
|
16
17
|
from datetime import datetime
|
17
18
|
import logging
|
18
19
|
import os
|
@@ -20,6 +21,7 @@ import tempfile
|
|
20
21
|
from typing import Optional
|
21
22
|
|
22
23
|
import click
|
24
|
+
from fastapi import FastAPI
|
23
25
|
import uvicorn
|
24
26
|
|
25
27
|
from . import cli_deploy
|
@@ -230,6 +232,13 @@ def eval_command(
|
|
230
232
|
" This is useful for local debugging."
|
231
233
|
),
|
232
234
|
)
|
235
|
+
@click.option(
|
236
|
+
"--trace_to_cloud",
|
237
|
+
is_flag=True,
|
238
|
+
show_default=True,
|
239
|
+
default=False,
|
240
|
+
help="Optional. Whether to enable cloud trace for telemetry.",
|
241
|
+
)
|
233
242
|
@click.argument(
|
234
243
|
"agents_dir",
|
235
244
|
type=click.Path(
|
@@ -244,6 +253,7 @@ def web(
|
|
244
253
|
log_level: str = "INFO",
|
245
254
|
allow_origins: Optional[list[str]] = None,
|
246
255
|
port: int = 8000,
|
256
|
+
trace_to_cloud: bool = False,
|
247
257
|
):
|
248
258
|
"""Start a FastAPI server with web UI for a certain agent.
|
249
259
|
|
@@ -261,17 +271,43 @@ def web(
|
|
261
271
|
|
262
272
|
logging.getLogger().setLevel(log_level)
|
263
273
|
|
274
|
+
@asynccontextmanager
|
275
|
+
async def _lifespan(app: FastAPI):
|
276
|
+
click.secho(
|
277
|
+
f"""\
|
278
|
+
+-----------------------------------------------------------------------------+
|
279
|
+
| ADK Web Server started |
|
280
|
+
| |
|
281
|
+
| For local testing, access at http://localhost:{port}.{" "*(29 - len(str(port)))}|
|
282
|
+
+-----------------------------------------------------------------------------+
|
283
|
+
""",
|
284
|
+
fg="green",
|
285
|
+
)
|
286
|
+
yield # Startup is done, now app is running
|
287
|
+
click.secho(
|
288
|
+
"""\
|
289
|
+
+-----------------------------------------------------------------------------+
|
290
|
+
| ADK Web Server shutting down... |
|
291
|
+
+-----------------------------------------------------------------------------+
|
292
|
+
""",
|
293
|
+
fg="green",
|
294
|
+
)
|
295
|
+
|
296
|
+
app = get_fast_api_app(
|
297
|
+
agent_dir=agents_dir,
|
298
|
+
session_db_url=session_db_url,
|
299
|
+
allow_origins=allow_origins,
|
300
|
+
web=True,
|
301
|
+
trace_to_cloud=trace_to_cloud,
|
302
|
+
lifespan=_lifespan,
|
303
|
+
)
|
264
304
|
config = uvicorn.Config(
|
265
|
-
|
266
|
-
agent_dir=agents_dir,
|
267
|
-
session_db_url=session_db_url,
|
268
|
-
allow_origins=allow_origins,
|
269
|
-
web=True,
|
270
|
-
),
|
305
|
+
app,
|
271
306
|
host="0.0.0.0",
|
272
307
|
port=port,
|
273
308
|
reload=True,
|
274
309
|
)
|
310
|
+
|
275
311
|
server = uvicorn.Server(config)
|
276
312
|
server.run()
|
277
313
|
|
@@ -317,6 +353,13 @@ def web(
|
|
317
353
|
" This is useful for local debugging."
|
318
354
|
),
|
319
355
|
)
|
356
|
+
@click.option(
|
357
|
+
"--trace_to_cloud",
|
358
|
+
is_flag=True,
|
359
|
+
show_default=True,
|
360
|
+
default=False,
|
361
|
+
help="Optional. Whether to enable cloud trace for telemetry.",
|
362
|
+
)
|
320
363
|
# The directory of agents, where each sub-directory is a single agent.
|
321
364
|
# By default, it is the current working directory
|
322
365
|
@click.argument(
|
@@ -333,6 +376,7 @@ def cli_api_server(
|
|
333
376
|
log_level: str = "INFO",
|
334
377
|
allow_origins: Optional[list[str]] = None,
|
335
378
|
port: int = 8000,
|
379
|
+
trace_to_cloud: bool = False,
|
336
380
|
):
|
337
381
|
"""Start an api server for a certain agent.
|
338
382
|
|
@@ -356,6 +400,7 @@ def cli_api_server(
|
|
356
400
|
session_db_url=session_db_url,
|
357
401
|
allow_origins=allow_origins,
|
358
402
|
web=False,
|
403
|
+
trace_to_cloud=trace_to_cloud,
|
359
404
|
),
|
360
405
|
host="0.0.0.0",
|
361
406
|
port=port,
|
google/adk/cli/fast_api.py
CHANGED
@@ -31,7 +31,6 @@ import click
|
|
31
31
|
from fastapi import FastAPI
|
32
32
|
from fastapi import HTTPException
|
33
33
|
from fastapi import Query
|
34
|
-
from fastapi import Response
|
35
34
|
from fastapi.middleware.cors import CORSMiddleware
|
36
35
|
from fastapi.responses import FileResponse
|
37
36
|
from fastapi.responses import RedirectResponse
|
@@ -48,6 +47,7 @@ from opentelemetry.sdk.trace import ReadableSpan
|
|
48
47
|
from opentelemetry.sdk.trace import TracerProvider
|
49
48
|
from pydantic import BaseModel
|
50
49
|
from pydantic import ValidationError
|
50
|
+
from starlette.types import Lifespan
|
51
51
|
|
52
52
|
from ..agents import RunConfig
|
53
53
|
from ..agents.live_request_queue import LiveRequest
|
@@ -132,6 +132,8 @@ def get_fast_api_app(
|
|
132
132
|
session_db_url: str = "",
|
133
133
|
allow_origins: Optional[list[str]] = None,
|
134
134
|
web: bool,
|
135
|
+
trace_to_cloud: bool = False,
|
136
|
+
lifespan: Optional[Lifespan[FastAPI]] = None,
|
135
137
|
) -> FastAPI:
|
136
138
|
# InMemory tracing dict.
|
137
139
|
trace_dict: dict[str, Any] = {}
|
@@ -141,18 +143,26 @@ def get_fast_api_app(
|
|
141
143
|
provider.add_span_processor(
|
142
144
|
export.SimpleSpanProcessor(ApiServerSpanExporter(trace_dict))
|
143
145
|
)
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
)
|
150
|
-
|
146
|
+
envs.load_dotenv()
|
147
|
+
enable_cloud_tracing = trace_to_cloud or os.environ.get(
|
148
|
+
"ADK_TRACE_TO_CLOUD", "0"
|
149
|
+
).lower() in ["1", "true"]
|
150
|
+
if enable_cloud_tracing:
|
151
|
+
if project_id := os.environ.get("GOOGLE_CLOUD_PROJECT", None):
|
152
|
+
processor = export.BatchSpanProcessor(
|
153
|
+
CloudTraceSpanExporter(project_id=project_id)
|
154
|
+
)
|
155
|
+
provider.add_span_processor(processor)
|
156
|
+
else:
|
157
|
+
logging.warning(
|
158
|
+
"GOOGLE_CLOUD_PROJECT environment variable is not set. Tracing will"
|
159
|
+
" not be enabled."
|
160
|
+
)
|
151
161
|
|
152
162
|
trace.set_tracer_provider(provider)
|
153
163
|
|
154
164
|
# Run the FastAPI server.
|
155
|
-
app = FastAPI()
|
165
|
+
app = FastAPI(lifespan=lifespan)
|
156
166
|
|
157
167
|
if allow_origins:
|
158
168
|
app.add_middleware(
|
google/adk/docs/Makefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
2
|
+
#
|
3
|
+
|
4
|
+
# You can set these variables from the command line, and also
|
5
|
+
# from the environment for the first two.
|
6
|
+
SPHINXOPTS ?=
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
8
|
+
SOURCEDIR = source
|
9
|
+
BUILDDIR = build
|
10
|
+
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
12
|
+
help:
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
14
|
+
|
15
|
+
.PHONY: help Makefile
|
16
|
+
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
19
|
+
%: Makefile
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
Binary file
|
@@ -0,0 +1,98 @@
|
|
1
|
+
Submodules
|
2
|
+
----------
|
3
|
+
|
4
|
+
google.adk.agents module
|
5
|
+
------------------------
|
6
|
+
|
7
|
+
.. automodule:: google.adk.agents
|
8
|
+
:members:
|
9
|
+
:undoc-members:
|
10
|
+
:show-inheritance:
|
11
|
+
|
12
|
+
google.adk.artifacts module
|
13
|
+
---------------------------
|
14
|
+
|
15
|
+
.. automodule:: google.adk.artifacts
|
16
|
+
:members:
|
17
|
+
:undoc-members:
|
18
|
+
:show-inheritance:
|
19
|
+
|
20
|
+
google.adk.code_executors module
|
21
|
+
--------------------------------
|
22
|
+
|
23
|
+
.. automodule:: google.adk.code_executors
|
24
|
+
:members:
|
25
|
+
:undoc-members:
|
26
|
+
:show-inheritance:
|
27
|
+
|
28
|
+
google.adk.evaluation module
|
29
|
+
----------------------------
|
30
|
+
|
31
|
+
.. automodule:: google.adk.evaluation
|
32
|
+
:members:
|
33
|
+
:undoc-members:
|
34
|
+
:show-inheritance:
|
35
|
+
|
36
|
+
google.adk.events module
|
37
|
+
------------------------
|
38
|
+
|
39
|
+
.. automodule:: google.adk.events
|
40
|
+
:members:
|
41
|
+
:undoc-members:
|
42
|
+
:show-inheritance:
|
43
|
+
|
44
|
+
google.adk.examples module
|
45
|
+
--------------------------
|
46
|
+
|
47
|
+
.. automodule:: google.adk.examples
|
48
|
+
:members:
|
49
|
+
:undoc-members:
|
50
|
+
:show-inheritance:
|
51
|
+
|
52
|
+
google.adk.memory module
|
53
|
+
------------------------
|
54
|
+
|
55
|
+
.. automodule:: google.adk.memory
|
56
|
+
:members:
|
57
|
+
:undoc-members:
|
58
|
+
:show-inheritance:
|
59
|
+
|
60
|
+
google.adk.models module
|
61
|
+
------------------------
|
62
|
+
|
63
|
+
.. automodule:: google.adk.models
|
64
|
+
:members:
|
65
|
+
:undoc-members:
|
66
|
+
:show-inheritance:
|
67
|
+
|
68
|
+
google.adk.planners module
|
69
|
+
--------------------------
|
70
|
+
|
71
|
+
.. automodule:: google.adk.planners
|
72
|
+
:members:
|
73
|
+
:undoc-members:
|
74
|
+
:show-inheritance:
|
75
|
+
|
76
|
+
google.adk.runners module
|
77
|
+
--------------------------
|
78
|
+
|
79
|
+
.. automodule:: google.adk.runners
|
80
|
+
:members:
|
81
|
+
:undoc-members:
|
82
|
+
:show-inheritance:
|
83
|
+
|
84
|
+
google.adk.sessions module
|
85
|
+
--------------------------
|
86
|
+
|
87
|
+
.. automodule:: google.adk.sessions
|
88
|
+
:members:
|
89
|
+
:undoc-members:
|
90
|
+
:show-inheritance:
|
91
|
+
|
92
|
+
google.adk.tools module
|
93
|
+
-----------------------
|
94
|
+
|
95
|
+
.. automodule:: google.adk.tools
|
96
|
+
:members:
|
97
|
+
:undoc-members:
|
98
|
+
:show-inheritance:
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright 2025 Google LLC
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
.autodoc_pydantic_validator_arrow {
|
18
|
+
padding-left: 8px;
|
19
|
+
}
|
20
|
+
|
21
|
+
.autodoc_pydantic_collapsable_json {
|
22
|
+
cursor: pointer;
|
23
|
+
}
|
24
|
+
|
25
|
+
.autodoc_pydantic_collapsable_erd {
|
26
|
+
cursor: pointer;
|
27
|
+
}
|