feat(build): attach an agent manifest attestation to built images
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- docker, go
- Ambito
- build-system, infrastructure
Direzione di ricerca
Start with pkg/build/build.go to trace buildImage() and handleAgent(), then read pkg/agentkit/effective/agent.go, pkg/agentkit/abi/render.go, and pkg/agentkit/config/validate.go for manifest inputs. Use pkg/build/build_test.go and its fakeBuildClient to check per-platform attachments, including single-platform builds. Done means deterministic manifests are attached to registry/OCI outputs, contain no secret values or instruction text, --load succeeds, and the documented format is covered by tests.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
Teams want rules such as "in production, only run agents that use our approved model endpoint" or "no agent may run a local command tool". Today there's no easy way to check these before an agent runs:
- What an agent does is written only in
/agent/agent.yamlinside the image. Reading it means pulling the image and opening its files. Policy tools such as Kyverno, Gatekeeper with Ratify, or cosign policies don't do that. - The image labels name the runtime and list what the runtime can do (
ai.agentkit.capabilities). They don't say what this agent uses: its model, its tools, or the secrets it expects.
What
When AgentKit builds an image, also attach a small JSON document that describes the agent: an agent manifest. Use the in-toto attestation format, the same format BuildKit uses for its SBOM and provenance records. Existing tools can then find it next to the image, and a signature on the image also covers it.
Example contents (the in-toto "predicate"):
{
"agentkitVersion": "v0.5.0",
"name": "url-summarizer",
"runtime": "pydantic-ai",
"abiVersion": "v1alpha1",
"agentConfigDigest": "sha256:…",
"instructionsDigest": "sha256:…",
"model": {
"provider": "openai-compatible",
"name": "gpt-4o-mini",
"baseURL": "https://api.openai.com/v1",
"apiKeyEnv": "OPENAI_API_KEY"
},
"tools": [
{"name": "fetch", "transport": "stdio", "command": ["uvx", "mcp-server-fetch"], "env": ["FETCH_TIMEOUT"]},
{"name": "toolbox", "transport": "streamable-http", "urlEnv": "TOOLBOX_ENDPOINT", "headers": ["Foundry-Features"], "auth": "bearer"}
],
"contextProviders": [{"name": "knowledge", "type": "search"}],
"env": [{"name": "REQUIRED_FOO", "required": true}],
"capabilities": ["stdio-mcp", "streamable-http-mcp"]
}
Rules:
- Names and settings only. No secret values; the build never has them anyway. No instruction text either: record only its SHA-256 (
instructionsDigest). - For headers, record names only, never values.
- Same input, same output. Use a stable field order and no timestamps, so rebuilding the same file gives an identical manifest.
- Every platform gets one. In a multi-platform build, attach a manifest to each platform's image.
- Include pinned tool packages. If #54 has landed, include each tool's pinned
package.
Out of scope
- Signing. People sign images in their own CI, as AgentKit's release workflow does. Signing the image index also covers the attestations listed inside it.
- Ready-made Kyverno or Gatekeeper policies. A follow-up can add examples.
- Changes to image labels or to
/agent/agent.yaml.
Why
- Platform teams can allow or block agents based on what they do, before they run, using policy tools they already have.
- Each build leaves a record to review: which model, which tools and which secrets the agent uses. Changes show up as a diff between two builds.
- A hand-written Dockerfile can't easily produce this. It's a reason to trust AgentKit-built images.
How
Where things are
| File | What it does |
|---|---|
pkg/build/build.go |
buildImage() builds one platform. handleAgent() combines the platforms into one client.Result. The attestation is attached here. |
pkg/agentkit/effective/agent.go |
The build-ready agent. Build the manifest from it. |
pkg/agentkit/abi/render.go |
abi.Render() returns the exact bytes of /agent/agent.yaml. Hash these bytes for agentConfigDigest. |
pkg/agentkit/config/validate.go |
requiredCapabilities() works out which capabilities an agent needs. Reuse it for capabilities. |
pkg/version/version.go |
The AgentKit version string. |
pkg/build/build_test.go |
fakeBuildClient lets you test builds without a real BuildKit. |
Steps
- Render the manifest. Add a package
pkg/agentkit/manifestwith a function likeRender(agent effective.Agent, agentYAML []byte) ([]byte, error)that returns the JSON above. Keep the field order stable. - Attach it in
buildImage(), once per platform:- Put the JSON in a file on an empty filesystem,
llb.Scratch().File(llb.Mkfile("/agent-manifest.json", 0o644, data)), and solve that to get a reference. - Add it to the result:
Leaveres.AddAttestation(platformID, client.Attestation{ Kind: gatewaypb.AttestationKindInToto, Ref: ref, Path: "/agent-manifest.json", InToto: result.InTotoAttestation{PredicateType: "https://github.com/orka-agents/agentkit/attestations/agent-manifest/v1"}, })Subjectsempty. BuildKit then points the attestation at the image itself. - Use
Ref+Path, notContentFunc. AgentKit runs as a frontend image, and BuildKit rejectsContentFuncthere withattestation callback cannot be sent through gateway.
- Put the JSON in a file on an empty filesystem,
- Platform IDs. BuildKit matches attestations to images by platform ID.
- Today
handleAgent()sets the platform list (exptypes.ExporterPlatformsKey) only for multi-platform builds. - BuildKit's own Dockerfile frontend sets it for single-platform builds too (see
frontend/dockerui/build.goin the buildkit module). You'll likely need to do the same.
- Today
--loadmust still work. Loading into Docker's classic image store may drop attestations. That's acceptable, but the build must not fail.
Tests
- A golden test for
manifest.Renderusing a full fixture with stdio and remote tools, a context provider andenventries. Compare the exact JSON. - A test that the output never contains the instruction text, header values or other config values that could be secret.
fakeBuildClienttests that the result has one attestation per platform with the right predicate type and path, for both single- and multi-platform builds.- An end-to-end check:
- Build a fixture to a registry or an OCI layout (
--output type=oci,dest=…). - Read the attestation back and compare it with the expected JSON.
- Separately, confirm that a
--loadbuild still succeeds.
- Build a fixture to a registry or an OCI layout (
Run:
go test ./...
make lint
Docs
- Add
docs/agent-manifest.md. It should cover:- every field and the predicate type;
- the stability promise: v1 only adds fields and never renames or removes them;
- one working way to read the manifest from a registry, for example
docker buildx imagetools inspect --rawto find the attestation manifest, thencraneororasto fetch it; - an example policy idea, such as blocking agents whose
model.baseURLisn't on an allow list.
- Link the new page from
README.mdunder "More docs".
Done when
- Images pushed to a registry or exported as OCI include one agent manifest attestation per platform.
- The manifest matches the documented format and contains no secret values or instruction text.
- Building the same file twice gives byte-identical manifests.
--loadbuilds still succeed.docs/agent-manifest.mdexplains the format and how to read it.
- Lingua principale
- Python
- Stelle
- 7
- Fork
- 5
- Merge medio
- 3h 39m
- PR unite (30g)
- 1
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di orka-agents/agentkit
-
fix(pydantic-ai): CI fails with newest pydantic-ai (unexpected 'history' argument)Forse già presa @gambtho l’ha presa 30 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
orka-agents/agentkit#77 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
orka-agents/agentkit#76 · 3 commenti ·
-
area/build area/orka area/runtime blocked enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
orka-agents/agentkit#69 ·
-
area/build area/orka area/runtime enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
orka-agents/agentkit#68 ·
-
area/build enhancement testing
Difficoltà 5/5 Più di una settimana Idoneità per principianti 42/100
orka-agents/agentkit#65 ·
Tutte le issue di orka-agents/agentkit
Issue simili
-
bot-triaged module: correctness (silent) module: fft triage review
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Remove Python pin in recipeAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
conda-forge/zarpaint-feedstock#8 · 1 commento · 1 reazione ·
-
plot_prediction colorbar shows a 0-1 range instead of the data rangeForse già presa @nikhil3495 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
mllam/neural-lam#902 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
didi/helixharness#28 ·
I maintainer di solito rispondono entro 1 giorno
-
【文档错误】创建镜像空间步骤中的截图标注与文字描述不一致Apertaenhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
DaoCloud/DaoCloud-docs#7839 ·
I maintainer di solito rispondono entro 1 giorno