<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tutorial on CPEX Documentation</title><link>https://contextforge-org.github.io/cpex/docs/tutorial/</link><description>Recent content in Tutorial on CPEX Documentation</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://contextforge-org.github.io/cpex/docs/tutorial/index.xml" rel="self" type="application/rss+xml"/><item><title>Setup &amp; orientation</title><link>https://contextforge-org.github.io/cpex/docs/tutorial/00-setup/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://contextforge-org.github.io/cpex/docs/tutorial/00-setup/</guid><description>&lt;h1 id="module-0-setup--orientation"&gt;Module 0: Setup &amp;amp; orientation&lt;a class="anchor" href="#module-0-setup--orientation"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;You are in the &lt;a href="https://contextforge-org.github.io/cpex/docs/tutorial/"&gt;CPEX tutorial&lt;/a&gt;. This module gets you oriented and checks your setup. It changes nothing on your system.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; understand what CPEX is, confirm your toolchain, and know which modules need the IdP.&lt;/p&gt;
&lt;h2 id="what-cpex-is"&gt;What CPEX is&lt;a class="anchor" href="#what-cpex-is"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;CPEX is a policy enforcement runtime for AI agents. It is a deterministic reference monitor between an agent and every capability it invokes: tools, prompts, resources, inference providers. Each capability defines its own enforcement pipeline (authorization, delegation, redaction, information-flow control, audit), written declaratively in &lt;a href="https://contextforge-org.github.io/cpex/docs/apl/"&gt;APL&lt;/a&gt; and run at the boundary.&lt;/p&gt;</description></item><item><title>Hello, enforcement</title><link>https://contextforge-org.github.io/cpex/docs/tutorial/01-hello/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://contextforge-org.github.io/cpex/docs/tutorial/01-hello/</guid><description>&lt;h1 id="module-1-hello-enforcement"&gt;Module 1: Hello, enforcement&lt;a class="anchor" href="#module-1-hello-enforcement"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;You are in the &lt;a href="https://contextforge-org.github.io/cpex/docs/tutorial/"&gt;CPEX tutorial&lt;/a&gt;. No IdP needed for this module.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; stand up the smallest possible CPEX enforcement point and see a route allow one call and deny another, with no application logic making the decision.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The problem&lt;a class="anchor" href="#the-problem"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You have tools an agent can call. Some should be gated, some open. You do not want that decision scattered through handler code, where it drifts and is hard to audit. You want it in one place, declarative, at the boundary.&lt;/p&gt;</description></item><item><title>Who's calling?</title><link>https://contextforge-org.github.io/cpex/docs/tutorial/02-identity/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://contextforge-org.github.io/cpex/docs/tutorial/02-identity/</guid><description>&lt;h1 id="module-2-whos-calling-identity"&gt;Module 2: Who&amp;rsquo;s calling? (Identity)&lt;a class="anchor" href="#module-2-whos-calling-identity"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;You are in the &lt;a href="https://contextforge-org.github.io/cpex/docs/tutorial/"&gt;CPEX tutorial&lt;/a&gt;. This module needs the IdP. Start it first:
&lt;code&gt;docker compose -f examples/tutorial/idp/docker-compose.yml up -d&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; resolve a real bearer token into a subject (an id, roles, and permissions) so authorization predicates have something to read.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The problem&lt;a class="anchor" href="#the-problem"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In module 1, &lt;code&gt;require(role.hr)&lt;/code&gt; denied everyone because nobody had a role. Roles and permissions come from identity: a verified token the caller presents. CPEX turns that token into attributes policy can gate on, and it must do so without trusting anything the caller could forge.&lt;/p&gt;</description></item><item><title>Shaping data</title><link>https://contextforge-org.github.io/cpex/docs/tutorial/03-shaping/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://contextforge-org.github.io/cpex/docs/tutorial/03-shaping/</guid><description>&lt;h1 id="module-3-shaping-data"&gt;Module 3: Shaping data&lt;a class="anchor" href="#module-3-shaping-data"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;You are in the &lt;a href="https://contextforge-org.github.io/cpex/docs/tutorial/"&gt;CPEX tutorial&lt;/a&gt;. Runs without the IdP (redaction fires for anonymous callers). The full contrast needs it.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; return a different view of the same backend record per caller, by transforming the result on the way out with redact and mask, gated by permission.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The problem&lt;a class="anchor" href="#the-problem"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;An HR analyst with clearance should see an employee&amp;rsquo;s SSN. One without should get the record with the SSN removed. Not a different endpoint, not a second query: the same call with a field stripped. The backend returns the full record, so policy must shape it before it leaves the boundary.&lt;/p&gt;</description></item><item><title>Effects &amp; sequencing</title><link>https://contextforge-org.github.io/cpex/docs/tutorial/04-effects/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://contextforge-org.github.io/cpex/docs/tutorial/04-effects/</guid><description>&lt;h1 id="module-4-effects--sequencing"&gt;Module 4: Effects &amp;amp; sequencing&lt;a class="anchor" href="#module-4-effects--sequencing"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;You are in the &lt;a href="https://contextforge-org.github.io/cpex/docs/tutorial/"&gt;CPEX tutorial&lt;/a&gt;. Runs without the IdP.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; compose several effects in an ordered pipeline that halts on the first denial, run a side-effecting plugin (audit), and emit your own machine-readable denial code.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The problem&lt;a class="anchor" href="#the-problem"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Real routes do more than one thing. They audit the attempt, apply a business rule, then check authorization, in a specific order, where a denial stops everything after it but not the side effects before it. You need to see and control that ordering.&lt;/p&gt;</description></item><item><title>Delegating decisions (PDP)</title><link>https://contextforge-org.github.io/cpex/docs/tutorial/05-pdp/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://contextforge-org.github.io/cpex/docs/tutorial/05-pdp/</guid><description>&lt;h1 id="module-5-delegating-decisions-pdp"&gt;Module 5: Delegating decisions (PDP)&lt;a class="anchor" href="#module-5-delegating-decisions-pdp"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;You are in the &lt;a href="https://contextforge-org.github.io/cpex/docs/tutorial/"&gt;CPEX tutorial&lt;/a&gt;. This module needs the IdP.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; hand an authorization decision to a policy engine (a PDP) instead of writing it as a list of &lt;code&gt;require()&lt;/code&gt; predicates, then let CPEX enforce the engine&amp;rsquo;s verdict.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The problem&lt;a class="anchor" href="#the-problem"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Some rules mix several inputs at once: &amp;ldquo;engineers may search internal repos only; security may search anything.&amp;rdquo; Expressing that as separate &lt;code&gt;require()&lt;/code&gt; lines is awkward and easy to get wrong. A rule engine expression states it directly.&lt;/p&gt;</description></item><item><title>Scoped credentials (Delegation)</title><link>https://contextforge-org.github.io/cpex/docs/tutorial/06-delegation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://contextforge-org.github.io/cpex/docs/tutorial/06-delegation/</guid><description>&lt;h1 id="module-6-scoped-credentials-delegation"&gt;Module 6: Scoped credentials (Delegation)&lt;a class="anchor" href="#module-6-scoped-credentials-delegation"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;You are in the &lt;a href="https://contextforge-org.github.io/cpex/docs/tutorial/"&gt;CPEX tutorial&lt;/a&gt;. This module needs the IdP.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; mint a narrow, downstream-scoped credential for a call with a real OAuth 2.0 token exchange (RFC 8693), instead of forwarding the caller&amp;rsquo;s full token.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The problem&lt;a class="anchor" href="#the-problem"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When your agent calls a downstream API, handing it the caller&amp;rsquo;s original token is over-broad: that token works everywhere, for everything the caller can do. You want a token minted for this one downstream call, scoped to a single audience, so a leak is contained. Token exchange does that, and CPEX makes it a policy step rather than integration code.&lt;/p&gt;</description></item><item><title>Information flow (Tainting)</title><link>https://contextforge-org.github.io/cpex/docs/tutorial/07-tainting/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://contextforge-org.github.io/cpex/docs/tutorial/07-tainting/</guid><description>&lt;h1 id="module-7-information-flow-tainting"&gt;Module 7: Information flow (Tainting)&lt;a class="anchor" href="#module-7-information-flow-tainting"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;You are in the &lt;a href="https://contextforge-org.github.io/cpex/docs/tutorial/"&gt;CPEX tutorial&lt;/a&gt;. This module needs the IdP.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; carry security state across a session so a later request can be denied because of what an earlier one did. This is how CPEX stops write-down.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The problem&lt;a class="anchor" href="#the-problem"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Most authorization systems judge each request alone. That misses a whole class of leaks: a caller reads sensitive data, then sends it out through a channel that looks harmless on its own. You want the second call blocked because of the first, even though nothing about the second call is suspicious in isolation.&lt;/p&gt;</description></item><item><title>Human in the loop</title><link>https://contextforge-org.github.io/cpex/docs/tutorial/08-elicitation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://contextforge-org.github.io/cpex/docs/tutorial/08-elicitation/</guid><description>&lt;h1 id="module-8-human-in-the-loop-elicitation"&gt;Module 8: Human in the loop (Elicitation)&lt;a class="anchor" href="#module-8-human-in-the-loop-elicitation"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;You are in the &lt;a href="https://contextforge-org.github.io/cpex/docs/tutorial/"&gt;CPEX tutorial&lt;/a&gt;. This module needs the IdP.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; suspend a sensitive operation until a human approves it, then resume it. The agent cannot proceed on its own.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The problem&lt;a class="anchor" href="#the-problem"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Some actions are too consequential to run on the agent&amp;rsquo;s say-so: a large transfer, an irreversible change, an outbound message to a client. You want policy to pause the call, ask a human, and only continue once they approve. That means the operation must be able to suspend and resume, not just allow or deny.&lt;/p&gt;</description></item><item><title>Write your own plugin</title><link>https://contextforge-org.github.io/cpex/docs/tutorial/09-custom-plugin/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://contextforge-org.github.io/cpex/docs/tutorial/09-custom-plugin/</guid><description>&lt;h1 id="module-9-write-your-own-plugin"&gt;Module 9: Write your own plugin&lt;a class="anchor" href="#module-9-write-your-own-plugin"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;You are in the &lt;a href="https://contextforge-org.github.io/cpex/docs/tutorial/"&gt;CPEX tutorial&lt;/a&gt;. Runs without the IdP.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; write a plugin for a check the builtins do not ship, register it, and reference it from policy by name, exactly like a builtin.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The problem&lt;a class="anchor" href="#the-problem"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The bundled plugins cover common needs, but your domain has its own rules. You need a way to drop custom logic into the pipeline without forking CPEX, and to wire it from policy the same way you wire a builtin.&lt;/p&gt;</description></item><item><title>Testing your policy</title><link>https://contextforge-org.github.io/cpex/docs/tutorial/10-testing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://contextforge-org.github.io/cpex/docs/tutorial/10-testing/</guid><description>&lt;h1 id="module-10-testing-your-policy"&gt;Module 10: Testing your policy&lt;a class="anchor" href="#module-10-testing-your-policy"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;You are in the &lt;a href="https://contextforge-org.github.io/cpex/docs/tutorial/"&gt;CPEX tutorial&lt;/a&gt;. Runs without the IdP.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; test policy the way you test code. Load a policy, drive routes with a fake backend, and assert the outcome, so a policy change that breaks a rule fails CI.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The problem&lt;a class="anchor" href="#the-problem"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Policy decides who sees what. A careless edit can silently open a route or over-redact a field. You want the allow and deny matrix pinned by tests that run on every change, without standing up an IdP or a real backend for the cases that do not need one.&lt;/p&gt;</description></item><item><title>Capstone</title><link>https://contextforge-org.github.io/cpex/docs/tutorial/capstone/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://contextforge-org.github.io/cpex/docs/tutorial/capstone/</guid><description>&lt;h1 id="capstone-the-three-backend-agent"&gt;Capstone: the three-backend agent&lt;a class="anchor" href="#capstone-the-three-backend-agent"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;You are in the &lt;a href="https://contextforge-org.github.io/cpex/docs/tutorial/"&gt;CPEX tutorial&lt;/a&gt;. This needs the IdP.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; assemble everything into the full scenario from the &lt;a href="https://contextforge-org.github.io/cpex/docs/overview/"&gt;Overview&lt;/a&gt;: one agent, three backends, three callers, one policy. See identity, permission, delegation, redaction, information flow, and audit compose.&lt;/p&gt;
&lt;h2 id="the-scenario"&gt;The scenario&lt;a class="anchor" href="#the-scenario"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;One policy (&lt;a href="https://github.com/contextforge-org/cpex/tree/main/examples/tutorial/policies/capstone.yaml"&gt;&lt;code&gt;policies/capstone.yaml&lt;/code&gt;&lt;/a&gt;) defines three routes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;get_compensation&lt;/code&gt; (HR): authorize by role, mint a scoped downstream token, taint the session as having read secret data, audit, and redact fields by permission on the way out.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;search_repos&lt;/code&gt; (repos): hand the decision to CEL: engineers read internal only, security reads any.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;send_email&lt;/code&gt; (email): refuse if the session already touched secret data, and audit every attempt.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;get_compensation&lt;/code&gt; is the densest route, and it runs each control you built in order:&lt;/p&gt;</description></item></channel></rss>