Installation
Imports
AsyncPikarc
The main client. Creates an underlyinghttpx.AsyncClient configured with your API key.
Parameters
Methods
run(user_id, metadata?)
Async context manager that starts a guarded run and auto-ends it on exit.
Lifecycle:
- On entry: calls
POST /v1/runs/and evaluates guardrails. RaisesPikarcBlockedErrorif denied. - On clean exit: calls
POST /v1/runs/{id}/endwith statusCOMPLETED. - On exception: calls
POST /v1/runs/{id}/endwith statusFAILED, then re-raises.
close()
Closes the underlying HTTP client. Call this when you’re done with the guard instance.
Async Only
The SDK is async-only for the MVP. All methods must be called withawait inside an async context. If you need sync usage, wrap calls with asyncio.run():