Skip to content

Commit c50518b

Browse files
committed
local storage first
1 parent b1a7d33 commit c50518b

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def main():
4141
# If api_key is Pro/Enterprise, uses CloudTraceSink
4242
# If api_key is missing/invalid, falls back to local JsonlTraceSink
4343
run_id = "cloud-tracing-demo"
44-
tracer = create_tracer(api_key=sentience_key, run_id=run_id)
44+
# local storage tracer, is upload_tracer is True and api_key is provided, will upload to cloud
45+
tracer = create_tracer(api_key=sentience_key, run_id=run_id, upload_trace=False)
4546

4647
print(f"🆔 Run ID: {run_id}\n")
4748

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "sentienceapi"
7-
version = "0.90.5"
7+
version = "0.90.7"
88
description = "Python SDK for Sentience AI Agent Browser Automation"
99
readme = "README.md"
1010
requires-python = ">=3.11"

sentience/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
)
7171
from .wait import wait_for
7272

73-
__version__ = "0.90.5"
73+
__version__ = "0.90.7"
7474

7575
__all__ = [
7676
# Core SDK

sentience/tracer_factory.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def create_tracer(
2323
run_id: str | None = None,
2424
api_url: str | None = None,
2525
logger: SentienceLogger | None = None,
26+
upload_trace: bool = False,
2627
) -> Tracer:
2728
"""
2829
Create tracer with automatic tier detection.
@@ -38,6 +39,9 @@ def create_tracer(
3839
run_id: Unique identifier for this agent run. If not provided, generates UUID.
3940
api_url: Sentience API base URL (default: https://api.sentienceapi.com)
4041
logger: Optional logger instance for logging file sizes and errors
42+
upload_trace: Enable cloud trace upload (default: False). When True and api_key
43+
is provided, traces will be uploaded to cloud. When False, traces
44+
are saved locally only.
4145
4246
Returns:
4347
Tracer configured with appropriate sink
@@ -62,12 +66,12 @@ def create_tracer(
6266
if api_url is None:
6367
api_url = SENTIENCE_API_URL
6468

65-
# 0. Check for orphaned traces from previous crashes (if api_key provided)
66-
if api_key:
69+
# 0. Check for orphaned traces from previous crashes (if api_key provided and upload enabled)
70+
if api_key and upload_trace:
6771
_recover_orphaned_traces(api_key, api_url)
6872

69-
# 1. Try to initialize Cloud Sink (Pro/Enterprise tier)
70-
if api_key:
73+
# 1. Try to initialize Cloud Sink (Pro/Enterprise tier) if upload enabled
74+
if api_key and upload_trace:
7175
try:
7276
# Request pre-signed upload URL from backend
7377
response = requests.post(

0 commit comments

Comments
 (0)