Use with OpenAI Agents
Install:
Wrap the Runner.run_sync call (or any sync / async runner) with
@protect:
openai_agents_protect.py
from agents import Agent, Runner
from nullrun import init, protect
init(api_key="nr_live_...")
@protect
def ask(prompt: str) -> str:
agent = Agent(
name="assistant",
instructions="Answer in one sentence.",
)
result = Runner.run_sync(agent, prompt)
return result.final_output
print(ask("What is the capital of France?"))
@protect tracks every tool call the agent makes and halts the run
if the workflow exceeds budget, hits a sensitive tool, or is
rate-limited by the policy. Loop detection is not part of the
shipped gate surface — it lives in aggregate_policies() as an enum
arm but is not wired into a dedicated detection path.