netra-integration-patterns
SKILL.md
Netra Integration Patterns
Use this skill to choose a practical integration pattern and implement it with low-risk defaults.
Supported Scenarios
- RAG pipelines with vector DB + LLM instrumentation.
- FastAPI request handlers with context and guardrails.
- Multi-agent orchestration with workflow/agent decorators.
- Batch processing with per-item custom spans.
- Streaming responses with active span lifecycle through iteration.
Procedure
- Choose the closest scenario pattern.
- Initialize Netra once at startup with required instruments.
- Apply decorators to workflow boundaries.
- Add request context and security pipeline where needed.
- Add custom spans only for external boundaries not already covered.
- Validate traces for hierarchy and error visibility.
FastAPI Baseline Pattern
from fastapi import FastAPI
from netra import Netra
from netra.instrumentation.instruments import InstrumentSet
Netra.init(
app_name="fastapi-chatbot",
instruments={InstrumentSet.FASTAPI, InstrumentSet.OPENAI, InstrumentSet.REDIS},
)
app = FastAPI()
Express Baseline Pattern
import express from "express";
import { Netra, NetraInstruments } from "netra-sdk";
async function main() {
await Netra.init({
appName: "my-api",
headers: `x-api-key=${process.env.NETRA_API_KEY}`,
instruments: new Set([NetraInstruments.EXPRESS, NetraInstruments.OPENAI]),
});
const app = express();
app.use((req, _res, next) => {
if (req.headers["x-user-id"]) {
Netra.setUserId(req.headers["x-user-id"] as string);
}
if (req.headers["x-session-id"]) {
Netra.setSessionId(req.headers["x-session-id"] as string);
}
next();
});
app.listen(3000);
}
main();
Checklist
Netra.init()called exactly once at startup.- Instrument set matches all major providers/frameworks used.
- Request-level IDs are set for every incoming request.
- Security scanning and PII masking run before model execution.
References
Weekly Installs
1
Repository
keyvaluesoftwar…a-skillsFirst Seen
Today
Security Audits
Installed on
amp1
cline1
opencode1
cursor1
kimi-cli1
warp1