services
zocrates.utils.services ¶
Process-wide ADK session/artifact services shared by every serving surface.
get_artifact_service
cached
¶
Return the process-wide ADK artifact service (cached via functools.cache).
Uses GcsArtifactService when LOGS_BUCKET_NAME is set in the
environment, otherwise falls back to InMemoryArtifactService.
Returns:
| Type | Description |
|---|---|
BaseArtifactService
|
The active ADK artifact service instance. |
Source code in zocrates/utils/services.py
get_session_service ¶
Return the process-wide ADK session service, creating it if necessary.
Resolution priority
- If
zotero_data_diris provided, create aDatabaseSessionServicebacked by SQLite at<zotero_data_dir>/zocrates-data/sessions.dband store it as the module-level singleton. - If the singleton is already set, return it unchanged.
- If
GOOGLE_CLOUD_AGENT_ENGINE_IDis set, return aVertexAiSessionService. - Otherwise, return an
InMemorySessionService.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zotero_data_dir
|
Path | str | None
|
Path to the Zotero data directory. When provided, a new persistent session service is created and replaces any existing singleton. |
None
|
Returns:
| Type | Description |
|---|---|
BaseSessionService
|
The active ADK session service instance. |
Source code in zocrates/utils/services.py
reset_session_service ¶
Reset the cached session service instance (useful for testing or re-registration).