Quickstart
Start tracing your AI agents in 5 minutes. In Python, use one import and two environment variables.
Risicare is in closed beta
Access is by invitation. The link in your invitation email opens the sign-in page — start there rather than from the addresses on this page. The link does not sign you in by itself: sign in with the same email address the invitation was sent to, or it is not accepted. If a step here does not work for you during the beta, write to support@risicare.ai.
Get Risicare running in your project in under 5 minutes: sign in, get an API key, install the SDK, and send your first trace.
Prerequisites
Python:
- Python 3.10 or higher (the tests of the SDK run on 3.10, 3.11 and 3.12)
- An AI agent using OpenAI, Anthropic, or another supported provider
JavaScript/TypeScript:
- Node.js 18.0.0 or higher (the tests of the SDK run on Node.js 22)
- An AI agent using any of the 12 supported providers (OpenAI, Anthropic, Google, Mistral, Groq, Cohere, Together, Ollama, HuggingFace, Cerebras, Bedrock, Vercel AI)
Access is by invitation
Risicare is in private beta, and access is by invitation. A person who signs in without an invitation sees "Your account is awaiting approval." and cannot use the dashboard. If your organization is new to Risicare, request early access at risicare.ai; the Risicare team sets up your organization's first account and emails you an invitation. If your organization already uses Risicare, ask one of its owners or admins to invite you from Settings → Team.
Get an API key (takes 1 minute):
- Sign in at app.risicare.ai with GitHub or Google, using an account whose email address matches your invitation
- The first person to sign in to a new organization gets a default project and API key, created on that first sign-in. The key is shown once, in the Your API key card on the dashboard home page — click Copy, store the key, and click I've saved it before you leave that page
- Everyone else — you joined an organization that already has a project, or you missed the key on your home page: go to Settings → API Keys, click Create API Key, and copy the key from the dialog. It is also shown only once. Owners and admins can create keys; members and viewers cannot — ask an owner or admin to create a key for you. (Creating a key needs a recent sign-in — if you are asked to re-authenticate, sign in again and retry.)
Paste the key exactly as the dashboard shows it. Do not check its format in your code.
A new project's first key is an Ingest key, for your application. For risicare eval gate, evals.run, dataset import by key and the MCP server, make a Secret key in Settings → API Keys, and keep it out of your application.
A key is shown once
Risicare stores only a hash of each key, so the full key is shown exactly once — when it is created. Settings → API Keys lists your keys by their first characters and cannot show a key again. If you lose a key, create a new one and revoke the old one.
Multiple projects?
Need separate projects for different agents or teams? Owners and admins can click the project dropdown in the top nav → New Project. Each project gets its own API key, shown once in the dialog that opens after you create the project — copy it there. Creating a project needs a sign-in from the last 15 minutes. If the dialog tells you to sign in again, click Sign in again and retry. Use different keys to keep data isolated.
Installation
pip install risicarenpm install risicare openaiCheck that your key works (Python, optional)
Before instrumenting an agent, confirm the key with a short script. It sends one trace and needs no LLM provider:
export RISICARE_API_KEY=rsk-your-api-keyimport risicare
risicare.init() # reads RISICARE_API_KEY from the environment
@risicare.trace
def hello():
return "hello from risicare"
hello()
print(risicare.flush()) # True: the gateway accepted every span and scoreA trace named hello then appears on the Traces page of the project the key belongs to, usually within seconds. The last line shows the result of risicare.flush(). True means that the gateway accepted every span and score. When it is False, read risicare.get_metrics() (dropped_spans_by_reason, rejected_spans, failed_scores). An acknowledgement means that the span is queued, not that it is stored. With no API key the SDK sends nothing: init() logs one WARNING that says so, and flush() returns False.
The script exits normally even when the key is refused, so read what it prints. init() writes a line that begins [risicare] Tracing configured. It says what is set up. It does not say that spans arrive. A line beginning Risicare: spans are NOT reaching means the trace was not delivered. It names the HTTP status and gives the next step: it answered HTTP 401 means that the key is invalid or was not copied in full. For the next step of each status, see What the outage WARNING says for each answer. Keys are shown only once, so if you did not save yours, create a new one. If that line does not appear but the trace is still missing, check that the project selector shows the project the key belongs to.
To check the key, the endpoint and the network in one run, use risicare doctor. It sends a test span, and it exits with code 0 only when the gateway accepted that span. See Check Your Setup. The command is in the Python SDK. The JavaScript SDK does not have it yet.
Tier 0: One Import, No Configuration
The fastest way to start: set two environment variables and add a single import at the top
of your entrypoint. You configure nothing, and you do not change your agent logic.
export RISICARE_API_KEY=rsk-your-api-key
export RISICARE_TRACING=trueimport risicare # the one line you add — this installs the import hooks
from openai import OpenAI
client = OpenAI()
# ... your existing agent code, unchanged ...python your_agent.pyEvery OpenAI call made after that import is traced automatically.
The import is required — environment variables alone trace nothing
RISICARE_TRACING=true is read by the SDK when the SDK is imported. The package installs
no .pth file and no sitecustomize hook, and its console script risicare does not start
your program, so a python your_agent.py
that never imports risicare loads no instrumentation and sends zero spans — with no
error and no warning, just an empty dashboard.
When both variables are set and risicare is imported, the SDK prints a startup line like
[risicare] Tracing configured — endpoint: https://ingest.risicare.ai, service: (default). Delivery is not checked yet: a WARNING follows if the endpoint refuses the key or cannot be reached.
If you do not see that line, one of these is true: risicare was not imported,
RISICARE_API_KEY is not set, RISICARE_TRACING is not set to true, or
RISICARE_DEBUG is on. The line shows what is configured. It does not show that
spans arrive: the SDK sends nothing at that time. If the endpoint refuses the key or
cannot be reached, a WARNING follows. To check delivery now, run risicare doctor
(see Check Your Setup).
How it works
Importing risicare with RISICARE_TRACING=true installs import hooks. The order of your
imports does not matter. risicare.init() (or import risicare with RISICARE_TRACING=true)
traces a supported library that your program imported already, and one that it imports later
with an import statement. No risicare.init() call is needed — the SDK reads its
configuration from the environment.
JavaScript requires explicit initialization
This tier is Python-only. The JavaScript SDK requires init() + patchOpenAI() — see Tier 1 below.
What You'll See
After running your agent, open the Risicare Dashboard. Traces usually appear within seconds. They can take longer when the platform is under load.
Each trace shows:
- Complete execution flow — Every LLM call, tool use, and decision point
- Token usage & cost — Automatic conversion to USD per model (OpenAI, Anthropic, etc.)
- Prompts, completions and tool-call arguments — on by default (Python 0.7.0 and npm 0.10.0 and later). To turn off capture of request and response text, set
RISICARE_TRACE_CONTENT=false(ortrace_content=False; npm:traceContent: false) - Timing breakdown — Latency per span, total trace duration
- Error detection — An exception that leaves a traced call is recorded on its span and gets a code from the error taxonomy. A traced call is a decorated function, a
with trace(...)block or a provider call that is not a stream. A wrong answer with no exception is not flagged. The frameworks page lists what each framework captures
Owners and admins can also turn off content capture for a whole project with the Content capture switch in Settings → General.
Minimum data needed
Tier 0 adds no decorators, so a trace appears only once your agent makes a call Risicare instruments — an LLM call, for example. If you don't see traces, check that:
- The startup line
[risicare] Tracing configured — ...was printed. It shows what is configured, not that spans arrive - Your API key is set in the environment of the process that runs your agent. This command prints only
setornot set, never the key:test -n "$RISICARE_API_KEY" && echo set || echo not set. In any shell, also on Windows, usepython -c "import os; print('set' if os.environ.get('RISICARE_API_KEY') else 'not set')". Do not print the key itself, because a terminal log or a shared screen can show it.risicare doctorsends a test span and checks that the gateway accepts the key - Your agent actually calls an LLM (OpenAI, Anthropic, etc.)
- The SDK is installed:
pip show risicare risicare doctorends with exit code 0 (see Check Your Setup)
Tier 1: Explicit Configuration
For more control—and to group related LLM calls into a single trace—use risicare.init() with @trace:
import risicare
from risicare import trace
risicare.init( # reads RISICARE_API_KEY from the environment
environment="development",
service_name="my-agent",
)
from openai import OpenAI
client = OpenAI()
# @trace groups all LLM calls inside into a single trace
@trace
def analyze(query: str):
context = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": f"Research: {query}"}],
)
summary = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": f"Summarize: {context.choices[0].message.content}"}],
)
return summary.choices[0].message.content
result = analyze("What is quantum computing?")import { init, agent, flush } from 'risicare';
import { patchOpenAI } from 'risicare/openai';
import OpenAI from 'openai';
init({
// the key comes from RISICARE_API_KEY: do not pass it here
environment: 'development',
serviceName: 'my-agent',
});
const openai = patchOpenAI(new OpenAI());
// agent() groups all LLM calls inside into a single trace
const analyze = agent({ name: 'analyzer' }, async (query: string) => {
const context = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: `Research: ${query}` }],
});
const summary = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: `Summarize: ${context.choices[0].message.content}` }],
});
return summary.choices[0].message.content;
});
const result = await analyze('quantum computing');
console.log(await flush()); // true: the gateway accepted every span and scoreWithout @trace, each LLM call is a separate trace
If you skip @trace, every LLM call appears as an independent trace in the dashboard.
Use @trace (decorator) or with trace("name"): (context manager) to group related calls.
Error Handling
Errors inside traced functions are automatically captured with full exception details:
import risicare
from risicare import trace
risicare.init() # reads RISICARE_API_KEY from the environment
from openai import OpenAI
client = OpenAI()
@trace
def risky_operation(query: str):
# An exception raised here is recorded on the trace, then re-raised to you
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": query}],
)
return response.choices[0].message.content
try:
risky_operation("What is quantum computing?")
finally:
risicare.flush() # waits for the gateway, also after a failureThe end of a script: which call to make
- A normal exit sends the queued spans: a Python script that ends by itself, or a Node.js process whose event loop empties. The SDK drains its queue at the exit.
- A process that does not end in the normal way does not drain:
os._exit(), aprocess.exit()that your code calls at once, a serverless handler whose process is frozen after the invocation, and a hard kill (SIGKILL). Callflush()(JavaScript:await flush()) before such an end. - To see that the spans arrived, call
risicare.flush()as the last line (JavaScript:await flush()). It returnsTrue(JavaScript:true) when the gateway accepted every span and score. This is the only call that tells you. - Call
shutdown()only where the process ends and you want to stop the SDK. Aftershutdown(), the SDK makes no more spans in this process untilinit()runs again. - In code that runs more than once (a request handler, a serverless invocation, a job in a pool), call
flush(), nevershutdown(). - A process that ends with
os._exit()runs no exit handler. Amultiprocessingchild, such as a pool worker, can end without it. Callflush()before such a process ends, or at the end of each task.
Reporting caught exceptions
An exception that leaves a traced function, a with trace(...) block or a traced model call is recorded on that span, and then raised again to your code. You call nothing for it.
For an exception that you catch and do not raise again, when no traced call raised it, call report_error(). It records the exception as a child step of the current span, named error:<Type>:
import json
from risicare import report_error
try:
data = json.loads(answer) # plain code, not a traced call
except json.JSONDecodeError as e:
report_error(e) # Records the error and classifies it against the taxonomy
data = {} # Handle gracefullyDo not call report_error() for an exception that already left a traced call. That span has it. If you call it, the exception is recorded a second time, as a child step of the span that is current when you catch it. report_error() does not change the status of the current span, and the run does not read "ended in error" for it (since Python 0.16.0).
The error gets a code from the 154-code taxonomy as it is recorded (the SDK assigns a subset of the codes — see Error Taxonomy). Root-cause analysis and ranked fix suggestions are held for the beta — see Diagnose for what runs today.
Tier 2: Agent Identity
Add agent identity to your code:
import risicare
from risicare import agent
risicare.init()
from openai import OpenAI
client = OpenAI()
@agent(name="planner", role="orchestrator")
def plan_task(objective: str):
# This function is now traced as an agent
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": f"Plan: {objective}"}]
)
return response.choices[0].message.contentimport { agent } from 'risicare';
import { patchOpenAI } from 'risicare/openai';
import OpenAI from 'openai';
// Call init() first, as in Tier 1
const openai = patchOpenAI(new OpenAI());
const planTask = agent(
{ name: 'planner', role: 'orchestrator' },
async (objective: string) => {
const response = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: `Plan: ${objective}` }],
});
return response.choices[0].message.content;
}
);To trace the tool functions of your agent, see Trace your own tool function.
View Your Traces
Open the Risicare Dashboard to see:
- Traces: Complete execution flows with timing
- Spans: Individual LLM calls — with prompts and completions when content capture is on
- Cost: Token usage and cost, grouped by model and other fields, on the Cost page
- Errors: Exceptions that leave a traced call, with an error code from the taxonomy
Next Steps
Progressive Integration
Learn about Tiers 3-5 for sessions, phases, and multi-agent support
SDK Configuration
Full configuration options and environment variables
Error Taxonomy
How an exception gets an error code, and which codes the SDK assigns
Self-Healing
Root-cause analysis and fix recommendations — built, and held for the beta
Production & Failure Modes
Before you deploy: outage behavior, fork safety, and what you lose