google-adk-extras 0.3.0__tar.gz → 0.3.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 (68) hide show
  1. {google_adk_extras-0.3.0/src/google_adk_extras.egg-info → google_adk_extras-0.3.1}/PKG-INFO +1 -1
  2. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/mkdocs.yml +3 -2
  3. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/pyproject.toml +1 -1
  4. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/__init__.py +1 -1
  5. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/adk_builder.py +1 -0
  6. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/auth/attach.py +8 -3
  7. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/auth/jwt_utils.py +12 -3
  8. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/enhanced_fastapi.py +47 -13
  9. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1/src/google_adk_extras.egg-info}/PKG-INFO +1 -1
  10. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/LICENSE +0 -0
  11. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/MANIFEST.in +0 -0
  12. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/README.md +0 -0
  13. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/docs/agent-loading.md +0 -0
  14. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/docs/auth.md +0 -0
  15. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/docs/examples.md +0 -0
  16. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/docs/fastapi.md +0 -0
  17. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/docs/getting-started.md +0 -0
  18. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/docs/index.md +0 -0
  19. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/docs/quickstarts.md +0 -0
  20. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/docs/services.md +0 -0
  21. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/docs/streaming.md +0 -0
  22. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/docs/troubleshooting.md +0 -0
  23. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/docs/uris.md +0 -0
  24. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/examples/README.md +0 -0
  25. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/examples/adk_server_8015.py +0 -0
  26. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/examples/consume_remote_a2a.py +0 -0
  27. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/examples/custom_loader.py +0 -0
  28. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/examples/fastapi_app.py +0 -0
  29. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/examples/programmatic_a2a_expose.py +0 -0
  30. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/examples/runner_basic.py +0 -0
  31. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/examples/services/artifacts_local.py +0 -0
  32. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/examples/services/memory_yaml.py +0 -0
  33. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/examples/services/sessions_sql.py +0 -0
  34. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/examples/streaming_sse_ws.py +0 -0
  35. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/setup.cfg +0 -0
  36. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/setup.py +0 -0
  37. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/artifacts/__init__.py +0 -0
  38. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/artifacts/base_custom_artifact_service.py +0 -0
  39. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/artifacts/local_folder_artifact_service.py +0 -0
  40. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/artifacts/mongo_artifact_service.py +0 -0
  41. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/artifacts/s3_artifact_service.py +0 -0
  42. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/artifacts/sql_artifact_service.py +0 -0
  43. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/auth/__init__.py +0 -0
  44. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/auth/config.py +0 -0
  45. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/auth/sql_store.py +0 -0
  46. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/credentials/base_custom_credential_service.py +0 -0
  47. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/custom_agent_loader.py +0 -0
  48. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/enhanced_adk_web_server.py +0 -0
  49. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/enhanced_runner.py +0 -0
  50. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/memory/__init__.py +0 -0
  51. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/memory/base_custom_memory_service.py +0 -0
  52. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/memory/mongo_memory_service.py +0 -0
  53. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/memory/redis_memory_service.py +0 -0
  54. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/memory/sql_memory_service.py +0 -0
  55. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/memory/yaml_file_memory_service.py +0 -0
  56. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/sessions/__init__.py +0 -0
  57. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/sessions/base_custom_session_service.py +0 -0
  58. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/sessions/mongo_session_service.py +0 -0
  59. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/sessions/redis_session_service.py +0 -0
  60. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/sessions/sql_session_service.py +0 -0
  61. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/sessions/yaml_file_session_service.py +0 -0
  62. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/streaming/__init__.py +0 -0
  63. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras/streaming/streaming_controller.py +0 -0
  64. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras.egg-info/SOURCES.txt +0 -0
  65. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras.egg-info/dependency_links.txt +0 -0
  66. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras.egg-info/requires.txt +0 -0
  67. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/src/google_adk_extras.egg-info/top_level.txt +0 -0
  68. {google_adk_extras-0.3.0 → google_adk_extras-0.3.1}/tests/test_a2a_helpers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-adk-extras
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Production-ready services and FastAPI wiring for Google ADK
5
5
  Home-page: https://github.com/DeadMeme5441/google-adk-extras
6
6
  Author: DeadMeme5441
@@ -14,6 +14,7 @@ nav:
14
14
  - Getting Started: getting-started.md
15
15
  - Quickstarts: quickstarts.md
16
16
  - FastAPI Integration: fastapi.md
17
+ - Auth (Optional): auth.md
17
18
  - Streaming: streaming.md
18
19
  - Services:
19
20
  - Durable Services: services.md
@@ -46,10 +47,10 @@ plugins:
46
47
  - quickstarts.md: A few end-to-end snippets to copy/paste
47
48
  FastAPI & A2A:
48
49
  - fastapi.md: Build a FastAPI app with AdkBuilder and enable A2A
50
+ Auth:
51
+ - auth.md: Optional inbound API authentication
49
52
  Durable Services:
50
53
  - services.md: Sessions, artifacts, memory backends and trade-offs
51
- Credentials:
52
- # credentials docs removed; use ADK documentation for outbound creds
53
54
  Programmatic Agents:
54
55
  - agent-loading.md: Custom loaders and in-memory registrations
55
56
  Configuration:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "google-adk-extras"
3
- version = "0.3.0"
3
+ version = "0.3.1"
4
4
  description = "Production-ready services and FastAPI wiring for Google ADK"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10,<3.13"
@@ -28,4 +28,4 @@ __all__ = [
28
28
  "CustomAgentLoader",
29
29
  ]
30
30
 
31
- __version__ = "0.3.0"
31
+ __version__ = "0.3.1"
@@ -683,6 +683,7 @@ class AdkBuilder:
683
683
  eval_storage_uri=self._eval_storage_uri,
684
684
  allow_origins=self._allow_origins,
685
685
  web=self._web_ui,
686
+ # Expose future override via builder when needed
686
687
  a2a=self._a2a,
687
688
  programmatic_a2a=self._a2a_expose_programmatic,
688
689
  programmatic_a2a_mount_base=self._a2a_programmatic_mount_base,
@@ -9,7 +9,7 @@ from starlette.middleware.base import BaseHTTPMiddleware
9
9
 
10
10
  from .config import AuthConfig, JwtIssuerConfig, JwtValidatorConfig
11
11
  from .jwt_utils import decode_jwt, encode_jwt, now_ts
12
- from .sql_store import AuthStore
12
+ from typing import Any
13
13
 
14
14
 
15
15
  def attach_auth(app: FastAPI, cfg: Optional[AuthConfig]) -> None:
@@ -25,9 +25,14 @@ def attach_auth(app: FastAPI, cfg: Optional[AuthConfig]) -> None:
25
25
  issuer_cfg = cfg.jwt_issuer
26
26
  api_keys = set(cfg.api_keys or [])
27
27
  basic_users = cfg.basic_users or {}
28
- auth_store: Optional[AuthStore] = None
28
+ auth_store: Optional[Any] = None
29
29
  if issuer_cfg and issuer_cfg.database_url:
30
- auth_store = AuthStore(issuer_cfg.database_url)
30
+ try:
31
+ from .sql_store import AuthStore # type: ignore
32
+ auth_store = AuthStore(issuer_cfg.database_url)
33
+ except Exception:
34
+ # SQL store not available; API key issuance and password grants will be unavailable.
35
+ auth_store = None
31
36
 
32
37
  # Security helpers
33
38
  api_key_header = APIKeyHeader(name="X-API-Key", auto_error=False)
@@ -5,8 +5,16 @@ import json
5
5
  import time
6
6
  from typing import Any, Dict, Optional
7
7
 
8
- import jwt
9
- from jwt import PyJWKClient
8
+ # Lazy import PyJWT to keep this optional when auth is not used.
9
+ def _import_pyjwt():
10
+ try:
11
+ import jwt # type: ignore
12
+ from jwt import PyJWKClient # type: ignore
13
+ return jwt, PyJWKClient
14
+ except Exception as e:
15
+ raise ImportError(
16
+ "PyJWT is required for JWT encode/decode. Install with: pip install PyJWT"
17
+ ) from e
10
18
 
11
19
 
12
20
  def _b64url(data: bytes) -> str:
@@ -14,11 +22,13 @@ def _b64url(data: bytes) -> str:
14
22
 
15
23
 
16
24
  def encode_jwt(payload: Dict[str, Any], *, algorithm: str, key: str, headers: Optional[Dict[str, Any]] = None) -> str:
25
+ jwt, _PyJWKClient = _import_pyjwt()
17
26
  return jwt.encode(payload, key, algorithm=algorithm, headers=headers)
18
27
 
19
28
 
20
29
  def decode_jwt(token: str, *, issuer: Optional[str] = None, audience: Optional[str] = None,
21
30
  jwks_url: Optional[str] = None, hs256_secret: Optional[str] = None) -> Dict[str, Any]:
31
+ jwt, PyJWKClient = _import_pyjwt()
22
32
  options = {"verify_signature": True, "verify_exp": True, "verify_nbf": True}
23
33
  if jwks_url:
24
34
  jwk_client = PyJWKClient(jwks_url)
@@ -33,4 +43,3 @@ def decode_jwt(token: str, *, issuer: Optional[str] = None, audience: Optional[s
33
43
  def now_ts() -> int:
34
44
  return int(time.time())
35
45
 
36
-
@@ -10,7 +10,7 @@ import logging
10
10
  import os
11
11
  from pathlib import Path
12
12
  import shutil
13
- from typing import Any, Mapping, Optional, List, Callable, Dict
13
+ from typing import Any, Mapping, Optional, List, Callable, Dict, Union
14
14
 
15
15
  import click
16
16
  from fastapi import FastAPI
@@ -57,6 +57,7 @@ def get_enhanced_fast_api_app(
57
57
  eval_storage_uri: Optional[str] = None,
58
58
  allow_origins: Optional[List[str]] = None,
59
59
  web: bool = True,
60
+ web_assets_dir: Optional[Union[str, Path]] = None,
60
61
  a2a: bool = False,
61
62
  programmatic_a2a: bool = False,
62
63
  programmatic_a2a_mount_base: str = "/a2a",
@@ -305,20 +306,53 @@ def get_enhanced_fast_api_app(
305
306
  tear_down_observer=tear_down_observer,
306
307
  )
307
308
 
308
- if web:
309
+ def _auto_find_web_assets() -> Optional[Path]:
309
310
  try:
310
- # Try to find ADK's web assets
311
- from google.adk.cli.fast_api import BASE_DIR
312
- ANGULAR_DIST_PATH = BASE_DIR / "browser"
313
- except (ImportError, AttributeError):
314
- # Fallback if ADK structure changes
315
- BASE_DIR = Path(__file__).parent.resolve()
316
- ANGULAR_DIST_PATH = BASE_DIR / "browser"
317
-
318
- if ANGULAR_DIST_PATH.exists():
319
- extra_fast_api_args.update(web_assets_dir=ANGULAR_DIST_PATH)
311
+ # Prefer importlib.resources so this works across ADK versions
312
+ import importlib.resources as r
313
+ try:
314
+ import google.adk.cli.fast_api as fast_api_pkg # type: ignore
315
+ base = r.files(fast_api_pkg)
316
+ candidates = [
317
+ base / "browser",
318
+ base / "static" / "browser",
319
+ ]
320
+ except Exception:
321
+ import google.adk.cli as cli_pkg # type: ignore
322
+ base = r.files(cli_pkg) / "fast_api"
323
+ candidates = [
324
+ base / "browser",
325
+ base / "static" / "browser",
326
+ ]
327
+ for p in candidates:
328
+ if p.exists() and (p / "index.html").exists():
329
+ # Convert to real filesystem Path if possible
330
+ try:
331
+ return Path(str(p))
332
+ except Exception:
333
+ continue
334
+ except Exception:
335
+ pass
336
+ # Fallback to local relative path (for dev builds of this package)
337
+ local = Path(__file__).parent / "browser"
338
+ if local.exists() and (local / "index.html").exists():
339
+ return local
340
+ return None
341
+
342
+ if web:
343
+ chosen: Optional[Path] = None
344
+ if web_assets_dir is not None:
345
+ p = Path(web_assets_dir)
346
+ if p.exists():
347
+ chosen = p
348
+ if chosen is None:
349
+ chosen = _auto_find_web_assets()
350
+ if chosen is not None:
351
+ extra_fast_api_args.update(web_assets_dir=chosen)
320
352
  else:
321
- logger.warning("Web UI assets not found, web interface will not be available")
353
+ logger.warning(
354
+ "Web UI assets not found; set web_assets_dir or install an ADK build that ships fast_api/browser"
355
+ )
322
356
 
323
357
  # Create FastAPI app
324
358
  app = adk_web_server.get_fast_api_app(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-adk-extras
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Production-ready services and FastAPI wiring for Google ADK
5
5
  Home-page: https://github.com/DeadMeme5441/google-adk-extras
6
6
  Author: DeadMeme5441