Skip to main content

CI Gitleaks Coverage Version

ICHYRA — Engine + ITA + Governança (README unificado)

BACKEND CANÔNICO DO PILOTO. Piloto de 100 casos ao vivo (recall 100%, FPR 0%), Judge Groq com failover Ollama, jobs assíncronos. O ichyra-engine está arquivado como referência técnica.

ECOSSISTEMA ICHYRA: src/ichyra (ITA vectorial R_transform = S_d × P × V_inv + Lotus Defense 4 camadas) + ichyra-engine (FastAPI Zero Trust, pgvector, OIDC, observabilidade) + app/governance (32 princípios) + paper_ita.md + auditoria 0 achados. Ver CHANGELOG.md.

Stack

  • Core: src/ichyra/core.py:16 IchyraITA, src/ichyra/embeddings.py:4 EmbeddingService (BAAI/bge-base-en-v1.5 configurável EMBEDDING_MODEL env, fallback hashlib)
  • Engine: FastAPI 0.110 + SQLAlchemy + pgvector Vector(384) + cosine_distance (app/services/ichyra_core.py:22), JWT OIDC RS256 app/auth/dependencies.py:19, slowapi, structlog, bleach, prometheus-fastapi-instrumentator
  • Governança: risk 0-4 app/governance/risk_classifier.py:1, checkpoint 10p checkpoint.py:1, orquestrador orchestrator.py:12, kill switch kill_switch.py:1, audit 13 campos audit.py:1
  • Deploy: docker-compose.yml:11 pgvector/pgvector:pg16 + healthcheck + prometheus/grafana (profile monitoring), alembic/versions/001_pgvector.py, Makefile make init

Arquitetura unificada

USER -> AUTH (OIDC/JWT) -> AI GATEWAY -> INPUT SECURITY (Security Architect)
    -> LOTUS One Vehicle (stripping) -> ITA evaluate (Karmic Residue 0.20)
    -> POLICY ENGINE -> TOOL PERMISSION (TTL 15min, segregação) -> OUTPUT DLP -> AUDIT -> Immunity Vector
    + Orquestrador -> Motor Políticas (porteiro) -> Kill Switch middleware

Instalação

pip install "ichyra[all]"  # langchain, llama-index, pgvector, prometheus, bleach
# ou dev:
pip install -e . -r requirements.txt
# ou engine:
pip install -r requirements.txt

Quick Start (ITA puro)

from ichyra import IchyraITA
ita = IchyraITA()  # EMBEDDING_MODEL env
res = ita.evaluate(current_context="...", proposed_action="...", feedback_history=[{"context":"...","action":"...","severity":-0.9}])
if res.magnitude > 0.4: print("bloqueado", res.magnitude)

Quick Start com LangChain / LlamaIndex / CrewAI

from ichyra.integrations.langchain import IchyraLangChainHandler
handler = IchyraLangChainHandler(feedback_history=hist)
# ChatOpenAI(callbacks=[handler])
from ichyra.integrations.llama_index import IchyraLlamaIndexGuard
guard = IchyraLlamaIndexGuard(feedback_history=hist)
guard.filter(query, response)
from ichyra.integrations.crewai import IchyraCrewAIGuard
crew = IchyraCrewAIGuard(feedback_history=hist)  # severity negativa = violação
safe_tool = crew.guard_tool(minha_tool)  # bloqueia tool perigosa
veredito = crew.check(task=tarefa, output=resposta)  # + remédio se bloquear

Como rodar (engine)

make init  # gera .env com openssl rand -hex 32
docker compose up --build  # api:8000, db pgvector, redis
# ou local:
uvicorn app.main:app --reload
# monitoring:
docker compose --profile monitoring up
# health: /health, /ready, /metrics, /v1/governance/prompt (auth)
# painel executivo: /dashboard (só leitura, agregados, sem PII)

Testes, benchmark e carga

pytest tests -q  # 49 testes
python benchmarks/benchmark_100.py  # BGE real: FPR 43.3% sem judge em thr=0.85 (ver BENCHMARK_RESULT.md; FPR 0% só com judge)
python benchmarks/benchmark_100.py --judge-real "BAAI/bge-base-en-v1.5"  # com juiz (LLM_PROVIDER + LLM_API_KEY)
py -3.13 scripts/check_judge.py  # diz se o juiz está ligado ou o que falta
py -3.13 scripts/oidc_harness.py  # OIDC real 6/6 (S-01/S-09)
# carga (exige Docker + k6): .\scripts\k6_local.ps1  # mata zumbis, sobe tudo, roda, limpa

Piloto comercial

Ver PROPOSTA_PILOTO.md (R$ 12 mil, 30 dias, critérios medidos).

Auditoria

docs/security-audit/relatorio-auditoria-seguranca.pdf v3 0 achados (era 8). gitleaks.yml bloqueia CHANGEME_GERE_AQUI.

Licença

MIT

Release files for ichyra-guard 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ichyra-guard 0.7.0
File Size Uploaded
ichyra_guard-0.7.0.tar.gz 44.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ichyra-guard 0.7.0
File Interpreter ABI Platform
ichyra_guard-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 70.7 kB

Release files / ichyra_guard-0.7.0.tar.gz

Download URL ichyra_guard-0.7.0.tar.gz
Size 44.9 kB
Tags Source
SHA-256 checksum
How to use checksums
292354420d289041e383e31aa52e678fc46053ac9a3f71cf5d93bda4fa85a351
BLAKE2b-256 checksum
How to use checksums
58aee53cd06af96175c62eb00d326cc4830a8c0bde5951264a28f7158da313f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / ichyra_guard-0.7.0-py3-none-any.whl

Download URL ichyra_guard-0.7.0-py3-none-any.whl
Size 25.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b38b9d624bbbed0ae036195ceb95dae9afe13a874096463efc931132eb626019
BLAKE2b-256 checksum
How to use checksums
c7e59e5f867b899d48ef6036618466566df394b283ac8d9d17681fac94c72a2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

0.8.0

2 release files

This release

0.7.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page