|
1 | 1 | PUBLIC_URL = "https://safe-agent-playground.onrender.com" |
2 | 2 | SOURCE_URL = "https://github.com/Videirafo/AI-Agent-Production-Checklist" |
| 3 | +SOCIAL_IMAGE_URL = ( |
| 4 | + "https://raw.githubusercontent.com/Videirafo/AI-Agent-Production-Checklist/" |
| 5 | + "main/assets/demo/safe-agent-playground.png" |
| 6 | +) |
| 7 | +RELEASE_VERSION = "0.6.0" |
| 8 | +LAST_MODIFIED = "2026-09-07" |
3 | 9 |
|
4 | 10 | LLMS_TXT = f"""# Safe Agent Playground |
5 | 11 |
|
|
9 | 15 | - [Live Playground]({PUBLIC_URL}/): interactive policy, approval, execution and audit demo |
10 | 16 | - [OpenAPI]({PUBLIC_URL}/openapi.json): machine-readable API schema |
11 | 17 | - [Swagger UI]({PUBLIC_URL}/docs): interactive API documentation |
12 | | -- [Playground Markdown]({PUBLIC_URL}/playground.md): text-first description of the demo |
| 18 | +- [Playground Markdown]({PUBLIC_URL}/index.md): text-first description of the demo |
13 | 19 | - [Source]({SOURCE_URL}): MIT-licensed source code and contribution workflow |
14 | 20 |
|
15 | 21 | ## Safety model |
|
49 | 55 |
|
50 | 56 | SITEMAP_XML = f"""<?xml version="1.0" encoding="UTF-8"?> |
51 | 57 | <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> |
52 | | - <url><loc>{PUBLIC_URL}/</loc></url> |
53 | | - <url><loc>{PUBLIC_URL}/docs</loc></url> |
54 | | - <url><loc>{PUBLIC_URL}/openapi.json</loc></url> |
55 | | - <url><loc>{PUBLIC_URL}/playground.md</loc></url> |
56 | | - <url><loc>{PUBLIC_URL}/llms.txt</loc></url> |
57 | | - <url><loc>{PUBLIC_URL}/AGENTS.md</loc></url> |
| 58 | + <url> |
| 59 | + <loc>{PUBLIC_URL}/</loc> |
| 60 | + <lastmod>{LAST_MODIFIED}</lastmod> |
| 61 | + </url> |
58 | 62 | </urlset> |
59 | 63 | """ |
60 | 64 |
|
61 | 65 | SITEMAP_MD = f"""# Safe Agent Playground Sitemap |
62 | 66 |
|
| 67 | +## Canonical page |
63 | 68 | - [Playground]({PUBLIC_URL}/) |
| 69 | +
|
| 70 | +## Developer resources |
64 | 71 | - [OpenAPI / Swagger]({PUBLIC_URL}/docs) |
65 | 72 | - [OpenAPI JSON]({PUBLIC_URL}/openapi.json) |
66 | | -- [Markdown mirror]({PUBLIC_URL}/playground.md) |
| 73 | +- [Markdown mirror]({PUBLIC_URL}/index.md) |
67 | 74 | - [LLM discovery]({PUBLIC_URL}/llms.txt) |
68 | 75 | - [Agent instructions]({PUBLIC_URL}/AGENTS.md) |
69 | 76 | - [Source code]({SOURCE_URL}) |
70 | 77 | """ |
71 | 78 |
|
72 | 79 | AGENTS_MD = f"""# AGENTS.md |
73 | 80 |
|
74 | | -## Purpose |
75 | | -Safe Agent Playground demonstrates production boundaries for AI-agent tool execution. |
| 81 | +Safe Agent Playground demonstrates production boundaries for AI-agent tool execution. Core invariant: Model suggestion is not authorization. Authorization is enforced by deterministic application policy outside the model. |
| 82 | +
|
| 83 | +## Installation |
| 84 | +
|
| 85 | +Clone the source and install the example in an isolated Python environment: |
| 86 | +
|
| 87 | +```bash |
| 88 | +git clone {SOURCE_URL}.git |
| 89 | +cd AI-Agent-Production-Checklist/examples/safe-agent-api |
| 90 | +python -m venv .venv |
| 91 | +pip install -e \".[dev]\" |
| 92 | +``` |
| 93 | +
|
| 94 | +Docker is also supported through the repository's `docker compose` configuration. |
| 95 | +
|
| 96 | +## Configuration |
| 97 | +
|
| 98 | +No secrets, API keys, LLM provider, external database, or signup are required. The public demo is intentionally deterministic and simulated. Do not send credentials, private customer data, proprietary payloads, or secrets. |
76 | 99 |
|
77 | | -## Core invariant |
78 | | -Model suggestion is not authorization. Authorization is enforced by deterministic application policy outside the model. |
| 100 | +## Usage |
79 | 101 |
|
80 | | -## Public API |
| 102 | +Public endpoints: |
| 103 | +- GET {PUBLIC_URL}/ |
81 | 104 | - GET {PUBLIC_URL}/health |
82 | 105 | - POST {PUBLIC_URL}/v1/tool-check |
83 | 106 | - POST {PUBLIC_URL}/v1/run-demo |
84 | 107 | - GET {PUBLIC_URL}/openapi.json |
85 | 108 |
|
86 | | -## Safe usage |
87 | | -The public demo is deterministic and simulated. It performs no real notification, deletion or tenant data access. Do not send secrets, credentials, private customer data or proprietary payloads. |
| 109 | +The model may suggest an action, but the application policy decides whether execution is permitted. |
88 | 110 |
|
89 | | -## Contribution source |
90 | | -{SOURCE_URL} |
| 111 | +## Examples |
| 112 | +
|
| 113 | +Use the browser Playground to run five reference scenarios: same-tenant read, cross-tenant denial, approval-required notification, approved notification, and blocked destructive delete. |
| 114 | +
|
| 115 | +For API examples and the exact schema, use {PUBLIC_URL}/docs or {PUBLIC_URL}/openapi.json. |
| 116 | +
|
| 117 | +## Contribution |
| 118 | +
|
| 119 | +Source, tests, issues, and contribution workflow: {SOURCE_URL} |
91 | 120 | """ |
92 | 121 |
|
93 | | -PLAYGROUND_MD = f"""# Safe Agent Playground |
| 122 | +PLAYGROUND_MD = f"""--- |
| 123 | +title: Safe Agent Playground |
| 124 | +description: Runnable open-source FastAPI demo for deterministic AI-agent tool authorization boundaries. |
| 125 | +canonical: {PUBLIC_URL}/ |
| 126 | +version: {RELEASE_VERSION} |
| 127 | +last_modified: {LAST_MODIFIED} |
| 128 | +--- |
| 129 | +
|
| 130 | +# Safe Agent Playground |
94 | 131 |
|
95 | | -Safe Agent Playground is an MIT-licensed FastAPI demo showing how agent tool execution can remain outside model authority. |
| 132 | +Safe Agent Playground is an MIT-licensed FastAPI demo showing how agent tool execution can remain outside model authority. The model may suggest an action, while deterministic application policy, tenant boundaries, and human approval decide whether execution is allowed. |
96 | 133 |
|
97 | 134 | ## Live demo |
| 135 | +
|
98 | 136 | {PUBLIC_URL}/ |
99 | 137 |
|
100 | 138 | ## What it demonstrates |
101 | | -- tenant isolation |
102 | | -- deterministic tool policies |
103 | | -- human approval gates |
104 | | -- destructive-action denial |
105 | | -- structured audit events |
106 | | -- correlation IDs |
| 139 | +
|
| 140 | +- tenant isolation; |
| 141 | +- deterministic tool policies; |
| 142 | +- human approval gates; |
| 143 | +- destructive-action denial; |
| 144 | +- structured audit events; |
| 145 | +- correlation IDs; |
| 146 | +- an execution boundary that does not depend on an LLM making its own authorization decision. |
107 | 147 |
|
108 | 148 | ## Scenarios |
| 149 | +
|
109 | 150 | | Scenario | Expected result | |
110 | 151 | |---|---| |
111 | 152 | | same-tenant read_record | allowed and executed | |
|
115 | 156 | | delete_record | denied: destructive_tool_disabled_in_demo | |
116 | 157 |
|
117 | 158 | ## Flow |
118 | | -`model suggestion -> policy -> approval -> execution -> audit -> correlation` |
| 159 | +
|
| 160 | +```text |
| 161 | +model suggestion -> policy -> approval -> execution -> audit -> correlation |
| 162 | +``` |
119 | 163 |
|
120 | 164 | ## API |
| 165 | +
|
121 | 166 | - [Swagger]({PUBLIC_URL}/docs) |
122 | 167 | - [OpenAPI JSON]({PUBLIC_URL}/openapi.json) |
123 | 168 | - [Health]({PUBLIC_URL}/health) |
124 | 169 |
|
| 170 | +## Sitemap |
| 171 | +
|
| 172 | +- [Canonical Playground]({PUBLIC_URL}/) |
| 173 | +- [Agent discovery]({PUBLIC_URL}/llms.txt) |
| 174 | +- [Agent instructions]({PUBLIC_URL}/AGENTS.md) |
| 175 | +- [Human-readable sitemap]({PUBLIC_URL}/sitemap.md) |
| 176 | +
|
125 | 177 | ## Source and contributions |
| 178 | +
|
126 | 179 | {SOURCE_URL} |
127 | 180 | """ |
128 | 181 |
|
129 | | -HEAD_DISCOVERY_HTML = f'''\n <meta name="description" content="Runnable open-source Safe Agent Playground demonstrating tenant isolation, deterministic tool policy, human approval, audit events and correlation IDs for AI-agent execution." />\n <meta name="robots" content="index, follow, max-snippet:-1, max-image-preview:large" />\n <link rel="canonical" href="{PUBLIC_URL}/" />\n <link rel="describedby" href="/llms.txt" />\n <link rel="alternate" type="text/markdown" href="/playground.md" />\n <meta property="og:title" content="Safe Agent Playground" />\n <meta property="og:description" content="Try deterministic agent-tool authorization, human approvals, tenant isolation and audit correlation in a runnable FastAPI demo." />\n <meta property="og:type" content="website" />\n <meta property="og:url" content="{PUBLIC_URL}/" />\n <meta name="twitter:card" content="summary" />\n <script type="application/ld+json">{{"@context":"https://schema.org","@type":"SoftwareApplication","name":"Safe Agent Playground","description":"Runnable open-source demo for AI-agent tool authorization boundaries.","url":"{PUBLIC_URL}/","applicationCategory":"DeveloperApplication","operatingSystem":"Web","codeRepository":"{SOURCE_URL}"}}</script>\n''' |
| 182 | +HEAD_DISCOVERY_HTML = f'''\n <meta name="description" content="Runnable open-source Safe Agent Playground demonstrating tenant isolation, deterministic tool policy, human approval, audit events and correlation IDs for AI-agent execution." />\n <meta name="robots" content="index, follow, max-snippet:-1, max-image-preview:large" />\n <link rel="canonical" href="{PUBLIC_URL}/" />\n <link rel="describedby" href="/llms.txt" />\n <link rel="alternate" type="text/markdown" href="/index.md" />\n <meta property="og:title" content="Safe Agent Playground" />\n <meta property="og:description" content="Try deterministic agent-tool authorization, human approvals, tenant isolation and audit correlation in a runnable FastAPI demo." />\n <meta property="og:type" content="website" />\n <meta property="og:url" content="{PUBLIC_URL}/" />\n <meta property="og:image" content="{SOCIAL_IMAGE_URL}" />\n <meta name="twitter:card" content="summary_large_image" />\n <meta name="twitter:title" content="Safe Agent Playground" />\n <meta name="twitter:description" content="Runnable open-source demo for AI-agent tool authorization boundaries." />\n <meta name="twitter:image" content="{SOCIAL_IMAGE_URL}" />\n <script type="application/ld+json">{{"@context":"https://schema.org","@type":"SoftwareApplication","name":"Safe Agent Playground","headline":"Safe Agent Playground","description":"Runnable open-source demo for AI-agent tool authorization boundaries.","url":"{PUBLIC_URL}/","dateModified":"{LAST_MODIFIED}","softwareVersion":"{RELEASE_VERSION}","applicationCategory":"DeveloperApplication","operatingSystem":"Web","codeRepository":"{SOURCE_URL}"}}</script>\n''' |
| 183 | + |
| 184 | +DISCOVERY_BODY_HTML = f'''\n <section class="card" style="margin-top:20px" aria-labelledby="why-title">\n <h2 id="why-title">Why this demo exists</h2>\n <p>Many AI-agent examples demonstrate how a model selects or calls a tool, but production systems need a separate authorization boundary. This Playground makes that boundary visible: tenant scope is checked first, sensitive actions can require human approval, destructive actions remain blocked, and every decision can be correlated with an audit event.</p>\n <h3>What to evaluate</h3>\n <p>Try an allowed same-tenant read, then change the resource tenant and observe the denial. Compare a notification request before and after human approval. Finally, try the destructive delete scenario and verify that approval alone cannot bypass a policy that disables the tool. The purpose is not to simulate intelligence; it is to make execution policy deterministic, inspectable, testable, and independent from model persuasion.</p>\n <p>Machine-readable resources are available through <a href="/openapi.json">OpenAPI</a>, <a href="/llms.txt">llms.txt</a>, <a href="/AGENTS.md">AGENTS.md</a>, and the <a href="/index.md">Markdown mirror</a>.</p>\n </section>\n''' |
0 commit comments