Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.25 KB

File metadata and controls

46 lines (34 loc) · 1.25 KB

Quickstart

Wrap any function with @nullrun.protect to track its cost, tools, and behaviour, and let NullRun halt it when it goes off the rails.

from openai import OpenAI
import nullrun

nullrun.init(api_key="nr_live_...")
client = OpenAI()

@nullrun.protect
def answer(prompt: str) -> str:
    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": prompt}],
    )
    return response.choices[0].message.content

print(answer("What does NullRun do?"))

That's it — every call inside answer() is now cost-attributed and governed by your workspace policy.

What gets tracked

  • LLM tokens in and out
  • Cost in cents (per-call and aggregate)
  • Latency
  • Tool calls (if you use a framework integration)
  • Loop / retry patterns

What can go wrong

See Troubleshooting for the full table of expected behaviours (budget cap, loop, sensitive-tool, gateway down, kill/pause, etc.) and recovery steps.

Next