Installation
Install the Impraint Guard SDK and verify your setup.
Requirements
- Python 3.10 or newer
- An Impraint Guard API key. During beta, your Impraint contact gives you one when your organisation is set up. Keys start with
ig_live_(production) orig_test_(testing). A key is shown only once, so store it somewhere safe. - The provider or framework packages you want to track. The extras below install the supported ones for you.
Install the SDK
For the beta, install the beta extra. It adds everything the beta supports: Gemini, LangChain and LangGraph.
pip install "impraint-guard[beta]"The base install (pip install impraint-guard) contains only the core SDK. Add extras for what you use:
| Extra | Adds |
|---|---|
langchain | LangChain callback handler |
langgraph | LangGraph callback handler (graph-node steps) |
gemini | Raw google-genai tracking and langchain-google-genai |
beta | All of the above |
Use a virtual environment so Guard's dependencies stay isolated from your system Python.
Configure your API key
Keep the key out of source code. One simple way is an environment variable that you pass in yourself:
export IMPRAINT_API_KEY="your-api-key"import os
from impraint_guard import Guard
guard = Guard(api_key=os.environ["IMPRAINT_API_KEY"], agent_id="my-agent")The SDK does not read environment variables on its own, so you always pass the key to Guard(...).
Verify the install
import impraint_guard
print(impraint_guard.__version__)If this prints a version number (for example 0.1.0), you're ready for the Quickstart.
Troubleshooting
The package is installed under the name impraint-guard (hyphen) but imported as
impraint_guard (underscore). Confirm you installed into the same environment you are running
Python from: python -m pip show impraint-guard.
The API key was rejected. Check that you copied the whole key and that it is the live or test key your Impraint contact gave you. This error is raised even when fail-open is on, because a wrong key is a setup mistake, not an outage.
Your plan's agent limit has been reached (the free tier allows 3 agents). Upgrade your plan or
reuse an existing agent_id.
With fail_open=True (the default), Guard logs a warning and your agent keeps running. See
Core concepts.