You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/safe-agent-api/README.md
+28-16Lines changed: 28 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,32 @@
1
1
# Safe Agent API
2
2
3
-
Projeto executável do **AI Agent Production Checklist**. Ele demonstra uma camada determinística de autorização para tools de agentes sem depender de LLM ou API key.
3
+
Projeto executável do **AI Agent Production Checklist**. Demonstra uma camada determinística de autorização, aprovação e auditoria para tools de agentes sem depender de LLM ou API key.
cd AI-Agent-Production-Checklist/examples/safe-agent-api
23
+
docker compose up --build
24
+
```
25
+
26
+
Abra:
27
+
28
+
- API docs: `http://127.0.0.1:8000/docs`
29
+
- health: `http://127.0.0.1:8000/health`
14
30
15
31
## Clonar e abrir no VS Code
16
32
@@ -20,15 +36,13 @@ cd AI-Agent-Production-Checklist/examples/safe-agent-api
20
36
code .
21
37
```
22
38
23
-
Crie o ambiente e instale:
24
-
25
39
### Windows PowerShell
26
40
27
41
```powershell
28
42
py -m venv .venv
29
43
.\.venv\Scripts\Activate.ps1
30
44
python -m pip install -e ".[dev]"
31
-
fastapi dev
45
+
fastapi dev app/main.py
32
46
```
33
47
34
48
### Linux/macOS
@@ -37,21 +51,16 @@ fastapi dev
37
51
python3 -m venv .venv
38
52
source .venv/bin/activate
39
53
python -m pip install -e ".[dev]"
40
-
fastapi dev
54
+
fastapi dev app/main.py
41
55
```
42
56
43
-
Abra:
44
-
45
-
- API docs: `http://127.0.0.1:8000/docs`
46
-
- health: `http://127.0.0.1:8000/health`
47
-
48
57
## Executar testes
49
58
50
59
```bash
51
60
pytest
52
61
```
53
62
54
-
## Exemplo de política
63
+
## Políticas
55
64
56
65
| Tool | Regra |
57
66
|---|---|
@@ -61,20 +70,23 @@ pytest
61
70
62
71
A autorização é executada **fora do prompt/modelo**. Um LLM pode sugerir uma ação, mas não concede a si mesmo permissão para executá-la.
63
72
64
-
## Teste manual
73
+
## Audit + correlation
74
+
75
+
`POST /v1/run-demo` recebe um `request_id`. A resposta inclui um `audit_event` cujo `correlation_id` usa o mesmo identificador. Assim uma decisão permitida ou negada pode ser ligada à execução e ao diagnóstico operacional.
65
76
66
-
POST `/v1/tool-check`:
77
+
Exemplo:
67
78
68
79
```json
69
80
{
81
+
"request_id": "req-demo-002",
70
82
"actor_tenant_id": "alpha",
71
83
"resource_tenant_id": "alpha",
72
84
"tool": "send_notification",
73
-
"human_approved": false
85
+
"human_approved": true
74
86
}
75
87
```
76
88
77
-
O resultado deve indicar `human_approval_required`.
89
+
A resposta registra `allowed`, `executed`, `reason`, tenants, tool e `human_approved`, sem armazenar prompt ou conteúdo de conversa.
0 commit comments