Skip to main content

stillrunning-sdk

Monitoring for any Python job, agent, or script, in one line.

Decorate or wrap your code and StillRunning gets a ping on success or failure with the run's duration, plus optional cost, tokens, and model. Get alerted the moment a cron job stops, an agent fails, or a script runs too long or costs too much, with no ping plumbing. Works with LangChain, CrewAI, agent scripts, Celery/RQ workers, and plain cron jobs.

pip install stillrunning-sdk

30-second quickstart

  1. Create a workflow at stillrunning.ai/app/new and copy its token.

  2. export STILLRUNNING_TOKEN=your_token_here

  3. Monitor your work:

    from stillrunning_sdk import StillRunning
    
    sr = StillRunning()  # reads STILLRUNNING_TOKEN
    
    @sr.monitor
    def nightly_job():
        ...
    

Every call to nightly_job is now timed and reported, success on return, failure on exception (re-raised untouched).

Three ways to use it

Decorator , monitor a function:

@sr.monitor
def sync_customers():
    ...

Context manager , attach AI metrics inside the block:

with sr.track() as run:
    result = call_agent(prompt)
    run.meta(tokens_in=result.usage.input, tokens_out=result.usage.output, model="gpt-4o")
    # model + tokens -> costUsd estimated automatically

Run a callable , inline:

answer = sr.run(lambda: call_agent(prompt), meta={"model": "claude-sonnet-4", "tokens_in": 1200})

Heartbeats and manual pings

For a cron job that just needs to say "I ran", or when you can't wrap the work:

sr.heartbeat()                          # bare success ping
sr.ping(event="start", traceId="...")   # low-level: success | fail | start | log

Cost estimation

Give model plus token counts and cost is estimated from a built-in pricing table (Claude / GPT / Gemini). It's approximate, it powers relative cost-anomaly detection and a ballpark spend figure. Pass an explicit cost_usd for exact accounting, or extend the table:

from stillrunning_sdk import register_model_pricing
register_model_pricing([(r"my-custom-model", (1.5, 6.0))])  # USD per 1M (input, output) tokens

Unknown models simply send no cost rather than a wrong one.

Grouping multi-step runs with with_trace

from stillrunning_sdk import StillRunning, with_trace
sr = StillRunning()

with with_trace():
    sr.run(plan_step)
    sr.run(execute_step)   # both pings share one trace_id

Configuration

StillRunning(
    token=None,        # defaults to env STILLRUNNING_TOKEN
    base_url="https://stillrunning.ai",
    timeout=3.0,       # seconds; bounds each ping so a slow StillRunning never hangs your job
    await_ping=True,   # False = fire-and-forget in a daemon thread (lowest latency)
    on_error=None,     # callable(Exception) -> observe ping delivery failures
    transport=None,    # custom transport (testing / non-urllib runtimes)
)

Monitoring never raises into your code: a failed ping routes to on_error and is otherwise swallowed.

Requirements

Python 3.9+. No runtime dependencies (uses the standard library).

License

MIT

Release files for stillrunning-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stillrunning-sdk 0.1.0
File Size Uploaded
stillrunning_sdk-0.1.0.tar.gz 17.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stillrunning-sdk 0.1.0
File Interpreter ABI Platform
stillrunning_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.0 kB

Release files / stillrunning_sdk-0.1.0.tar.gz

Download URL stillrunning_sdk-0.1.0.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
502c900a3a15ad1135039fbad81bd89d5d433eeff4ee67aea85cdc35a074de05
BLAKE2b-256 checksum
How to use checksums
f2f8531e2502c4d6d4ea61e656db0d655b0a774230741470ee61f51e6a0771d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / stillrunning_sdk-0.1.0-py3-none-any.whl

Download URL stillrunning_sdk-0.1.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05573c9ab78b7446ba8b77b76e87065f1d701ccc96c39e6c1549432ffa3b031f
BLAKE2b-256 checksum
How to use checksums
00bea84c6732acd52d4bdea852b4ab8f31121d26ab6d71894045105a679218d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page