Skip to main content
Remote sync batches local ledger entries and uploads them to the platform ingest endpoint:
POST /api/v1/ingest/

Install

pip install "agentsentinel-sdk[remote]"
from agent_sentinel import enable_remote_sync, flush_and_stop

sync = enable_remote_sync(
    platform_url="https://platform.agentsentinel.dev",
    api_token="as_your_api_key_here",
    agent_id="my-agent",     # optional; tags every batched entry with this agent
    run_id=None,             # optional; auto-generated if None
    flush_interval=10.0,     # seconds between uploads
    auto_start=True,         # set False to defer the background thread until you call .start()
)

# If you want to query the run in the platform API:
print(sync.config.run_id)

# ... run your agent ...

flush_and_stop()

Parameters

ParameterDefaultPurpose
platform_urlrequiredPlatform base URL (e.g. https://api.agentsentinel.dev)
api_tokenrequiredJWT or API key
agent_idNoneTags every batched entry with this agent identifier
run_idauto-generatedLogical run grouping; pass an explicit ID for deterministic correlation
flush_interval10.0Seconds between batched uploads
auto_startTrueIf False, the returned BackgroundSync instance is created but the worker thread doesn’t start until you call sync.start()

Authentication

The SDK sends:
Authorization: Bearer <api_token>
The platform ingest route accepts:
  • JWT tokens (user sessions)
  • API keys (recommended for agents)

Operational behavior

  • Uploads are retried with exponential backoff (network/server errors).
  • Auth failures (401) are not retried.
  • If the platform is down, entries remain local and your agent continues.