Metadata-Version: 2.5
Name: agentspm
Version: 0.1.2
Summary: Agent Security Posture Management blueprint: vendor-neutral asset schema, OPA policy pack, read-only collectors, evidence-grade reporting. Posture, not enforcement.
Project-URL: Homepage, https://github.com/vojtahampl/agentspm
Project-URL: Repository, https://github.com/vojtahampl/agentspm
Project-URL: Changelog, https://github.com/vojtahampl/agentspm/blob/main/CHANGELOG.md
Project-URL: Security, https://github.com/vojtahampl/agentspm/blob/main/SECURITY.md
Author: agentspm maintainers
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: agent-spm,asset-graph,evidence,opa,security-posture
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security
Requires-Python: >=3.12
Requires-Dist: cryptography>=43
Requires-Dist: httpx>=0.27
Requires-Dist: jsonschema>=4.21
Requires-Dist: pydantic>=2.7
Requires-Dist: pyjwt>=2.8
Requires-Dist: pyyaml>=6.0
Requires-Dist: sqlmodel>=0.0.21
Requires-Dist: structlog>=24.1
Requires-Dist: typer>=0.12
Description-Content-Type: text/markdown

# agentspm

**Agent Security Posture Management (Agent-SPM) blueprint for EU-regulated,
self-hosted environments.** agentspm inventories the AI agents an
organization already runs — their identities, credentials, data access and
enforcement-point routing — into a vendor-neutral asset graph with
provenance, evaluates it against an auditable OPA/Rego policy pack
(13 tri-state controls), and renders evidence-grade reports whose findings
map to EU frameworks (NIS2/ZoKB, DORA, AI Act, GDPR, ISO 27001/42001 — every
mapping `status: verify` until a human with a compliance role confirms it).

> **Status: public, v0.1 line (pre-1.0 — interfaces may still move).**
> Install: `pip install agentspm` · releases carry keyless Sigstore
> signatures (verification: `docs/ARCHITECTURE.md`). All examples, fixtures
> and demo output are **synthetic only** (`example.com` / `contoso` domains,
> documented synthetic GUIDs) — see the claims rule in `docs/LANGUAGE.md`.
> No production data and no real tenant identifiers exist anywhere in this
> repository or its history (enforced by `scripts/identifier_scan.py` in
> hooks and CI).

## The problem

Organizations are deploying AI agents faster than anyone writes down what
those agents ARE: which identities they run under, which credentials and
data stores they can reach, and which enforcement point governs them. When
an auditor (or an incident) asks, the answer today is tribal knowledge.
agentspm turns that question into a scanned, evidence-grade report — without
touching or enforcing anything.

Works best next to an enforcement point such as
[ai-governance-gateway](https://github.com/vojtahampl/ai-governance-gateway)
(same author): the gateway enforces and emits a signed posture feed; agentspm
reads it — together with your IdP — into one asset graph with provenance.
Each product stands alone; the pairing is a versioned, sha256-pinned HTTP
contract, not a dependency.

## What it is NOT

- **Posture, not enforcement.** It finds, documents and maps — it never
  blocks, prevents or mutates anything. Runtime guardrails, DLP inspection
  and routing belong to an enforcement point (such as an LLM governance
  gateway); agentspm only reads its posture.
- **Not an agent framework.** It does not build, host or orchestrate agents;
  it scans the estate of agents you already have.
- **Not legal advice and not a compliance verdict.** Reports are evidence for
  your own assessment; `unknown` is reported as `unknown`, never scored as
  `fail`; framework anchors stay `status: verify` until confirmed by a person
  with a compliance role.
- No web UI, no SaaS, no multi-tenant mode, no model artifact scanning.

## Deployment model and identity providers — read this before a POC

- **Self-hosted only.** There is no hosted or SaaS offering, and the tool
  phones home to no one: one CLI, one SQLite file, your infrastructure.
  That is a design decision for regulated environments, not a missing
  feature.
- **IdP coverage today — said out loud:** the only *implemented* identity
  collector is **Microsoft Entra ID** (read-only, attribute-whitelisted).
  The gateway posture collector is IdP-agnostic (versioned HTTP contract).
  Other IdPs (Okta, Keycloak, on-prem AD) are a documented extension point
  (`docs/INTEGRATION.md`, "adding a collector"), **not shipped code** —
  if your estate lives in a different IdP, budget for writing a collector
  before you expect identity posture results.

## Support

Actively developed, **solo maintainer** — support is best-effort via GitHub
Issues; security reports go through the private channel in
[SECURITY.md](SECURITY.md) (acknowledgement target 72 h). There is no SLA
and no commercial support today. For procurement purposes this is
*internally supported OSS*: plan your own operational ownership, the same
way you would for any other tool you self-host.

## Scope vs. microsoft/agent-governance-toolkit

The nearest OSS neighbor is the Microsoft Agent Governance Toolkit (MIT) — a
**broader governance toolkit**, enforcement-first and aimed at governing
agents through their lifecycle: discovery/AgentMesh, OPA/Cedar policy,
SPIFFE/DID identity, sandboxing, tamper-evident audit, mappings to EU AI
Act/NIST AI RMF/SOC 2.

agentspm is deliberately **narrow**: a posture/evidence scanner over the
**existing** estate — read-only collectors (Entra ID, Git hosting, gateway
posture API), an asset graph with per-attribute provenance and
attested-vs-declared precedence, tri-state controls, and an evidence report
whose anchors target the EU regulatory set including the Czech ZoKB — all
self-hosted with **zero infrastructure** (one CLI, one SQLite file, no
service). If you need lifecycle governance and enforcement, use a toolkit
like AGT at the enforcement layer; agentspm is the independent posture
reading and audit-evidence layer next to it.

## Quickstart (synthetic, no network)

Runs the real pipeline against the built-in mock gateway — the output is
labeled *generated over synthetic fixtures*:

```sh
uv sync                  # install (locked); includes the dev group the mock needs
scripts/setup-hooks.sh   # MANDATORY for contributors: SEC-D5 pre-commit/pre-push hooks

# 1) OPA engine — the one external binary. Download the exact version this
#    repo pins (same version+sha256 the container build enforces):
curl -sLo "$HOME/.local/bin/opa" \
  "https://openpolicyagent.org/downloads/v1.21.4/opa_linux_amd64_static"
echo "2ab571f367f293bb19523b76f92f1945bbf245003392c7f392903f95c2b9b630  $HOME/.local/bin/opa" | sha256sum -c -
chmod +x "$HOME/.local/bin/opa"

# 2) evaluate refuses to run an unpinned OPA engine — pin the binary you trust:
export AGENTSPM_OPA_PATH="$HOME/.local/bin/opa"
export AGENTSPM_OPA_SHA256="$(sha256sum "$AGENTSPM_OPA_PATH" | cut -d' ' -f1)"

# 3) report pseudonymizes by default and needs a key location — point it at
#    a file; the key is auto-generated on first use (0600):
export AGENTSPM_PSEUDO_KEY_PATH="$PWD/.agentspm-pseudo.key"

uv run agentspm scan --collector mock-gateway   # collect -> validate -> merge -> derive
uv run agentspm evaluate                        # pinned OPA, 13 tri-state controls
uv run agentspm report --format md --out report.md   # redacted profile (default)
```

Not ready to run anything yet? The exact output of this quickstart is
committed as [docs/examples/sample-redacted-report.md](docs/examples/sample-redacted-report.md)
— synthetic fixtures, redacted profile, the real renderer.

Installed via `pip install agentspm` instead of a checkout? Everything above
works the same (the wheel ships both the schemas and the policy pack); only
the mock-gateway collector fixtures and the contributor hooks live in the
repository.

Also available: `--format json|sarif`, `agentspm export --encrypt
age:<recipient>` (requires ≥ 2 recipients), and `agentspm doctor` as the
deployment preflight. On this synthetic run `doctor` will **report failures**
(`age recipients`, and `opa sha256 pin` unless you exported the variable above)
and a warning for the unconfigured evidence store: the quickstart configures
neither, and both are export-side requirements. That is the preflight doing its
job, not a broken install — a green `doctor` is a property of a configured
deployment, not of a fresh clone. To scan your own tenant instead of the mock, follow
`docs/INTEGRATION.md`.

## Documentation

| Document | Content |
|---|---|
| [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | pipeline, components, contracts, invariants, evidence & deployment in a regulated entity, exit/fork strategy |
| [docs/INTEGRATION.md](docs/INTEGRATION.md) | bring your own tenant/IdP: dedicated app registration, exact minimal scopes, doctor, manual-run rules, adding a collector |
| [docs/PRIVACY.md](docs/PRIVACY.md) | GDPR position: purpose, art. 6(1)(f)/recital 49 with LIA template, minimization, dual-tier retention, art. 30 record, DPIA screening |
| [docs/THREAT-MODEL.md](docs/THREAT-MODEL.md) | threats T-01..T-17 with mitigations and status |
| [docs/CONTROLS.md](docs/CONTROLS.md) | generated control reference (13 controls, framework anchors, all `verify`) |
| [docs/LANGUAGE.md](docs/LANGUAGE.md) | honest-claims rules (lint-enforced) incl. the fail-closed qualification and the synthetic-fixtures claims rule |
| [docs/RELEASE-GATE.md](docs/RELEASE-GATE.md) | two-stage release gate: quality (binding even privately) and publication |
| [docs/GOVERNANCE.md](docs/GOVERNANCE.md) | schema-change process (ADR now, RFC from publication) |
| [docs/adr/](docs/adr/) | architecture decision records |

## Repository layout

- `schema/v0.1/` — JSON Schema 2020-12 contracts (asset graph, findings);
  shipped inside the wheel. `schema/examples/` — synthetic examples.
- `policies/v0.1/` — OPA/Rego policy pack: 13 tri-state controls, `opa test`
  suites, synthetic fixtures, `controls.yaml` anchors, pinned
  `capabilities.json` without network builtins.
- `src/agentspm/` — collectors, validator, graph store/merge/derive,
  evaluate, reporter (+ redaction), CLI.
- `contracts/gateway/v0.1/` — the gateway posture-read OpenAPI contract
  (owned here, vendored by consumers with a sha256 pin).
- `deploy/` — example config + Kubernetes CronJob reference;
  `Containerfile` — UBI9-minimal image; `scripts/build_release.sh` — wheel +
  SBOM + checksums.
- `scripts/` — CI/hook lints (identifier scan, language lint, policy lints).

## Development

```sh
uv sync                  # install (locked)
scripts/setup-hooks.sh   # MANDATORY: installs pre-commit/pre-push hooks (SEC-D5)
uv run pytest            # tests
uv run ruff check .      # lint
uv run mypy src/         # types (strict)
```

## License

- **Code and the OPA policy pack:** [Apache-2.0](LICENSE).
- **Documentation and the compliance framework mappings** (`docs/`, the
  NIS2/DORA/ZoKB/AI Act anchor tables in `docs/CONTROLS.md`):
  [CC-BY-4.0](docs/LICENSE-CC-BY-4.0.txt). If you reuse the mappings,
  attribute "the agentspm maintainers" and keep the `status: verify`
  qualifiers — the attribution travels with the caveat, not instead of it.
  The mappings are a reading aid, not legal advice; `status: verify` means
  exactly that.

Confirmed at the publication gate (`docs/RELEASE-GATE.md`, item P8,
2026-11-11).
