feat(build): attach an agent manifest attestation to built images
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- docker, go
- Domain
- build-system, infrastructure
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 7
- Forks
- 5
- Avg merge
- 3h 39m
- Merged PRs (30d)
- 1
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from orka-agents/agentkit
-
fix(pydantic-ai): CI fails with newest pydantic-ai (unexpected 'history' argument)Possibly taken @gambtho claimed this 30 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
orka-agents/agentkit#77 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
orka-agents/agentkit#76 · 3 comments ·
-
area/build area/orka area/runtime blocked enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
orka-agents/agentkit#69 ·
-
area/build area/orka area/runtime enhancement
Difficulty 4/5 3-5 days Newbie friendliness 68/100
orka-agents/agentkit#68 ·
-
area/build enhancement testing
Difficulty 5/5 Over a week Newbie friendliness 42/100
orka-agents/agentkit#65 ·
All issues in orka-agents/agentkit
Similar issues
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 62/100
DaoCloud/DaoCloud-docs#7839 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
sav-oss-org/ptusa_main#1610 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
bug status/accepted type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
microsoft/apm#4925 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
sagemathinc/sagebrush#1701 ·
Maintainers usually reply within 1 day