Core Concepts and Architecture
Understand the main building blocks behind Bloqr AI, including policy evaluation, filtering flows, and observability. This page explains how the system is structured and how the pieces fit together.
Overview
Bloqr Systems organizes policy-driven AI protection around a small set of core ideas: requests enter a filtering pipeline, rules evaluate the content, and observability data helps you understand what happened and why. This starter-kit page gives you a practical mental model you can adapt to your own product and deployment.
At a high level, you can think about the system as four layers: input, policy, decision, and telemetry. Each layer is intentionally narrow so you can change one part without rewriting the others. That separation also makes it easier to test policy changes before you apply them broadly.
This page is sample documentation for a starter kit. Replace the terminology, endpoints, and examples with your own product details as needed.
Core Concepts
Policy
Defines the conditions that determine whether content passes, blocks, or gets reviewed.
Filter
Examines incoming content and applies the active policy set in order.
Rule
A single evaluation unit that checks one signal, pattern, or constraint.
Telemetry
Captures decisions, latency, and traces so you can investigate behavior later.
Policy
A policy is the top-level configuration object that groups related rules and defines the action to take when a condition matches. In practice, you usually split policies by tenant, environment, route, or workload.
Filter
A filter is the execution path that inspects a request. It can normalize the input, score it, and decide whether to allow, block, redact, or forward it for further review.
Rule
A rule is the smallest decision unit. Rules usually check one thing at a time, such as a keyword pattern, a confidence threshold, or a user context attribute.
Telemetry
Telemetry gives you visibility into what the system did. You typically record a request identifier, matched rules, latency, and the final outcome so you can audit changes over time.
Request and Policy Flow
Receive the request
The client sends content to the filtering layer, usually alongside metadata such as tenant, route, and request type.
Normalize input
The system cleans and structures the payload so downstream rules evaluate consistent data.
Evaluate policy
The active policy runs rules in sequence or in a weighted model, depending on your configuration.
Return a decision
The system returns allow, block, or review along with a reason code and trace details.
A simple request flow often looks like this:
What the flow optimizes for
You want the flow to be fast, explainable, and easy to observe. Fast decisions keep your application responsive. Explainable decisions help your team understand why a request was blocked or transformed. Observable decisions let you detect regressions when policy changes roll out.
Rule Evaluation Lifecycle
const request = {
id: "req_8f31c2",
tenant: "acme",
route: "chat.completions",
content: "Please summarize the attached policy document."
};
const evaluation = await client.evaluate(request);
console.log(evaluation.decision);
console.log(evaluation.matchedRules);
request = {
"id": "req_8f31c2",
"tenant": "acme",
"route": "chat.completions",
"content": "Please summarize the attached policy document."
}
evaluation = client.evaluate(request)
print(evaluation.decision)
print(evaluation.matched_rules)
A rule evaluation lifecycle commonly includes these stages:
- Parse the request and extract the fields you need.
- Run normalization so the same content produces the same signals.
- Match the request against active policy rules.
- Produce a decision and optional remediation details.
- Emit structured telemetry for audit and analysis.
Example decision fields
| Field | Meaning | Example |
|---|---|---|
decision | Final outcome of the evaluation | allow |
reason | Short machine-readable explanation | policy_match |
latency_ms | Time spent evaluating the request | 18 |
matched_rules | Rules that contributed to the result | ["prompt_safety", "pii_scan"] |
Observability Model
Observability is the control plane for your policy system. It tells you whether the filter is healthy, which rules are active, and how often each outcome occurs. If you only track blocked requests, you miss the baseline that helps you spot drift.
Use three signals together:
- Logs for event-level detail and troubleshooting.
- Metrics for trends, rates, and alerting.
- Traces for end-to-end timing across the request path.
Track the request identifier in every log entry and trace span. That single field makes correlation much easier when you debug a policy issue.
Recommended dashboard signals
| Signal | Why it matters |
|---|---|
| Decision rate | Shows how often content is allowed, blocked, or reviewed. |
| Rule hit rate | Identifies rules that fire too frequently or not at all. |
| Evaluation latency | Reveals whether policy checks are slowing requests down. |
| Error rate | Helps you catch malformed inputs or configuration problems. |
Platform Approaches
Use inline evaluation when you need an immediate decision before the application continues.
const result = await client.filter({
tenant: "acme",
content: "Draft a customer support reply."
});
if (result.decision === "block") {
throw new Error("Content rejected by policy");
}
Use async review when you want to accept the request first and reconcile the decision later.
const result = await client.queueReview({
tenant: "acme",
content: "Draft a customer support reply."
});
console.log(result.reviewId);
Use event-driven flows when you want to push decisions into downstream systems.
await client.publishDecision({
tenant: "acme",
decision: "allow",
requestId: "req_8f31c2"
});
Best Practices
Break large rule sets into smaller groups with clear ownership. Keep one concern per rule where possible, and document the reason code for each decision so operators can understand the outcome quickly.
Next Steps
Use this architecture model to map your own product concepts into a clean documentation structure. Once you define your policy vocabulary and telemetry fields, you can extend this page with concrete endpoints, sample payloads, and operational guides.