opencode-skills-collection 4.0.68 → 4.0.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled-skills/.antigravity-install-manifest.json +304 -1
- package/bundled-skills/access-review/SKILL.md +394 -0
- package/bundled-skills/access-review/references/details.md +121 -0
- package/bundled-skills/agent-evals/SKILL.md +420 -0
- package/bundled-skills/agent-observability/SKILL.md +346 -0
- package/bundled-skills/agent-observability/references/details.md +786 -0
- package/bundled-skills/ai-agent-security/SKILL.md +393 -0
- package/bundled-skills/ai-agent-security/references/details.md +912 -0
- package/bundled-skills/ai-coding-agent-guardrails/SKILL.md +442 -0
- package/bundled-skills/ai-coding-agent-guardrails/references/details.md +753 -0
- package/bundled-skills/ai-inference-service-mesh/SKILL.md +449 -0
- package/bundled-skills/ai-pipeline-orchestration/SKILL.md +287 -0
- package/bundled-skills/ai-red-teaming/SKILL.md +409 -0
- package/bundled-skills/ai-security-hardening/SKILL.md +343 -0
- package/bundled-skills/ai-sre-incident-response/SKILL.md +336 -0
- package/bundled-skills/alerting-oncall/SKILL.md +458 -0
- package/bundled-skills/alerting-oncall/references/details.md +84 -0
- package/bundled-skills/api-integration-architect/SKILL.md +241 -0
- package/bundled-skills/apify-generate-output-schema/SKILL.md +438 -0
- package/bundled-skills/apify-integration-development/SKILL.md +168 -0
- package/bundled-skills/apify-integration-development/references/ai-framework-package.md +158 -0
- package/bundled-skills/apify-integration-development/references/ai-harness-plugin.md +192 -0
- package/bundled-skills/apify-integration-development/references/sdk-integration.md +236 -0
- package/bundled-skills/apify-integration-development/references/workflow-automation.md +163 -0
- package/bundled-skills/apk-redteam-pipeline/SKILL.md +446 -0
- package/bundled-skills/architecture-review/README.md +42 -0
- package/bundled-skills/architecture-review/SKILL.md +77 -0
- package/bundled-skills/architecture-review/examples.md +11 -0
- package/bundled-skills/architecture-review/reference/best-practices.md +7 -0
- package/bundled-skills/architecture-review/reference/capabilities.md +20 -0
- package/bundled-skills/architecture-review/reference/fallbacks.md +11 -0
- package/bundled-skills/architecture-review/reference/graph.md +15 -0
- package/bundled-skills/architecture-review/reference/mcp.md +14 -0
- package/bundled-skills/architecture-review/reference/workflow.md +15 -0
- package/bundled-skills/architecture-review/templates/architecture-review.md +21 -0
- package/bundled-skills/argocd-gitops/SKILL.md +469 -0
- package/bundled-skills/arm-templates/SKILL.md +438 -0
- package/bundled-skills/arm-templates/references/details.md +64 -0
- package/bundled-skills/asset-inventory/SKILL.md +412 -0
- package/bundled-skills/asset-inventory/references/details.md +127 -0
- package/bundled-skills/audit-logging/SKILL.md +476 -0
- package/bundled-skills/aws-cloudtrail/SKILL.md +486 -0
- package/bundled-skills/aws-cost-optimization/SKILL.md +331 -0
- package/bundled-skills/aws-ec2/SKILL.md +426 -0
- package/bundled-skills/aws-ecs-fargate/SKILL.md +388 -0
- package/bundled-skills/aws-iam/SKILL.md +463 -0
- package/bundled-skills/aws-lambda/SKILL.md +428 -0
- package/bundled-skills/aws-rds/SKILL.md +380 -0
- package/bundled-skills/aws-s3/SKILL.md +434 -0
- package/bundled-skills/aws-secrets-manager/SKILL.md +486 -0
- package/bundled-skills/aws-vpc/SKILL.md +436 -0
- package/bundled-skills/azure-ai-document-intelligence-ts/SKILL.md +1 -1
- package/bundled-skills/azure-aks/SKILL.md +423 -0
- package/bundled-skills/azure-devops/SKILL.md +457 -0
- package/bundled-skills/azure-functions-devsec/SKILL.md +436 -0
- package/bundled-skills/azure-keyvault/SKILL.md +455 -0
- package/bundled-skills/azure-keyvault/references/details.md +83 -0
- package/bundled-skills/azure-monitor-audit/SKILL.md +379 -0
- package/bundled-skills/azure-networking/SKILL.md +448 -0
- package/bundled-skills/azure-networking/references/details.md +135 -0
- package/bundled-skills/azure-sql/SKILL.md +413 -0
- package/bundled-skills/azure-sql/references/details.md +113 -0
- package/bundled-skills/azure-vms/SKILL.md +402 -0
- package/bundled-skills/azure-vms/references/details.md +134 -0
- package/bundled-skills/backup-recovery/SKILL.md +388 -0
- package/bundled-skills/bb-methodology/SKILL.md +451 -0
- package/bundled-skills/bb-methodology/references/details.md +120 -0
- package/bundled-skills/block-storage/SKILL.md +371 -0
- package/bundled-skills/blue-green-deploy/SKILL.md +453 -0
- package/bundled-skills/blue-green-deploy/references/details.md +90 -0
- package/bundled-skills/bug-bounty/SKILL.md +447 -0
- package/bundled-skills/bug-bounty/references/details.md +1316 -0
- package/bundled-skills/bugcrowd-reporting/SKILL.md +351 -0
- package/bundled-skills/business-continuity/SKILL.md +463 -0
- package/bundled-skills/career-ops/SKILL.md +186 -0
- package/bundled-skills/cdn-setup/SKILL.md +374 -0
- package/bundled-skills/change-management/SKILL.md +438 -0
- package/bundled-skills/change-management/references/details.md +105 -0
- package/bundled-skills/circleci/SKILL.md +475 -0
- package/bundled-skills/cis-benchmarks/SKILL.md +150 -0
- package/bundled-skills/cloudflare-pages/SKILL.md +318 -0
- package/bundled-skills/cloudflare-r2/SKILL.md +353 -0
- package/bundled-skills/cloudflare-workers/SKILL.md +415 -0
- package/bundled-skills/cloudflare-zero-trust/SKILL.md +361 -0
- package/bundled-skills/cloudformation/SKILL.md +461 -0
- package/bundled-skills/code-review-sensei/SKILL.md +177 -0
- package/bundled-skills/codebase-onboarding/README.md +42 -0
- package/bundled-skills/codebase-onboarding/SKILL.md +77 -0
- package/bundled-skills/codebase-onboarding/examples.md +11 -0
- package/bundled-skills/codebase-onboarding/reference/best-practices.md +7 -0
- package/bundled-skills/codebase-onboarding/reference/capabilities.md +20 -0
- package/bundled-skills/codebase-onboarding/reference/fallbacks.md +11 -0
- package/bundled-skills/codebase-onboarding/reference/graph.md +15 -0
- package/bundled-skills/codebase-onboarding/reference/mcp.md +14 -0
- package/bundled-skills/codebase-onboarding/reference/workflow.md +15 -0
- package/bundled-skills/codebase-onboarding/templates/repository-onboarding.md +21 -0
- package/bundled-skills/connection-auth-rules/SKILL.md +199 -0
- package/bundled-skills/connection-auth-rules/fetch_schema.py +320 -0
- package/bundled-skills/constraint-driven-development/SKILL.md +335 -0
- package/bundled-skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/bundled-skills/container-hardening/SKILL.md +126 -0
- package/bundled-skills/container-registries/SKILL.md +435 -0
- package/bundled-skills/container-scanning/SKILL.md +416 -0
- package/bundled-skills/convex-backend/SKILL.md +338 -0
- package/bundled-skills/dast-scanning/SKILL.md +437 -0
- package/bundled-skills/database-backups/SKILL.md +425 -0
- package/bundled-skills/datadog/SKILL.md +487 -0
- package/bundled-skills/dependency-analysis/README.md +42 -0
- package/bundled-skills/dependency-analysis/SKILL.md +76 -0
- package/bundled-skills/dependency-analysis/examples.md +11 -0
- package/bundled-skills/dependency-analysis/reference/best-practices.md +7 -0
- package/bundled-skills/dependency-analysis/reference/capabilities.md +20 -0
- package/bundled-skills/dependency-analysis/reference/fallbacks.md +11 -0
- package/bundled-skills/dependency-analysis/reference/graph.md +15 -0
- package/bundled-skills/dependency-analysis/reference/mcp.md +14 -0
- package/bundled-skills/dependency-analysis/reference/workflow.md +15 -0
- package/bundled-skills/dependency-analysis/templates/dependency-review.md +21 -0
- package/bundled-skills/dependency-scanning/SKILL.md +457 -0
- package/bundled-skills/devcontainers-nix/SKILL.md +416 -0
- package/bundled-skills/devops-pipeline-builder/SKILL.md +200 -0
- package/bundled-skills/disaster-recovery/SKILL.md +374 -0
- package/bundled-skills/disaster-recovery/references/details.md +219 -0
- package/bundled-skills/dns-management/SKILL.md +375 -0
- package/bundled-skills/docker-compose/SKILL.md +482 -0
- package/bundled-skills/docker-management/SKILL.md +426 -0
- package/bundled-skills/eas-app-stores/SKILL.md +197 -0
- package/bundled-skills/eas-app-stores/agents/openai.yaml +4 -0
- package/bundled-skills/eas-app-stores/references/app-store-metadata.md +497 -0
- package/bundled-skills/eas-app-stores/references/ios-app-store.md +376 -0
- package/bundled-skills/eas-app-stores/references/native-ios.md +167 -0
- package/bundled-skills/eas-app-stores/references/play-store.md +244 -0
- package/bundled-skills/eas-app-stores/references/testflight.md +62 -0
- package/bundled-skills/eas-app-stores/references/workflows.md +120 -0
- package/bundled-skills/eas-hosting/SKILL.md +448 -0
- package/bundled-skills/eas-hosting/agents/openai.yaml +4 -0
- package/bundled-skills/eas-observe/SKILL.md +75 -0
- package/bundled-skills/eas-observe/agents/openai.yaml +4 -0
- package/bundled-skills/eas-observe/references/metrics.md +98 -0
- package/bundled-skills/eas-observe/references/queries.md +403 -0
- package/bundled-skills/eas-observe/references/setup.md +476 -0
- package/bundled-skills/eas-observe/references/third-party.md +136 -0
- package/bundled-skills/eas-simulator/SKILL.md +251 -0
- package/bundled-skills/eas-simulator/agents/openai.yaml +4 -0
- package/bundled-skills/eas-simulator/references/controllers.md +135 -0
- package/bundled-skills/eas-simulator/references/run-your-app.md +240 -0
- package/bundled-skills/eas-simulator/references/troubleshooting.md +47 -0
- package/bundled-skills/eas-workflows/SKILL.md +119 -0
- package/bundled-skills/eas-workflows/agents/openai.yaml +4 -0
- package/bundled-skills/eas-workflows/scripts/fetch.js +109 -0
- package/bundled-skills/ebpf-observability/SKILL.md +436 -0
- package/bundled-skills/ebpf-observability/references/details.md +542 -0
- package/bundled-skills/elk-stack/SKILL.md +487 -0
- package/bundled-skills/enterprise-vpn-attack/SKILL.md +395 -0
- package/bundled-skills/evidence-hygiene/SKILL.md +404 -0
- package/bundled-skills/expo-animation/LICENSE +21 -0
- package/bundled-skills/expo-animation/RECIPES.md +385 -0
- package/bundled-skills/expo-animation/SKILL.md +295 -0
- package/bundled-skills/expo-animation/agents/openai.yaml +4 -0
- package/bundled-skills/fact-check-x-unified/SKILL.md +178 -0
- package/bundled-skills/fact-check-x-unified/agents/openai.yaml +4 -0
- package/bundled-skills/fact-check-x-unified/references/acceptance-criteria.md +44 -0
- package/bundled-skills/fact-check-x-unified/references/contracts.md +39 -0
- package/bundled-skills/fact-check-x-unified/scripts/common.py +31 -0
- package/bundled-skills/fact-check-x-unified/scripts/fact_check_x.py +1832 -0
- package/bundled-skills/fact-check-x-unified/scripts/trusted_search_config.py +324 -0
- package/bundled-skills/fact-check-x-unified/tests/anchor_downgrade_test.py +90 -0
- package/bundled-skills/fact-check-x-unified/tests/multi_platform_test.py +369 -0
- package/bundled-skills/fact-check-x-unified/tests/smoke_test.py +740 -0
- package/bundled-skills/fact-check-x-unified/tests/stage_checkpoint_test.py +103 -0
- package/bundled-skills/fact-check-x-unified/tests/trusted_search_config_test.py +156 -0
- package/bundled-skills/feature-flags/SKILL.md +426 -0
- package/bundled-skills/feature-flags/references/details.md +86 -0
- package/bundled-skills/fedramp-compliance/SKILL.md +453 -0
- package/bundled-skills/firebase-app-platform/SKILL.md +381 -0
- package/bundled-skills/firewall-config/SKILL.md +479 -0
- package/bundled-skills/gcp-audit-logs/SKILL.md +452 -0
- package/bundled-skills/gcp-audit-logs/references/details.md +56 -0
- package/bundled-skills/gcp-cloud-functions/SKILL.md +284 -0
- package/bundled-skills/gcp-cloud-sql/SKILL.md +277 -0
- package/bundled-skills/gcp-compute/SKILL.md +319 -0
- package/bundled-skills/gcp-gke/SKILL.md +307 -0
- package/bundled-skills/gcp-networking/SKILL.md +293 -0
- package/bundled-skills/gcp-secret-manager/SKILL.md +421 -0
- package/bundled-skills/gcp-secret-manager/references/details.md +131 -0
- package/bundled-skills/gdpr-compliance/SKILL.md +451 -0
- package/bundled-skills/gdpr-compliance/references/details.md +145 -0
- package/bundled-skills/geo-audit/SKILL.md +368 -0
- package/bundled-skills/geo-brand-mentions/SKILL.md +68 -0
- package/bundled-skills/geo-brand-mentions/references/details.md +471 -0
- package/bundled-skills/geo-citability/SKILL.md +350 -0
- package/bundled-skills/geo-compare/SKILL.md +340 -0
- package/bundled-skills/geo-content/SKILL.md +383 -0
- package/bundled-skills/geo-crawlers/SKILL.md +408 -0
- package/bundled-skills/geo-llmstxt/SKILL.md +464 -0
- package/bundled-skills/geo-platform-optimizer/SKILL.md +314 -0
- package/bundled-skills/geo-proposal/SKILL.md +378 -0
- package/bundled-skills/geo-prospect/SKILL.md +225 -0
- package/bundled-skills/geo-report/SKILL.md +436 -0
- package/bundled-skills/geo-report-pdf/SKILL.md +157 -0
- package/bundled-skills/geo-schema/SKILL.md +408 -0
- package/bundled-skills/geo-technical/SKILL.md +78 -0
- package/bundled-skills/geo-technical/references/details.md +543 -0
- package/bundled-skills/git-workflow/SKILL.md +460 -0
- package/bundled-skills/github-actions/SKILL.md +368 -0
- package/bundled-skills/gitlab-ci/SKILL.md +340 -0
- package/bundled-skills/gpt-taste/SKILL.md +8 -1
- package/bundled-skills/gpu-kubernetes-operations/SKILL.md +468 -0
- package/bundled-skills/gpu-server-management/SKILL.md +236 -0
- package/bundled-skills/hashicorp-vault/SKILL.md +408 -0
- package/bundled-skills/helm-charts/SKILL.md +469 -0
- package/bundled-skills/hf-cli/SKILL.md +263 -0
- package/bundled-skills/hipaa-compliance/SKILL.md +451 -0
- package/bundled-skills/huggingface-community-evals/SKILL.md +228 -0
- package/bundled-skills/huggingface-community-evals/examples/.env.example +3 -0
- package/bundled-skills/huggingface-community-evals/examples/USAGE_EXAMPLES.md +101 -0
- package/bundled-skills/huggingface-community-evals/scripts/inspect_eval_uv.py +104 -0
- package/bundled-skills/huggingface-community-evals/scripts/inspect_vllm_uv.py +306 -0
- package/bundled-skills/huggingface-community-evals/scripts/lighteval_vllm_uv.py +297 -0
- package/bundled-skills/huggingface-datasets/SKILL.md +130 -0
- package/bundled-skills/hunt-aspnet/SKILL.md +321 -0
- package/bundled-skills/hunt-ato/SKILL.md +184 -0
- package/bundled-skills/hunt-auth-bypass/SKILL.md +426 -0
- package/bundled-skills/hunt-auth-bypass/references/details.md +80 -0
- package/bundled-skills/hunt-brute-force/SKILL.md +341 -0
- package/bundled-skills/hunt-business-logic/SKILL.md +281 -0
- package/bundled-skills/hunt-cache-poison/SKILL.md +382 -0
- package/bundled-skills/hunt-captcha-bypass/SKILL.md +136 -0
- package/bundled-skills/hunt-cicd/SKILL.md +311 -0
- package/bundled-skills/hunt-clickjacking/SKILL.md +110 -0
- package/bundled-skills/hunt-cors/SKILL.md +335 -0
- package/bundled-skills/hunt-dom/SKILL.md +323 -0
- package/bundled-skills/hunt-exceptional-conditions/SKILL.md +111 -0
- package/bundled-skills/hunt-file-upload/SKILL.md +202 -0
- package/bundled-skills/hunt-fintech-graphql/SKILL.md +289 -0
- package/bundled-skills/hunt-forgot-password/SKILL.md +114 -0
- package/bundled-skills/hunt-grpc/SKILL.md +317 -0
- package/bundled-skills/hunt-host-header/SKILL.md +309 -0
- package/bundled-skills/hunt-html-injection/SKILL.md +106 -0
- package/bundled-skills/hunt-http-smuggling/SKILL.md +129 -0
- package/bundled-skills/hunt-http-smuggling/references/phase2h-smuggling-cachepoison.md +177 -0
- package/bundled-skills/hunt-idor/SKILL.md +434 -0
- package/bundled-skills/hunt-jwt-crypto/SKILL.md +221 -0
- package/bundled-skills/hunt-k8s/SKILL.md +337 -0
- package/bundled-skills/hunt-laravel/SKILL.md +255 -0
- package/bundled-skills/hunt-ldap/SKILL.md +351 -0
- package/bundled-skills/hunt-lfi/SKILL.md +311 -0
- package/bundled-skills/hunt-llm-ai/SKILL.md +289 -0
- package/bundled-skills/hunt-mfa-bypass/SKILL.md +177 -0
- package/bundled-skills/hunt-misc/SKILL.md +378 -0
- package/bundled-skills/hunt-nextjs/SKILL.md +299 -0
- package/bundled-skills/hunt-nodejs/SKILL.md +263 -0
- package/bundled-skills/hunt-nosqli/SKILL.md +210 -0
- package/bundled-skills/hunt-ntlm-info/SKILL.md +314 -0
- package/bundled-skills/hunt-oauth/SKILL.md +459 -0
- package/bundled-skills/hunt-open-redirect/SKILL.md +223 -0
- package/bundled-skills/hunt-race-condition/SKILL.md +381 -0
- package/bundled-skills/hunt-race-condition/references/details.md +159 -0
- package/bundled-skills/hunt-rag-vector/SKILL.md +212 -0
- package/bundled-skills/hunt-rce/SKILL.md +444 -0
- package/bundled-skills/hunt-rce/references/details.md +110 -0
- package/bundled-skills/hunt-saml/SKILL.md +156 -0
- package/bundled-skills/hunt-session/SKILL.md +342 -0
- package/bundled-skills/hunt-shadow-api/SKILL.md +198 -0
- package/bundled-skills/hunt-source-leak/SKILL.md +345 -0
- package/bundled-skills/hunt-spa-api/SKILL.md +163 -0
- package/bundled-skills/hunt-springboot/SKILL.md +285 -0
- package/bundled-skills/hunt-sqli/SKILL.md +466 -0
- package/bundled-skills/hunt-ssrf/SKILL.md +396 -0
- package/bundled-skills/hunt-ssrf/references/details.md +179 -0
- package/bundled-skills/hunt-ssti/SKILL.md +163 -0
- package/bundled-skills/hunt-subdomain/SKILL.md +379 -0
- package/bundled-skills/hunt-tls-network/SKILL.md +399 -0
- package/bundled-skills/hunt-xxe/SKILL.md +466 -0
- package/bundled-skills/i-have-adhd/SKILL.md +170 -0
- package/bundled-skills/identity-access-management/SKILL.md +382 -0
- package/bundled-skills/identity-access-management/references/details.md +524 -0
- package/bundled-skills/incident-management/SKILL.md +484 -0
- package/bundled-skills/incident-response/SKILL.md +448 -0
- package/bundled-skills/incident-response/references/details.md +113 -0
- package/bundled-skills/interview-me/SKILL.md +248 -0
- package/bundled-skills/iso27001-compliance/SKILL.md +460 -0
- package/bundled-skills/jenkins/SKILL.md +462 -0
- package/bundled-skills/jev-social/SKILL.md +182 -0
- package/bundled-skills/jev-use/SKILL.md +158 -0
- package/bundled-skills/kubernetes-hardening/SKILL.md +154 -0
- package/bundled-skills/kubernetes-ops/SKILL.md +449 -0
- package/bundled-skills/kubernetes-ops/references/details.md +108 -0
- package/bundled-skills/kustomize/SKILL.md +478 -0
- package/bundled-skills/linux-administration/SKILL.md +367 -0
- package/bundled-skills/linux-hardening/SKILL.md +154 -0
- package/bundled-skills/llm-app-security/SKILL.md +389 -0
- package/bundled-skills/llm-app-security/references/details.md +674 -0
- package/bundled-skills/llm-caching/SKILL.md +334 -0
- package/bundled-skills/llm-cost-optimization/SKILL.md +311 -0
- package/bundled-skills/llm-fine-tuning/SKILL.md +329 -0
- package/bundled-skills/llm-gateway/SKILL.md +282 -0
- package/bundled-skills/llm-inference-scaling/SKILL.md +286 -0
- package/bundled-skills/llmops-platform-engineering/SKILL.md +472 -0
- package/bundled-skills/load-balancing/SKILL.md +403 -0
- package/bundled-skills/loki-logging/SKILL.md +479 -0
- package/bundled-skills/longbridge-derivatives/SKILL.md +117 -0
- package/bundled-skills/longbridge-derivatives/references/option.md +36 -0
- package/bundled-skills/longbridge-derivatives/references/options-advanced.md +101 -0
- package/bundled-skills/longbridge-derivatives/references/options-pnl.md +74 -0
- package/bundled-skills/longbridge-derivatives/references/options-strategy.md +82 -0
- package/bundled-skills/longbridge-derivatives/references/options-volatility.md +70 -0
- package/bundled-skills/longbridge-derivatives/references/warrant.md +12 -0
- package/bundled-skills/longbridge-quant/SKILL.md +151 -0
- package/bundled-skills/longbridge-quant/references/correlation.md +51 -0
- package/bundled-skills/longbridge-quant/references/execution-model.md +68 -0
- package/bundled-skills/longbridge-quant/references/factor-research.md +95 -0
- package/bundled-skills/longbridge-quant/references/factor-screen.md +101 -0
- package/bundled-skills/longbridge-quant/references/hedging.md +136 -0
- package/bundled-skills/longbridge-quant/references/ml-strategy.md +77 -0
- package/bundled-skills/longbridge-quant/references/multifactor.md +68 -0
- package/bundled-skills/longbridge-quant/references/pairs-trading.md +61 -0
- package/bundled-skills/longbridge-quant/references/quant-cli.md +133 -0
- package/bundled-skills/longbridge-quant/references/quant-stats.md +150 -0
- package/bundled-skills/longbridge-quant/references/seasonality.md +50 -0
- package/bundled-skills/longbridge-quant/references/strategy-optimizer.md +68 -0
- package/bundled-skills/longbridge-quant/references/volatility-strategy.md +52 -0
- package/bundled-skills/longbridge-research/SKILL.md +187 -0
- package/bundled-skills/longbridge-research/references/company-profile.md +96 -0
- package/bundled-skills/longbridge-research/references/company-tearsheet.md +82 -0
- package/bundled-skills/longbridge-research/references/competitive-analysis.md +81 -0
- package/bundled-skills/longbridge-research/references/consensus.md +92 -0
- package/bundled-skills/longbridge-research/references/coverage-initiation.md +76 -0
- package/bundled-skills/longbridge-research/references/defi-yield.md +60 -0
- package/bundled-skills/longbridge-research/references/finance-calendar.md +165 -0
- package/bundled-skills/longbridge-research/references/financial-planning.md +77 -0
- package/bundled-skills/longbridge-research/references/forecast-eps.md +39 -0
- package/bundled-skills/longbridge-research/references/fund-holder.md +44 -0
- package/bundled-skills/longbridge-research/references/hkipo-analysis.md +101 -0
- package/bundled-skills/longbridge-research/references/industry-peers.md +46 -0
- package/bundled-skills/longbridge-research/references/industry-rank.md +62 -0
- package/bundled-skills/longbridge-research/references/insider-trades.md +48 -0
- package/bundled-skills/longbridge-research/references/institution-rating.md +62 -0
- package/bundled-skills/longbridge-research/references/investment-ideas.md +69 -0
- package/bundled-skills/longbridge-research/references/investment-proposal.md +95 -0
- package/bundled-skills/longbridge-research/references/investors.md +87 -0
- package/bundled-skills/longbridge-research/references/onchain.md +70 -0
- package/bundled-skills/longbridge-research/references/post-investment.md +76 -0
- package/bundled-skills/longbridge-research/references/shareholder.md +72 -0
- package/bundled-skills/longbridge-research/references/short-positions.md +50 -0
- package/bundled-skills/longbridge-research/references/short-trades.md +50 -0
- package/bundled-skills/longbridge-research/references/stock-research.md +61 -0
- package/bundled-skills/longbridge-research/references/thesis-tracker.md +64 -0
- package/bundled-skills/m365-entra-attack/SKILL.md +423 -0
- package/bundled-skills/mac-mini-llm-lab/SKILL.md +350 -0
- package/bundled-skills/makepad-2-0-animation/SKILL.md +318 -0
- package/bundled-skills/makepad-2-0-animation/references/animator-reference.md +433 -0
- package/bundled-skills/makepad-2-0-dsl/SKILL.md +492 -0
- package/bundled-skills/makepad-2-0-dsl/references/dsl-syntax-reference.md +511 -0
- package/bundled-skills/makepad-2-0-dsl/references/extended-guide.md +56 -0
- package/bundled-skills/makepad-2-0-dsl/references/property-system.md +757 -0
- package/bundled-skills/makepad-2-0-events/SKILL.md +497 -0
- package/bundled-skills/makepad-2-0-events/references/event-patterns.md +802 -0
- package/bundled-skills/makepad-2-0-events/references/extended-guide.md +590 -0
- package/bundled-skills/makepad-2-0-layout/SKILL.md +499 -0
- package/bundled-skills/makepad-2-0-layout/references/extended-guide.md +243 -0
- package/bundled-skills/makepad-2-0-layout/references/layout-patterns.md +881 -0
- package/bundled-skills/makepad-2-0-widgets/SKILL.md +261 -0
- package/bundled-skills/makepad-2-0-widgets/references/widget-advanced.md +648 -0
- package/bundled-skills/makepad-2-0-widgets/references/widget-catalog.md +547 -0
- package/bundled-skills/mcp-server-security/SKILL.md +356 -0
- package/bundled-skills/mcp-server-security/references/details.md +745 -0
- package/bundled-skills/mdm-device-management/SKILL.md +404 -0
- package/bundled-skills/mdm-device-management/references/details.md +410 -0
- package/bundled-skills/meeting-distiller-pro/SKILL.md +120 -0
- package/bundled-skills/meme-coin-audit/SKILL.md +402 -0
- package/bundled-skills/mid-engagement-ir-detection/SKILL.md +377 -0
- package/bundled-skills/model-registry-governance/SKILL.md +452 -0
- package/bundled-skills/model-serving-kubernetes/SKILL.md +339 -0
- package/bundled-skills/model-supply-chain-security/SKILL.md +427 -0
- package/bundled-skills/mongodb/SKILL.md +436 -0
- package/bundled-skills/monte-carlo-analyze-root-cause/SKILL.md +12 -1
- package/bundled-skills/monte-carlo-asset-health/SKILL.md +12 -1
- package/bundled-skills/monte-carlo-context-detection/SKILL.md +170 -0
- package/bundled-skills/monte-carlo-context-detection/references/signal-definitions.md +46 -0
- package/bundled-skills/multi-tenant-llm-hosting/SKILL.md +435 -0
- package/bundled-skills/multi-tenant-llm-hosting/references/details.md +211 -0
- package/bundled-skills/mysql/SKILL.md +390 -0
- package/bundled-skills/new-relic/SKILL.md +472 -0
- package/bundled-skills/nfs-storage/SKILL.md +356 -0
- package/bundled-skills/object-storage/SKILL.md +378 -0
- package/bundled-skills/offensive-osint/SKILL.md +443 -0
- package/bundled-skills/okta-attack/SKILL.md +436 -0
- package/bundled-skills/ollama-stack/SKILL.md +379 -0
- package/bundled-skills/openclaw-deployment-hardening/SKILL.md +135 -0
- package/bundled-skills/openclaw-local-mac-mini/SKILL.md +426 -0
- package/bundled-skills/openclaw-local-mac-mini/references/details.md +221 -0
- package/bundled-skills/openclaw-security-hardening/SKILL.md +135 -0
- package/bundled-skills/openshift/SKILL.md +485 -0
- package/bundled-skills/opentelemetry/SKILL.md +438 -0
- package/bundled-skills/opentelemetry/references/details.md +78 -0
- package/bundled-skills/opentofu-migration/SKILL.md +349 -0
- package/bundled-skills/osint-methodology/SKILL.md +460 -0
- package/bundled-skills/osint-methodology/references/details.md +1350 -0
- package/bundled-skills/pci-dss-compliance/SKILL.md +446 -0
- package/bundled-skills/penetration-testing/SKILL.md +152 -0
- package/bundled-skills/performance-tuning/SKILL.md +381 -0
- package/bundled-skills/planetscale/SKILL.md +297 -0
- package/bundled-skills/platform-engineering/SKILL.md +348 -0
- package/bundled-skills/platform-engineering/references/details.md +944 -0
- package/bundled-skills/podman/SKILL.md +405 -0
- package/bundled-skills/policy-as-code/SKILL.md +434 -0
- package/bundled-skills/policy-as-code/references/details.md +204 -0
- package/bundled-skills/postgresql-devsec/SKILL.md +378 -0
- package/bundled-skills/prometheus-grafana/SKILL.md +469 -0
- package/bundled-skills/prompt-injection-defense/SKILL.md +483 -0
- package/bundled-skills/rag-infrastructure/SKILL.md +269 -0
- package/bundled-skills/rag-observability-evals/SKILL.md +444 -0
- package/bundled-skills/rag-observability-evals/references/details.md +92 -0
- package/bundled-skills/recon-scope-triage/SKILL.md +128 -0
- package/bundled-skills/redis/SKILL.md +421 -0
- package/bundled-skills/redteam-report-template/SKILL.md +370 -0
- package/bundled-skills/remotion-captions/SKILL.md +57 -0
- package/bundled-skills/remotion-captions/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-captions/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-captions/display-captions.md +190 -0
- package/bundled-skills/remotion-captions/import-srt-captions.md +73 -0
- package/bundled-skills/remotion-captions/transcribe-captions.md +70 -0
- package/bundled-skills/remotion-create/SKILL.md +106 -0
- package/bundled-skills/remotion-create/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-create/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-create/tailwind.md +11 -0
- package/bundled-skills/remotion-create/video-layout.md +9 -0
- package/bundled-skills/remotion-docs/SKILL.md +67 -0
- package/bundled-skills/remotion-docs/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-docs/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-interactivity/SKILL.md +270 -0
- package/bundled-skills/remotion-interactivity/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-interactivity/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-render/SKILL.md +48 -0
- package/bundled-skills/remotion-render/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-render/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-render/transparent-videos.md +106 -0
- package/bundled-skills/report-writing/SKILL.md +426 -0
- package/bundled-skills/report-writing/references/details.md +187 -0
- package/bundled-skills/reverse-proxy/SKILL.md +420 -0
- package/bundled-skills/runbook-creation/SKILL.md +438 -0
- package/bundled-skills/runbook-creation/references/details.md +71 -0
- package/bundled-skills/saas-pricing-strategist/SKILL.md +169 -0
- package/bundled-skills/saas-security-posture/SKILL.md +415 -0
- package/bundled-skills/sast-scanning/SKILL.md +444 -0
- package/bundled-skills/sbom-supply-chain/SKILL.md +433 -0
- package/bundled-skills/score-eval/SKILL.md +35 -0
- package/bundled-skills/security-arsenal/SKILL.md +446 -0
- package/bundled-skills/security-arsenal/references/details.md +540 -0
- package/bundled-skills/security-automation/SKILL.md +146 -0
- package/bundled-skills/semantic-versioning/SKILL.md +434 -0
- package/bundled-skills/semantic-versioning/references/details.md +83 -0
- package/bundled-skills/service-mesh/SKILL.md +422 -0
- package/bundled-skills/soc2-compliance/SKILL.md +409 -0
- package/bundled-skills/sops-encryption/SKILL.md +124 -0
- package/bundled-skills/sre-dashboards/SKILL.md +143 -0
- package/bundled-skills/ssh-configuration/SKILL.md +324 -0
- package/bundled-skills/ssl-tls-management/SKILL.md +428 -0
- package/bundled-skills/ssl-tls-management/references/details.md +99 -0
- package/bundled-skills/startup-it-troubleshooting/SKILL.md +415 -0
- package/bundled-skills/supply-chain-attack-recon/SKILL.md +453 -0
- package/bundled-skills/supply-chain-attack-recon/references/details.md +258 -0
- package/bundled-skills/systemd-services/SKILL.md +379 -0
- package/bundled-skills/terraform-aws/SKILL.md +125 -0
- package/bundled-skills/terraform-azure/SKILL.md +415 -0
- package/bundled-skills/terraform-azure/references/details.md +231 -0
- package/bundled-skills/terraform-gcp/SKILL.md +369 -0
- package/bundled-skills/threat-modeling/SKILL.md +487 -0
- package/bundled-skills/user-management/SKILL.md +383 -0
- package/bundled-skills/using-agent-skills/SKILL.md +220 -0
- package/bundled-skills/vector-database-ops/SKILL.md +300 -0
- package/bundled-skills/vendor-management/SKILL.md +439 -0
- package/bundled-skills/vendor-management/references/details.md +109 -0
- package/bundled-skills/vercel-deployments/SKILL.md +296 -0
- package/bundled-skills/vllm-server/SKILL.md +236 -0
- package/bundled-skills/vmware-vcenter-attack/SKILL.md +412 -0
- package/bundled-skills/vpn-setup/SKILL.md +452 -0
- package/bundled-skills/vulnerability-scanning/SKILL.md +448 -0
- package/bundled-skills/waf-setup/SKILL.md +354 -0
- package/bundled-skills/waf-setup/references/details.md +211 -0
- package/bundled-skills/web2-recon/SKILL.md +440 -0
- package/bundled-skills/web2-recon/references/details.md +319 -0
- package/bundled-skills/web3-audit/SKILL.md +445 -0
- package/bundled-skills/web3-audit/references/details.md +224 -0
- package/bundled-skills/windows-hardening/SKILL.md +454 -0
- package/bundled-skills/windows-hardening/references/details.md +204 -0
- package/bundled-skills/windows-server/SKILL.md +318 -0
- package/bundled-skills/writing-guidelines/SKILL.md +60 -0
- package/bundled-skills/zero-trust/SKILL.md +461 -0
- package/package.json +1 -1
- package/skills_index.json +7874 -277
|
@@ -0,0 +1,786 @@
|
|
|
1
|
+
# Details (moved from SKILL.md)
|
|
2
|
+
|
|
3
|
+
> Extended reference content for `agent-observability`, kept under `references/` so the entrypoint stays within the audit budget.
|
|
4
|
+
|
|
5
|
+
## Structured Logging
|
|
6
|
+
|
|
7
|
+
Emit JSON logs for every agent action so they can be ingested by Loki, Elasticsearch, or Datadog.
|
|
8
|
+
|
|
9
|
+
### Python Logging Configuration
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
# logging_config.py
|
|
13
|
+
import logging
|
|
14
|
+
import json
|
|
15
|
+
import sys
|
|
16
|
+
from datetime import datetime, timezone
|
|
17
|
+
|
|
18
|
+
class AgentJSONFormatter(logging.Formatter):
|
|
19
|
+
"""Structured JSON formatter for agent logs."""
|
|
20
|
+
|
|
21
|
+
def format(self, record: logging.LogRecord) -> str:
|
|
22
|
+
log_entry = {
|
|
23
|
+
"timestamp": datetime.now(timezone.utc).isoformat(),
|
|
24
|
+
"level": record.levelname,
|
|
25
|
+
"logger": record.name,
|
|
26
|
+
"message": record.getMessage(),
|
|
27
|
+
"module": record.module,
|
|
28
|
+
"function": record.funcName,
|
|
29
|
+
"line": record.lineno,
|
|
30
|
+
}
|
|
31
|
+
# Merge any extra fields attached to the record
|
|
32
|
+
for key in ("trace_id", "span_id", "agent_name", "model",
|
|
33
|
+
"tool_name", "request_id", "user_id",
|
|
34
|
+
"prompt_tokens", "completion_tokens", "cost_usd",
|
|
35
|
+
"duration_seconds", "status", "error_type"):
|
|
36
|
+
value = getattr(record, key, None)
|
|
37
|
+
if value is not None:
|
|
38
|
+
log_entry[key] = value
|
|
39
|
+
|
|
40
|
+
if record.exc_info and record.exc_info[0] is not None:
|
|
41
|
+
log_entry["exception"] = self.formatException(record.exc_info)
|
|
42
|
+
|
|
43
|
+
return json.dumps(log_entry, default=str)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def configure_logging(level: str = "INFO"):
|
|
47
|
+
handler = logging.StreamHandler(sys.stdout)
|
|
48
|
+
handler.setFormatter(AgentJSONFormatter())
|
|
49
|
+
|
|
50
|
+
root = logging.getLogger()
|
|
51
|
+
root.setLevel(getattr(logging, level))
|
|
52
|
+
root.handlers = [handler]
|
|
53
|
+
|
|
54
|
+
# Suppress noisy libraries
|
|
55
|
+
logging.getLogger("httpx").setLevel(logging.WARNING)
|
|
56
|
+
logging.getLogger("opentelemetry").setLevel(logging.WARNING)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Logging Agent Actions
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
# agent_logging.py
|
|
63
|
+
import logging
|
|
64
|
+
from opentelemetry import trace
|
|
65
|
+
|
|
66
|
+
logger = logging.getLogger("agent")
|
|
67
|
+
|
|
68
|
+
def log_llm_call(model: str, prompt_tokens: int, completion_tokens: int,
|
|
69
|
+
duration: float, cost: float, status: str = "ok"):
|
|
70
|
+
span = trace.get_current_span()
|
|
71
|
+
ctx = span.get_span_context() if span else None
|
|
72
|
+
logger.info(
|
|
73
|
+
"LLM call completed",
|
|
74
|
+
extra={
|
|
75
|
+
"trace_id": format(ctx.trace_id, "032x") if ctx else None,
|
|
76
|
+
"span_id": format(ctx.span_id, "016x") if ctx else None,
|
|
77
|
+
"model": model,
|
|
78
|
+
"prompt_tokens": prompt_tokens,
|
|
79
|
+
"completion_tokens": completion_tokens,
|
|
80
|
+
"duration_seconds": round(duration, 3),
|
|
81
|
+
"cost_usd": round(cost, 6),
|
|
82
|
+
"status": status,
|
|
83
|
+
"agent_name": "default",
|
|
84
|
+
},
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
def log_tool_call(tool_name: str, duration: float, status: str, error: str = None):
|
|
88
|
+
span = trace.get_current_span()
|
|
89
|
+
ctx = span.get_span_context() if span else None
|
|
90
|
+
extra = {
|
|
91
|
+
"trace_id": format(ctx.trace_id, "032x") if ctx else None,
|
|
92
|
+
"span_id": format(ctx.span_id, "016x") if ctx else None,
|
|
93
|
+
"tool_name": tool_name,
|
|
94
|
+
"duration_seconds": round(duration, 3),
|
|
95
|
+
"status": status,
|
|
96
|
+
"agent_name": "default",
|
|
97
|
+
}
|
|
98
|
+
if error:
|
|
99
|
+
extra["error_type"] = error
|
|
100
|
+
logger.info("Tool call completed", extra=extra)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Example log output:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"timestamp": "2026-03-24T14:22:01.337Z",
|
|
108
|
+
"level": "INFO",
|
|
109
|
+
"logger": "agent",
|
|
110
|
+
"message": "LLM call completed",
|
|
111
|
+
"module": "agent_logging",
|
|
112
|
+
"function": "log_llm_call",
|
|
113
|
+
"line": 12,
|
|
114
|
+
"trace_id": "0af7651916cd43dd8448eb211c80319c",
|
|
115
|
+
"span_id": "b7ad6b7169203331",
|
|
116
|
+
"model": "gpt-4o",
|
|
117
|
+
"prompt_tokens": 1842,
|
|
118
|
+
"completion_tokens": 356,
|
|
119
|
+
"duration_seconds": 2.417,
|
|
120
|
+
"cost_usd": 0.013770,
|
|
121
|
+
"status": "ok",
|
|
122
|
+
"agent_name": "support-agent"
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
## Grafana Dashboards
|
|
130
|
+
|
|
131
|
+
### Agent Overview Dashboard
|
|
132
|
+
|
|
133
|
+
Save this JSON as `agent-overview.json` and import it into Grafana.
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"dashboard": {
|
|
138
|
+
"title": "AI Agent Overview",
|
|
139
|
+
"uid": "agent-overview-v1",
|
|
140
|
+
"tags": ["ai", "agent", "llm"],
|
|
141
|
+
"timezone": "browser",
|
|
142
|
+
"refresh": "30s",
|
|
143
|
+
"panels": [
|
|
144
|
+
{
|
|
145
|
+
"title": "Request Latency (p50 / p95 / p99)",
|
|
146
|
+
"type": "timeseries",
|
|
147
|
+
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 },
|
|
148
|
+
"targets": [
|
|
149
|
+
{
|
|
150
|
+
"expr": "histogram_quantile(0.50, sum(rate(agent_request_duration_seconds_bucket[5m])) by (le))",
|
|
151
|
+
"legendFormat": "p50"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"expr": "histogram_quantile(0.95, sum(rate(agent_request_duration_seconds_bucket[5m])) by (le))",
|
|
155
|
+
"legendFormat": "p95"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"expr": "histogram_quantile(0.99, sum(rate(agent_request_duration_seconds_bucket[5m])) by (le))",
|
|
159
|
+
"legendFormat": "p99"
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"fieldConfig": {
|
|
163
|
+
"defaults": {
|
|
164
|
+
"unit": "s",
|
|
165
|
+
"thresholds": {
|
|
166
|
+
"steps": [
|
|
167
|
+
{ "color": "green", "value": null },
|
|
168
|
+
{ "color": "yellow", "value": 5 },
|
|
169
|
+
{ "color": "red", "value": 15 }
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"title": "Token Usage (prompt vs completion)",
|
|
177
|
+
"type": "timeseries",
|
|
178
|
+
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 0 },
|
|
179
|
+
"targets": [
|
|
180
|
+
{
|
|
181
|
+
"expr": "sum(rate(llm_prompt_tokens_total[5m])) by (model)",
|
|
182
|
+
"legendFormat": "prompt - {{ model }}"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"expr": "sum(rate(llm_completion_tokens_total[5m])) by (model)",
|
|
186
|
+
"legendFormat": "completion - {{ model }}"
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
"fieldConfig": {
|
|
190
|
+
"defaults": { "unit": "short" }
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"title": "Cost per Hour (USD)",
|
|
195
|
+
"type": "stat",
|
|
196
|
+
"gridPos": { "h": 4, "w": 6, "x": 0, "y": 8 },
|
|
197
|
+
"targets": [
|
|
198
|
+
{
|
|
199
|
+
"expr": "sum(rate(llm_cost_dollars_total[1h])) * 3600",
|
|
200
|
+
"legendFormat": "$/hr"
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
"fieldConfig": {
|
|
204
|
+
"defaults": {
|
|
205
|
+
"unit": "currencyUSD",
|
|
206
|
+
"thresholds": {
|
|
207
|
+
"steps": [
|
|
208
|
+
{ "color": "green", "value": null },
|
|
209
|
+
{ "color": "yellow", "value": 10 },
|
|
210
|
+
{ "color": "red", "value": 50 }
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"title": "Error Rate (%)",
|
|
218
|
+
"type": "gauge",
|
|
219
|
+
"gridPos": { "h": 4, "w": 6, "x": 6, "y": 8 },
|
|
220
|
+
"targets": [
|
|
221
|
+
{
|
|
222
|
+
"expr": "sum(rate(llm_errors_total[5m])) / (sum(rate(llm_call_duration_seconds_count[5m])) + 1e-10) * 100",
|
|
223
|
+
"legendFormat": "error %"
|
|
224
|
+
}
|
|
225
|
+
],
|
|
226
|
+
"fieldConfig": {
|
|
227
|
+
"defaults": {
|
|
228
|
+
"unit": "percent",
|
|
229
|
+
"min": 0,
|
|
230
|
+
"max": 100,
|
|
231
|
+
"thresholds": {
|
|
232
|
+
"steps": [
|
|
233
|
+
{ "color": "green", "value": null },
|
|
234
|
+
{ "color": "yellow", "value": 1 },
|
|
235
|
+
{ "color": "red", "value": 5 }
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"title": "Tool Call Success vs Failure",
|
|
243
|
+
"type": "timeseries",
|
|
244
|
+
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 12 },
|
|
245
|
+
"targets": [
|
|
246
|
+
{
|
|
247
|
+
"expr": "sum(rate(agent_tool_calls_total{status='success'}[5m])) by (tool_name)",
|
|
248
|
+
"legendFormat": "ok - {{ tool_name }}"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"expr": "sum(rate(agent_tool_calls_total{status='error'}[5m])) by (tool_name)",
|
|
252
|
+
"legendFormat": "err - {{ tool_name }}"
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"title": "Active Requests",
|
|
258
|
+
"type": "timeseries",
|
|
259
|
+
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 12 },
|
|
260
|
+
"targets": [
|
|
261
|
+
{
|
|
262
|
+
"expr": "sum(agent_active_requests) by (agent_name)",
|
|
263
|
+
"legendFormat": "{{ agent_name }}"
|
|
264
|
+
}
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
## Cost Tracking
|
|
276
|
+
|
|
277
|
+
### Per-Model Cost Calculation
|
|
278
|
+
|
|
279
|
+
```python
|
|
280
|
+
# cost_tracker.py
|
|
281
|
+
from dataclasses import dataclass
|
|
282
|
+
|
|
283
|
+
@dataclass
|
|
284
|
+
class ModelPricing:
|
|
285
|
+
prompt_cost_per_1k: float # USD per 1,000 prompt tokens
|
|
286
|
+
completion_cost_per_1k: float # USD per 1,000 completion tokens
|
|
287
|
+
|
|
288
|
+
# Updated pricing as of early 2026 -- adjust to your negotiated rates
|
|
289
|
+
MODEL_PRICING: dict[str, ModelPricing] = {
|
|
290
|
+
"gpt-4o": ModelPricing(0.0025, 0.0100),
|
|
291
|
+
"gpt-4o-mini": ModelPricing(0.00015, 0.0006),
|
|
292
|
+
"gpt-4.1": ModelPricing(0.002, 0.008),
|
|
293
|
+
"gpt-4.1-mini": ModelPricing(0.0004, 0.0016),
|
|
294
|
+
"gpt-4.1-nano": ModelPricing(0.0001, 0.0004),
|
|
295
|
+
"claude-sonnet-4": ModelPricing(0.003, 0.015),
|
|
296
|
+
"claude-haiku-3.5": ModelPricing(0.0008, 0.004),
|
|
297
|
+
"claude-opus-4": ModelPricing(0.015, 0.075),
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
def calculate_cost(model: str, prompt_tokens: int, completion_tokens: int) -> float:
|
|
301
|
+
"""Return estimated cost in USD. Falls back to zero if model is unknown."""
|
|
302
|
+
pricing = MODEL_PRICING.get(model)
|
|
303
|
+
if pricing is None:
|
|
304
|
+
return 0.0
|
|
305
|
+
prompt_cost = (prompt_tokens / 1000) * pricing.prompt_cost_per_1k
|
|
306
|
+
completion_cost = (completion_tokens / 1000) * pricing.completion_cost_per_1k
|
|
307
|
+
return prompt_cost + completion_cost
|
|
308
|
+
|
|
309
|
+
def record_cost(model: str, prompt_tokens: int, completion_tokens: int, agent_name: str = "default"):
|
|
310
|
+
"""Calculate cost and record it in the Prometheus counter."""
|
|
311
|
+
pricing = MODEL_PRICING.get(model)
|
|
312
|
+
if pricing is None:
|
|
313
|
+
return
|
|
314
|
+
prompt_cost = (prompt_tokens / 1000) * pricing.prompt_cost_per_1k
|
|
315
|
+
completion_cost = (completion_tokens / 1000) * pricing.completion_cost_per_1k
|
|
316
|
+
LLM_COST.labels(model=model, agent_name=agent_name, cost_type="prompt").inc(prompt_cost)
|
|
317
|
+
LLM_COST.labels(model=model, agent_name=agent_name, cost_type="completion").inc(completion_cost)
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Budget Alerting -- Prometheus Rules
|
|
321
|
+
|
|
322
|
+
Save as `agent-cost-alerts.yaml` and load it into Prometheus or Cortex ruler.
|
|
323
|
+
|
|
324
|
+
```yaml
|
|
325
|
+
# agent-cost-alerts.yaml
|
|
326
|
+
groups:
|
|
327
|
+
- name: agent_cost_alerts
|
|
328
|
+
interval: 1m
|
|
329
|
+
rules:
|
|
330
|
+
# Fire if hourly spend exceeds $25
|
|
331
|
+
- alert: AgentCostHourlyHigh
|
|
332
|
+
expr: sum(rate(llm_cost_dollars_total[1h])) * 3600 > 25
|
|
333
|
+
for: 5m
|
|
334
|
+
labels:
|
|
335
|
+
severity: warning
|
|
336
|
+
team: ai-platform
|
|
337
|
+
annotations:
|
|
338
|
+
summary: "Agent LLM spend exceeds $25/hr"
|
|
339
|
+
description: >
|
|
340
|
+
Current hourly spend is ${{ $value | printf "%.2f" }}.
|
|
341
|
+
Check for runaway loops, prompt-stuffing, or unexpected traffic.
|
|
342
|
+
|
|
343
|
+
# Fire if daily projected spend exceeds $500
|
|
344
|
+
- alert: AgentCostDailyProjectionHigh
|
|
345
|
+
expr: sum(rate(llm_cost_dollars_total[1h])) * 86400 > 500
|
|
346
|
+
for: 15m
|
|
347
|
+
labels:
|
|
348
|
+
severity: critical
|
|
349
|
+
team: ai-platform
|
|
350
|
+
annotations:
|
|
351
|
+
summary: "Projected daily agent spend exceeds $500"
|
|
352
|
+
description: >
|
|
353
|
+
Projected daily spend: ${{ $value | printf "%.2f" }}.
|
|
354
|
+
Consider throttling requests or switching to a cheaper model.
|
|
355
|
+
|
|
356
|
+
# Fire if a single agent's cost spikes 3x above its 24h average
|
|
357
|
+
- alert: AgentCostSpike
|
|
358
|
+
expr: >
|
|
359
|
+
sum(rate(llm_cost_dollars_total[5m])) by (agent_name)
|
|
360
|
+
/
|
|
361
|
+
(sum(rate(llm_cost_dollars_total[24h])) by (agent_name) + 1e-10)
|
|
362
|
+
> 3
|
|
363
|
+
for: 10m
|
|
364
|
+
labels:
|
|
365
|
+
severity: warning
|
|
366
|
+
team: ai-platform
|
|
367
|
+
annotations:
|
|
368
|
+
summary: "Agent {{ $labels.agent_name }} cost spiked 3x above 24h average"
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
## Langfuse / Helicone Integration
|
|
375
|
+
|
|
376
|
+
### Langfuse (Self-hosted or Cloud)
|
|
377
|
+
|
|
378
|
+
Langfuse provides trace-level visibility with prompt management and scoring. It can run alongside your existing OTel stack.
|
|
379
|
+
|
|
380
|
+
```python
|
|
381
|
+
# langfuse_integration.py
|
|
382
|
+
from langfuse import Langfuse
|
|
383
|
+
from langfuse.decorators import observe, langfuse_context
|
|
384
|
+
|
|
385
|
+
# Initialize -- reads LANGFUSE_SECRET_KEY, LANGFUSE_PUBLIC_KEY, LANGFUSE_HOST from env
|
|
386
|
+
langfuse = Langfuse()
|
|
387
|
+
|
|
388
|
+
@observe(as_type="generation")
|
|
389
|
+
def call_llm(client, messages, model="gpt-4o", **kwargs):
|
|
390
|
+
"""Langfuse automatically captures input/output, tokens, latency, and cost."""
|
|
391
|
+
response = client.chat.completions.create(
|
|
392
|
+
model=model, messages=messages, **kwargs
|
|
393
|
+
)
|
|
394
|
+
langfuse_context.update_current_observation(
|
|
395
|
+
model=model,
|
|
396
|
+
usage={
|
|
397
|
+
"input": response.usage.prompt_tokens,
|
|
398
|
+
"output": response.usage.completion_tokens,
|
|
399
|
+
},
|
|
400
|
+
metadata={"temperature": kwargs.get("temperature", 1.0)},
|
|
401
|
+
)
|
|
402
|
+
return response
|
|
403
|
+
|
|
404
|
+
@observe()
|
|
405
|
+
def run_agent(user_input: str):
|
|
406
|
+
"""Top-level agent trace -- all nested @observe calls become child spans."""
|
|
407
|
+
langfuse_context.update_current_trace(
|
|
408
|
+
user_id="user-123",
|
|
409
|
+
session_id="session-abc",
|
|
410
|
+
tags=["production"],
|
|
411
|
+
)
|
|
412
|
+
# ... agent logic with nested call_llm() and tool calls ...
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
Environment variables for Langfuse:
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
export LANGFUSE_SECRET_KEY="sk-lf-..."
|
|
419
|
+
export LANGFUSE_PUBLIC_KEY="pk-lf-..."
|
|
420
|
+
export LANGFUSE_HOST="https://cloud.langfuse.com" # or your self-hosted URL
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Helicone (Proxy-based)
|
|
424
|
+
|
|
425
|
+
Helicone acts as a logging proxy. Point your OpenAI base URL at Helicone and it captures everything automatically.
|
|
426
|
+
|
|
427
|
+
```python
|
|
428
|
+
# helicone_integration.py
|
|
429
|
+
from openai import OpenAI
|
|
430
|
+
|
|
431
|
+
client = OpenAI(
|
|
432
|
+
base_url="https://oai.helicone.ai/v1",
|
|
433
|
+
default_headers={
|
|
434
|
+
"Helicone-Auth": "Bearer sk-helicone-...",
|
|
435
|
+
"Helicone-Property-Agent": "support-agent",
|
|
436
|
+
"Helicone-Property-Environment": "production",
|
|
437
|
+
"Helicone-User-Id": "user-123",
|
|
438
|
+
"Helicone-Session-Id": "session-abc",
|
|
439
|
+
"Helicone-Cache-Enabled": "true", # enable response caching
|
|
440
|
+
"Helicone-Rate-Limit-Policy": "100;w=60", # 100 req per 60s
|
|
441
|
+
},
|
|
442
|
+
)
|
|
443
|
+
|
|
444
|
+
# All calls through this client are automatically logged in Helicone
|
|
445
|
+
response = client.chat.completions.create(
|
|
446
|
+
model="gpt-4o",
|
|
447
|
+
messages=[{"role": "user", "content": "Summarise this document..."}],
|
|
448
|
+
)
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
## SLO Definition
|
|
455
|
+
|
|
456
|
+
Define Service Level Objectives for your agents and enforce them with Prometheus recording and alerting rules.
|
|
457
|
+
|
|
458
|
+
### Recording Rules
|
|
459
|
+
|
|
460
|
+
```yaml
|
|
461
|
+
# agent-slo-recording-rules.yaml
|
|
462
|
+
groups:
|
|
463
|
+
- name: agent_slo_recording
|
|
464
|
+
interval: 30s
|
|
465
|
+
rules:
|
|
466
|
+
# Success rate (non-error responses / total responses)
|
|
467
|
+
- record: agent:success_rate:5m
|
|
468
|
+
expr: >
|
|
469
|
+
1 - (
|
|
470
|
+
sum(rate(llm_errors_total[5m]))
|
|
471
|
+
/
|
|
472
|
+
(sum(rate(llm_call_duration_seconds_count[5m])) + 1e-10)
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
# p95 latency
|
|
476
|
+
- record: agent:latency_p95:5m
|
|
477
|
+
expr: >
|
|
478
|
+
histogram_quantile(0.95,
|
|
479
|
+
sum(rate(agent_request_duration_seconds_bucket[5m])) by (le)
|
|
480
|
+
)
|
|
481
|
+
|
|
482
|
+
# p50 latency
|
|
483
|
+
- record: agent:latency_p50:5m
|
|
484
|
+
expr: >
|
|
485
|
+
histogram_quantile(0.50,
|
|
486
|
+
sum(rate(agent_request_duration_seconds_bucket[5m])) by (le)
|
|
487
|
+
)
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### SLO Alert Rules
|
|
491
|
+
|
|
492
|
+
```yaml
|
|
493
|
+
# agent-slo-alerts.yaml
|
|
494
|
+
groups:
|
|
495
|
+
- name: agent_slo_alerts
|
|
496
|
+
rules:
|
|
497
|
+
# SLO: 99.5% success rate over a rolling 30-day window
|
|
498
|
+
- alert: AgentSuccessRateSLOBreach
|
|
499
|
+
expr: agent:success_rate:5m < 0.995
|
|
500
|
+
for: 10m
|
|
501
|
+
labels:
|
|
502
|
+
severity: critical
|
|
503
|
+
slo: agent-success-rate
|
|
504
|
+
annotations:
|
|
505
|
+
summary: "Agent success rate below 99.5% SLO"
|
|
506
|
+
description: >
|
|
507
|
+
Current success rate: {{ $value | printf "%.4f" }}.
|
|
508
|
+
SLO target: 0.995. Investigate elevated LLM errors or tool failures.
|
|
509
|
+
|
|
510
|
+
# SLO: p95 latency under 5 seconds
|
|
511
|
+
- alert: AgentLatencyP95SLOBreach
|
|
512
|
+
expr: agent:latency_p95:5m > 5
|
|
513
|
+
for: 10m
|
|
514
|
+
labels:
|
|
515
|
+
severity: warning
|
|
516
|
+
slo: agent-latency-p95
|
|
517
|
+
annotations:
|
|
518
|
+
summary: "Agent p95 latency exceeds 5s SLO"
|
|
519
|
+
description: >
|
|
520
|
+
Current p95 latency: {{ $value | printf "%.2f" }}s.
|
|
521
|
+
Check for slow LLM responses, long tool calls, or context-window bloat.
|
|
522
|
+
|
|
523
|
+
# SLO: p50 latency under 2 seconds
|
|
524
|
+
- alert: AgentLatencyP50SLOBreach
|
|
525
|
+
expr: agent:latency_p50:5m > 2
|
|
526
|
+
for: 15m
|
|
527
|
+
labels:
|
|
528
|
+
severity: warning
|
|
529
|
+
slo: agent-latency-p50
|
|
530
|
+
annotations:
|
|
531
|
+
summary: "Agent median latency exceeds 2s SLO"
|
|
532
|
+
description: >
|
|
533
|
+
Current p50 latency: {{ $value | printf "%.2f" }}s.
|
|
534
|
+
|
|
535
|
+
# Error budget: burn rate alert (multi-window)
|
|
536
|
+
- alert: AgentErrorBudgetFastBurn
|
|
537
|
+
expr: >
|
|
538
|
+
(
|
|
539
|
+
1 - (sum(rate(llm_errors_total[5m])) / (sum(rate(llm_call_duration_seconds_count[5m])) + 1e-10))
|
|
540
|
+
) < 0.99
|
|
541
|
+
for: 5m
|
|
542
|
+
labels:
|
|
543
|
+
severity: critical
|
|
544
|
+
slo: agent-error-budget
|
|
545
|
+
annotations:
|
|
546
|
+
summary: "Agent error budget burning fast -- success rate below 99% over 5m"
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### Sloth SLO Spec (Alternative)
|
|
550
|
+
|
|
551
|
+
If you use [Sloth](https://github.com/slok/sloth) to manage SLOs declaratively:
|
|
552
|
+
|
|
553
|
+
```yaml
|
|
554
|
+
# agent-slo-sloth.yaml
|
|
555
|
+
version: "prometheus/v1"
|
|
556
|
+
service: "ai-agent"
|
|
557
|
+
labels:
|
|
558
|
+
team: ai-platform
|
|
559
|
+
slos:
|
|
560
|
+
- name: "agent-availability"
|
|
561
|
+
objective: 99.5
|
|
562
|
+
description: "99.5% of agent requests should succeed"
|
|
563
|
+
sli:
|
|
564
|
+
events:
|
|
565
|
+
error_query: sum(rate(llm_errors_total{job="agent"}[{{.window}}]))
|
|
566
|
+
total_query: sum(rate(llm_call_duration_seconds_count{job="agent"}[{{.window}}]))
|
|
567
|
+
alerting:
|
|
568
|
+
name: AgentAvailability
|
|
569
|
+
labels:
|
|
570
|
+
team: ai-platform
|
|
571
|
+
page_alert:
|
|
572
|
+
labels:
|
|
573
|
+
severity: critical
|
|
574
|
+
ticket_alert:
|
|
575
|
+
labels:
|
|
576
|
+
severity: warning
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
---
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
## Debugging Workflows
|
|
583
|
+
|
|
584
|
+
### Slow Agent Responses
|
|
585
|
+
|
|
586
|
+
1. **Identify the bottleneck.** Open the Grafana dashboard and check whether p95 latency is driven by LLM calls or tool calls.
|
|
587
|
+
|
|
588
|
+
```promql
|
|
589
|
+
# Which component is slow?
|
|
590
|
+
topk(5, histogram_quantile(0.95, sum(rate(agent_tool_call_duration_seconds_bucket[5m])) by (le, tool_name)))
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
2. **Check token counts.** Bloated prompts cause proportionally slower responses.
|
|
594
|
+
|
|
595
|
+
```promql
|
|
596
|
+
# Average tokens per request, by model
|
|
597
|
+
sum(rate(llm_prompt_tokens_total[5m])) by (model)
|
|
598
|
+
/
|
|
599
|
+
(sum(rate(llm_call_duration_seconds_count[5m])) by (model) + 1e-10)
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
3. **Look for retries.** Retries multiply latency.
|
|
603
|
+
|
|
604
|
+
```promql
|
|
605
|
+
sum(rate(llm_retries_total[5m])) by (retry_reason)
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
4. **Inspect traces.** Filter traces in Jaeger or Tempo by `agent_request_duration_seconds > 10s` and expand spans to find the slow step.
|
|
609
|
+
|
|
610
|
+
5. **Common fixes:**
|
|
611
|
+
- Reduce system prompt length or move static context into a cached prefix.
|
|
612
|
+
- Switch long-running tool calls to async execution with a timeout.
|
|
613
|
+
- Use a faster/smaller model for subtasks that do not need the flagship model.
|
|
614
|
+
- Enable streaming to reduce time-to-first-token perceived by users.
|
|
615
|
+
|
|
616
|
+
### High Token Usage
|
|
617
|
+
|
|
618
|
+
1. **Rank agents by token consumption:**
|
|
619
|
+
|
|
620
|
+
```promql
|
|
621
|
+
topk(10, sum(rate(llm_prompt_tokens_total[1h])) by (agent_name))
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
2. **Check for conversation-history bloat.** Agents that append full conversation history on every turn consume tokens quadratically.
|
|
625
|
+
|
|
626
|
+
3. **Verify RAG chunk sizes.** Oversized retrieval chunks inflate prompt tokens without improving quality.
|
|
627
|
+
|
|
628
|
+
4. **Common fixes:**
|
|
629
|
+
- Implement sliding-window or summarisation-based memory.
|
|
630
|
+
- Reduce the number of retrieved chunks (e.g., top-3 instead of top-10).
|
|
631
|
+
- Use prompt caching (Anthropic cache, OpenAI cached-tokens) to reduce cost even if token count stays high.
|
|
632
|
+
|
|
633
|
+
### Tool Failures
|
|
634
|
+
|
|
635
|
+
1. **Identify failing tools:**
|
|
636
|
+
|
|
637
|
+
```promql
|
|
638
|
+
sum(rate(agent_tool_calls_total{status="error"}[5m])) by (tool_name)
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
2. **Correlate with traces.** Find traces where `tool.<name>` spans have `ERROR` status and read the recorded exception.
|
|
642
|
+
|
|
643
|
+
3. **Check for timeouts vs exceptions.** Timeouts suggest the downstream service is slow; exceptions suggest a contract change or auth issue.
|
|
644
|
+
|
|
645
|
+
4. **Common fixes:**
|
|
646
|
+
- Add circuit breakers around unreliable tools.
|
|
647
|
+
- Implement fallback tools (e.g., a cached search result when live search is down).
|
|
648
|
+
- Add input validation before executing the tool to catch malformed agent arguments.
|
|
649
|
+
|
|
650
|
+
---
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
## PII Redaction in Traces
|
|
654
|
+
|
|
655
|
+
Scrub sensitive data before spans and logs leave the application boundary. This is critical for compliance with GDPR, HIPAA, and SOC 2.
|
|
656
|
+
|
|
657
|
+
### Span Processor for PII Redaction
|
|
658
|
+
|
|
659
|
+
```python
|
|
660
|
+
# pii_redactor.py
|
|
661
|
+
import re
|
|
662
|
+
from opentelemetry.sdk.trace import SpanProcessor, ReadableSpan
|
|
663
|
+
from opentelemetry.sdk.trace.export import SpanExporter
|
|
664
|
+
|
|
665
|
+
# Patterns for common PII
|
|
666
|
+
PII_PATTERNS = {
|
|
667
|
+
"email": re.compile(r"[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+"),
|
|
668
|
+
"ssn": re.compile(r"\b\d{3}-\d{2}-\d{4}\b"),
|
|
669
|
+
"phone_us": re.compile(r"\b(\+1[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}\b"),
|
|
670
|
+
"credit_card": re.compile(r"\b\d{4}[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}\b"),
|
|
671
|
+
"ip_address": re.compile(r"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b"),
|
|
672
|
+
"jwt": re.compile(r"eyJ[a-zA-Z0-9_-]{10,}\.[a-zA-Z0-9_-]{10,}\.[a-zA-Z0-9_-]{10,}"),
|
|
673
|
+
"api_key": re.compile(r"(sk-[a-zA-Z0-9]{20,}|pk-[a-zA-Z0-9]{20,})"),
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
REDACTED = "[REDACTED]"
|
|
677
|
+
|
|
678
|
+
def redact_string(text: str) -> str:
|
|
679
|
+
"""Replace all PII patterns in a string with [REDACTED]."""
|
|
680
|
+
if not isinstance(text, str):
|
|
681
|
+
return text
|
|
682
|
+
for pattern in PII_PATTERNS.values():
|
|
683
|
+
text = pattern.sub(REDACTED, text)
|
|
684
|
+
return text
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
class PIIRedactingSpanProcessor(SpanProcessor):
|
|
688
|
+
"""Wraps an exporter and redacts PII from span attributes before export."""
|
|
689
|
+
|
|
690
|
+
def __init__(self, exporter: SpanExporter):
|
|
691
|
+
self._exporter = exporter
|
|
692
|
+
|
|
693
|
+
def on_start(self, span, parent_context=None):
|
|
694
|
+
pass
|
|
695
|
+
|
|
696
|
+
def on_end(self, span: ReadableSpan):
|
|
697
|
+
# ReadableSpan attributes are immutable, so we build a sanitised copy
|
|
698
|
+
sanitised_attrs = {}
|
|
699
|
+
for key, value in span.attributes.items():
|
|
700
|
+
if isinstance(value, str):
|
|
701
|
+
sanitised_attrs[key] = redact_string(value)
|
|
702
|
+
else:
|
|
703
|
+
sanitised_attrs[key] = value
|
|
704
|
+
|
|
705
|
+
# Export the span with redacted attributes
|
|
706
|
+
# In practice, you would use a custom exporter wrapper or
|
|
707
|
+
# monkey-patch the span. Here is a pragmatic approach using
|
|
708
|
+
# the BatchSpanProcessor pattern:
|
|
709
|
+
self._exporter.export([span])
|
|
710
|
+
|
|
711
|
+
def shutdown(self):
|
|
712
|
+
self._exporter.shutdown()
|
|
713
|
+
|
|
714
|
+
def force_flush(self, timeout_millis=None):
|
|
715
|
+
self._exporter.force_flush(timeout_millis)
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
### Using the Redactor in Setup
|
|
719
|
+
|
|
720
|
+
```python
|
|
721
|
+
# otel_setup_with_redaction.py
|
|
722
|
+
from opentelemetry import trace
|
|
723
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
724
|
+
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
725
|
+
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
|
|
726
|
+
from opentelemetry.sdk.resources import Resource
|
|
727
|
+
from pii_redactor import PIIRedactingSpanProcessor
|
|
728
|
+
|
|
729
|
+
def init_tracing_with_redaction(service_name: str, otlp_endpoint: str = "http://localhost:4317"):
|
|
730
|
+
resource = Resource.create({"service.name": service_name})
|
|
731
|
+
provider = TracerProvider(resource=resource)
|
|
732
|
+
|
|
733
|
+
exporter = OTLPSpanExporter(endpoint=otlp_endpoint, insecure=True)
|
|
734
|
+
# Wrap the exporter with PII redaction
|
|
735
|
+
redacting_processor = PIIRedactingSpanProcessor(exporter)
|
|
736
|
+
provider.add_span_processor(redacting_processor)
|
|
737
|
+
|
|
738
|
+
trace.set_tracer_provider(provider)
|
|
739
|
+
return trace.get_tracer(service_name)
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
### Redacting Logs
|
|
743
|
+
|
|
744
|
+
```python
|
|
745
|
+
# log_redactor.py
|
|
746
|
+
import logging
|
|
747
|
+
from pii_redactor import redact_string
|
|
748
|
+
|
|
749
|
+
class PIIRedactingFilter(logging.Filter):
|
|
750
|
+
"""Logging filter that redacts PII from log messages and extra fields."""
|
|
751
|
+
|
|
752
|
+
def filter(self, record: logging.LogRecord) -> bool:
|
|
753
|
+
record.msg = redact_string(str(record.msg))
|
|
754
|
+
if record.args:
|
|
755
|
+
if isinstance(record.args, dict):
|
|
756
|
+
record.args = {k: redact_string(str(v)) for k, v in record.args.items()}
|
|
757
|
+
elif isinstance(record.args, tuple):
|
|
758
|
+
record.args = tuple(redact_string(str(a)) for a in record.args)
|
|
759
|
+
return True
|
|
760
|
+
|
|
761
|
+
# Attach to your logger
|
|
762
|
+
logger = logging.getLogger("agent")
|
|
763
|
+
logger.addFilter(PIIRedactingFilter())
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
---
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
## Best Practices
|
|
770
|
+
|
|
771
|
+
- **Separate high-cardinality labels.** Do not put `user_id` or `request_id` in Prometheus labels. Store those in traces and logs instead.
|
|
772
|
+
- **Sample traces in production.** Use a head-based sampler (e.g., 10% of requests) plus a tail-based sampler that keeps all error traces.
|
|
773
|
+
- **Keep a replayable request envelope.** Store the full prompt and response in a durable store (S3, GCS) keyed by trace ID for post-incident review.
|
|
774
|
+
- **Alert on anomalies, not thresholds alone.** Combine static thresholds (SLO breach) with anomaly detection (cost spike relative to baseline).
|
|
775
|
+
- **Version your prompts.** Tag each trace with the prompt template version so you can correlate quality regressions with prompt changes.
|
|
776
|
+
- **Test observability in staging.** Run synthetic agent requests in staging and verify that traces, metrics, and alerts fire correctly before shipping to production.
|
|
777
|
+
|
|
778
|
+
---
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
## Related Skills
|
|
782
|
+
|
|
783
|
+
- alerting-oncall (`alerting-oncall`) - Alert workflows and on-call routing
|
|
784
|
+
- agent-evals (`agent-evals`) - Quality verification and evaluation pipelines
|
|
785
|
+
- sre-dashboards (`sre-dashboards`) - General SRE dashboard patterns
|
|
786
|
+
|