risicare
AI agent observability and error diagnosis for Python.
Monitor your AI agents in production. Trace every LLM call, detect errors automatically, and get AI-generated fix suggestions — with a single init().
Quickstart
pip install risicare
import risicare
from openai import OpenAI
# Initialize — auto-instruments all detected LLM providers
risicare.init(
api_key="rsk-...",
endpoint="https://app.risicare.ai",
)
client = OpenAI() # Automatically traced by risicare
@risicare.agent(name="research-agent")
def research(query: str) -> str:
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": query}],
)
return response.choices[0].message.content
result = research("What is quantum computing?")
risicare.shutdown()
That's it. Your agent's LLM calls, latency, token usage, and costs now appear in the Risicare dashboard.
Features
- Auto-instrumentation — Detects and patches LLM providers on
init(), zero code changes - 12 LLM providers — OpenAI, Anthropic, Google, Mistral, Groq, Cohere, Together, Ollama, HuggingFace, Cerebras, Bedrock, Vertex AI
- 8 host-detected — DeepSeek, xAI, Fireworks, Baseten, Novita, BytePlus, vLLM, and any OpenAI-compatible API via
base_url - 10 framework integrations — LangChain, LangGraph, CrewAI, AutoGen, Instructor, LlamaIndex, LiteLLM, DSPy, Pydantic AI, OpenAI Agents
- Error Diagnosis (beta) — LLM-powered root cause analysis with fix suggestions; auto-apply not yet wired (see "Error Diagnosis" section below)
- 13 built-in scorers — Faithfulness, relevance, toxicity, hallucination, and more
- Streaming support — Full streaming trace enrichment with token counts
- OpenTelemetry bridge — Compatible with existing OTel pipelines
- Non-blocking — All telemetry is async, never slows your app
LLM Providers
# Auto-patching (default) — detects installed providers automatically
risicare.init(api_key="rsk-...", endpoint="https://app.risicare.ai")
# Disable auto-patching if needed
risicare.init(api_key="rsk-...", endpoint="https://app.risicare.ai", auto_patch=False)
All 12 native providers:
| Provider | Package | Provider | Package |
|---|---|---|---|
| OpenAI | openai |
Anthropic | anthropic |
| Google Gemini | google-generativeai |
Mistral | mistralai |
| Cohere | cohere |
Groq | groq |
| Together AI | together |
Ollama | ollama |
| AWS Bedrock | boto3 |
Google Vertex AI | google-cloud-aiplatform |
| Cerebras | cerebras-cloud-sdk |
HuggingFace | huggingface-hub |
Plus 8 auto-detected via OpenAI base_url: DeepSeek, xAI, Fireworks, Baseten, Novita, BytePlus, vLLM, and any OpenAI-compatible API.
Framework Integrations
pip install risicare[langchain] # LangChain + LangGraph
pip install risicare[crewai] # CrewAI
pip install risicare[autogen] # AutoGen
pip install risicare[instructor] # Instructor
pip install risicare[litellm] # LiteLLM
pip install risicare[dspy] # DSPy
pip install risicare[pydantic-ai] # Pydantic AI
pip install risicare[llamaindex] # LlamaIndex
pip install risicare[all] # Everything
Core API
import risicare
risicare.init(api_key, endpoint) # Initialize (auto-patches providers)
risicare.shutdown(timeout_ms=5000) # Flush pending spans and close
@risicare.agent(name="my-agent") # Trace a function with agent identity
@risicare.trace # Trace any function (decorator or CM)
@risicare.session(session_id="sess-1") # Group traces into user sessions
risicare.report_error(exception) # Report caught errors for diagnosis
risicare.score(trace_id, "quality", 0.92) # Record evaluation score [0.0-1.0]
risicare.enable() / risicare.disable() # Runtime tracing control
risicare.is_enabled() # Check tracing status
Decision Phases
Structure your traces to see how your agent thinks, decides, and acts:
@risicare.agent(name="planner")
def plan(query: str):
@risicare.trace_think
def analyze():
return llm.chat("Analyze this query...")
@risicare.trace_decide
def choose_action(analysis):
return llm.chat("Pick the best action...")
@risicare.trace_act
def execute(action):
return run_tool(action)
analysis = analyze()
action = choose_action(analysis)
return execute(action)
Error Diagnosis
Beta status (2026-05): detect → diagnose → suggest is shipped and runs against Together.AI Llama-3.3-70B with a circuit-breaker / template-only fallback. Suggested fixes land in your dashboard as
status=draftfor human review. Automatic deployment, A/B rollout, and learning-from-outcomes (stages 4–6 in our docs) are in development and not yet wired in production. Treat this as AI-assisted error diagnosis today; auto-apply will follow.
When your agent fails, Risicare:
- Classifies the error (154 codes across TOOL, MEMORY, REASONING, OUTPUT, etc.)
- Diagnoses the root cause using AI analysis
- Generates a fix suggestion you can review in the dashboard and apply manually
try:
result = my_agent(user_input)
except Exception as e:
risicare.report_error(e) # Triggers diagnosis pipeline; fix lands as draft for review
Scoring & Evaluation
# Custom scores
risicare.score(trace_id="tr-123", name="quality", value=0.92)
# 13 built-in scorers available in the dashboard:
# faithfulness, answer_relevance, context_precision, context_recall,
# hallucination, toxicity, bias, coherence, conciseness,
# fluency, g_eval, goal_accuracy, summarization
OpenTelemetry
pip install risicare[otel]
risicare.init(api_key="rsk-...", otel_bridge=True)
# Compatible with any OTel-instrumented application
Known limitation — span loss during a backend outage
The SDK does not currently survive a sustained outage of the Risicare
backend, and the loss is silent to your application (it is logged, but nothing
raises and flush() will not fail your request path).
The HTTP exporter opens a circuit breaker after 5 consecutive failed export calls and holds it open for 60 seconds, returning failure immediately without touching the network. Queued spans get 3 re-queue attempts, which against an open breaker resolve in microseconds — so they are dropped — and for the remainder of the cooldown the SDK will not retry even after your backend is healthy again.
Measured, for a 1,000-span cohort emitted during the outage:
| outage | delivered |
|---|---|
| 4 s | 1000 / 1000 |
| 5 s | 500 / 1000 |
| 6 s + | 0 / 1000 |
The thresholds are counted in failed calls, not seconds — where the 5th consecutive failure falls in wall-clock time depends on your span rate and on how fast your endpoint fails. Treat the table as one measured shape, not a constant.
Nothing is lost on a clean shutdown(), and short blips that stay under the
5-failure threshold are fully survivable. Tracked as F-SDKBLIP-001.
A note on debug=True
debug=True attaches a console exporter in addition to any HTTP exporter.
That exporter writes every span attribute to stdout with no redaction — the
SDK performs none of its own, so prompts, completions and anything else you put
in attributes go to your console verbatim. It is a local-development switch, not
a diagnostic one.
If you are debugging a delivery problem ("spans are NOT reaching ..."), raise the SDK's logger instead. This prints the HTTP status and transport error and does not print span payloads:
import logging
logging.getLogger("risicare").setLevel(logging.DEBUG)
Measured for a failing export: the logger surfaces the transport error and emits
no span payload, while debug=True emits the payload and no HTTP status.
Requirements
- Python 3.10+
Documentation
Support
- Bug reports: github.com/Conscience-AI-Labs/risicare-ops/issues
- Email: support@risicare.ai
- Docs: risicare.ai/docs
During the public beta, please file detailed reproduction steps for any SDK or platform issue — fast feedback shapes GA.
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file risicare-0.2.0.tar.gz.
File metadata
- Download URL: risicare-0.2.0.tar.gz
- Upload date:
- Size: 277.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f37a403187379a0612464b71770b2f7d7d56d65cecaa78df56bb3921440004c
|
|
| MD5 |
64c778b8d2f61f5d7b9871f953a6a7e8
|
|
| BLAKE2b-256 |
dd5409975d995c9968b3ae39ebd8ff5b4d7b390822b8a3eb46257be13b42cfd0
|
File details
Details for the file risicare-0.2.0-py3-none-any.whl.
File metadata
- Download URL: risicare-0.2.0-py3-none-any.whl
- Upload date:
- Size: 239.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
869a5557f7f952b2c6e285264c744ef04add46da1ab04c40a6eff57eb3f478db
|
|
| MD5 |
f963a129fa00a4497d8253773df8c442
|
|
| BLAKE2b-256 |
0656af742d6cc21ac1ed690ba3bedec1871564a977465624fa48d0fcec05cde6
|