Documentation
¶
Overview ¶
Package agentsuite defines and validates the draft AgentSuite artifact format.
It contains the portable data model, canonical JSON serialization, schemas, and offline conformance validation. Packing, registry transfer, sandbox construction, and builder-owned image metadata belong to implementations such as kmx.
Index ¶
- Constants
- func DescriptorSizeAndDigestMatch(data []byte, descriptor Descriptor) bool
- func Digest(data []byte) (string, error)
- func IsValidDigest(value string) bool
- func Marshal(value any) ([]byte, error)
- func MatchesCanonicalDescriptor(data []byte, descriptor Descriptor) bool
- func Unmarshal(data []byte, out any) error
- func ValidateImageReference(value string) error
- type AffectedAgent
- type Agent
- type AgentInvoke
- type AgentPlatform
- type BrokeredCredential
- type BuildProfile
- type Composition
- type CompositionRef
- type CompositionSelection
- type DelegatedAuthorization
- type Descriptor
- type DiffIdentity
- type DiffLimitError
- type DiffReport
- type DiffSummary
- type EnvironmentName
- type EvaluationAssertion
- type EvaluationCase
- type EvaluationIndex
- type EvaluationLimits
- type Extension
- type FieldChange
- type FileRef
- type InventoryEntry
- type ManifestRef
- type ModelRequirement
- type NetworkAccess
- type Platform
- type PlatformImage
- type RecordChange
- type RemoteHeader
- type RemoteNetworkRequirement
- type RemoteTimeouts
- type RemoteToolProvider
- type Report
- type ResolvedToolProvider
- type RuntimeRequirement
- type SecretKeyRef
- type Suite
- type Tool
- type ToolProvider
- type ToolProviderCatalog
- type ToolProviderComposition
- type ToolProviderCompositionRef
- type ToolProviderDependency
- type ToolProviderRequirement
- type ToolProviderVariant
Constants ¶
const ( DiffAdded = "added" DiffRemoved = "removed" DiffModified = "modified" DiffReportSchemaVersion = "kmx.agentsuite.diff/v1" )
const ( SpecVersion = "1.0.0-draft" LayoutVersion = "1.0.0" MediaTypeArtifact = "application/vnd.agentsuite.suite.v1" MediaTypeEmptyConfig = "application/vnd.oci.empty.v1+json" MediaTypeContent = "application/vnd.agentsuite.content.v1.tar+gzip" MediaTypeSuite = "application/vnd.agentsuite.manifest.v1+json" MediaTypeAgent = "application/vnd.agentsuite.agent.v1+json" MediaTypeEvaluationIndex = "application/vnd.agentsuite.eval.index.v1+json" MediaTypeEvaluationCase = "application/vnd.agentsuite.eval.case.v1+json" MediaTypeToolProviderCatalog = "application/vnd.agentsuite.tool.provider.catalog.v1+json" MediaTypeToolProvider = "application/vnd.agentsuite.tool.provider.v1+json" MediaTypeToolProviderComposition = "application/vnd.agentsuite.tool.provider.composition.v1+json" MediaTypeComposition = "application/vnd.agentsuite.composition.v1+json" MediaTypeBuildProfile = "application/vnd.agentsuite.build.profile.v1+json" MediaTypeInstructions = "text/markdown; charset=utf-8" MediaTypeJSONSchema = "application/schema+json" )
Variables ¶
This section is empty.
Functions ¶
func DescriptorSizeAndDigestMatch ¶
func DescriptorSizeAndDigestMatch(data []byte, descriptor Descriptor) bool
DescriptorSizeAndDigestMatch performs the cheap length and raw-byte digest comparison against descriptor, without canonicalizing data at all. It lets a caller reject a size/digest-mismatched document before investing in full JSON parsing (strict decoding, canonicalization, or reflection-based field checks). It does not confirm that data is itself stored in canonical form; callers that parse data after this check still need MatchesCanonicalDescriptor to enforce that invariant.
func IsValidDigest ¶
IsValidDigest reports whether value is a canonical AgentSuite SHA-256 digest.
func MatchesCanonicalDescriptor ¶
func MatchesCanonicalDescriptor(data []byte, descriptor Descriptor) bool
MatchesCanonicalDescriptor reports whether data is itself stored as its own RFC 8785 JCS canonical bytes, and whether descriptor's digest and size describe that same canonical representation. A descriptor binding canonical identity is satisfied only when the stored bytes are already canonical: differently formatted (for example pretty-printed) but semantically equivalent JSON is rejected, since a consumer must be able to load the referenced bytes directly without re-canonicalizing them first. Callers outside this package (for example builders that re-read pinned child manifests) should use this instead of re-deriving digest/size checks by hand, so every consumer enforces the same stored-byte identity rule.
func Unmarshal ¶
Unmarshal decodes one strict AgentSuite JSON document.
It rejects duplicate or unknown fields, invalid UTF-8, lossy JCS number representations, trailing values, and documents exceeding the format's declared implementation limits.
func ValidateImageReference ¶
ValidateImageReference requires a registry-qualified, sha256-digested image reference with a valid registry authority.
Types ¶
type AffectedAgent ¶
type Agent ¶
type Agent struct {
SchemaVersion string `json:"schemaVersion"`
MediaType string `json:"mediaType"`
ID string `json:"id"`
Description string `json:"description,omitempty"`
Instructions FileRef `json:"instructions"`
Model ModelRequirement `json:"model"`
ToolProviders []ToolProviderRequirement `json:"toolProviders,omitempty"`
Invokes []AgentInvoke `json:"invokes,omitempty"`
Evals []FileRef `json:"evals,omitempty"`
Extensions []Extension `json:"extensions,omitempty"`
}
type AgentInvoke ¶
type AgentPlatform ¶
type BrokeredCredential ¶
type BrokeredCredential struct {
Resolution string `json:"resolution"`
BindingRef string `json:"bindingRef"`
}
BrokeredCredential declares that credential resolution and injection for a delegated-user authorization requirement are brokered entirely by the runtime. It never contains a credential value.
type BuildProfile ¶
type BuildProfile struct {
SchemaVersion string `json:"schemaVersion"`
MediaType string `json:"mediaType"`
ID string `json:"id"`
RuntimeBase []PlatformImage `json:"runtimeBase"`
Harness []PlatformImage `json:"harness"`
SourceEpoch int64 `json:"sourceEpoch"`
}
type Composition ¶
type CompositionRef ¶
type CompositionRef struct {
Agent string `json:"agent"`
Platform Platform `json:"platform"`
Path string `json:"path"`
Descriptor Descriptor `json:"descriptor"`
}
type CompositionSelection ¶
type DelegatedAuthorization ¶
type DelegatedAuthorization struct {
Service string `json:"service"`
Scope string `json:"scope"`
Credential BrokeredCredential `json:"credential"`
}
DelegatedAuthorization declares that a Tool requires delegated-user authorization before it may be called. It never contains a credential value, consent state, token lifecycle state, or a deployment-specific Connection identifier; the deployment/runtime resolves the requirement to a verified requester and a live user-owned connection.
type Descriptor ¶
type Descriptor struct {
MediaType string `json:"mediaType"`
Digest string `json:"digest"`
Size int64 `json:"size"`
Annotations map[string]string `json:"annotations,omitempty"`
}
Descriptor is an OCI-compatible content descriptor: a named, nested property on a suite-local reference that carries the referenced content's media type, digest, and size, plus optional descriptive annotations. Outer selector fields (such as id, version, agent, platform, and path) stay on the enclosing reference; Descriptor only describes the referenced bytes.
func (*Descriptor) UnmarshalJSON ¶
func (d *Descriptor) UnmarshalJSON(data []byte) error
UnmarshalJSON requires mediaType, digest, and size to be present in the document. A present size of zero is a legitimate empty-content descriptor; an omitted size is rejected. Both would otherwise decode to the same Go zero value, so presence is checked explicitly against the raw fields before the normal typed decode. It also rejects any object key outside the closed descriptor shape, and rejects an explicit JSON null for mediaType, digest, size, or a present annotations key, which would otherwise silently decode to the same Go zero values as legitimate values (notably null size and size: 0 both decode to 0).
type DiffIdentity ¶
type DiffLimitError ¶
func (*DiffLimitError) Error ¶
func (e *DiffLimitError) Error() string
type DiffReport ¶
type DiffReport struct {
SchemaVersion string `json:"schemaVersion"`
Before DiffIdentity `json:"before"`
After DiffIdentity `json:"after"`
Summary DiffSummary `json:"summary"`
Changes []RecordChange `json:"changes"`
AffectedAgents []AffectedAgent `json:"affectedAgents"`
}
func DiffPaths ¶
func DiffPaths(beforePath, afterPath string) (DiffReport, error)
DiffPaths compares two conformant extracted AgentSuites or local OCI layouts.
func (DiffReport) HasChanges ¶
func (r DiffReport) HasChanges() bool
type DiffSummary ¶
type EnvironmentName ¶
type EvaluationAssertion ¶
type EvaluationAssertion struct {
ID string `json:"id"`
Type string `json:"type"`
Critical *bool `json:"critical,omitempty"`
Value string `json:"value,omitempty"`
Pattern string `json:"pattern,omitempty"`
Tool string `json:"tool,omitempty"`
Rubric string `json:"rubric,omitempty"`
MinScore *int `json:"minScore,omitempty"`
JudgeModel string `json:"judgeModel,omitempty"`
JudgeVersion string `json:"judgeVersion,omitempty"`
}
type EvaluationCase ¶
type EvaluationIndex ¶
type EvaluationIndex struct {
SchemaVersion string `json:"schemaVersion"`
MediaType string `json:"mediaType"`
Agent string `json:"agent"`
Cases []FileRef `json:"cases"`
Limits EvaluationLimits `json:"limits"`
}
type EvaluationLimits ¶
type FieldChange ¶
type FieldChange struct {
Path string `json:"path"`
Before json.RawMessage `json:"before,omitempty"`
After json.RawMessage `json:"after,omitempty"`
}
type FileRef ¶
type FileRef struct {
Path string `json:"path"`
Descriptor Descriptor `json:"descriptor"`
}
type InventoryEntry ¶
type InventoryEntry struct {
Path string `json:"path"`
Type string `json:"type"`
Mode uint32 `json:"mode"`
UID int `json:"uid"`
GID int `json:"gid"`
Size int64 `json:"size,omitempty"`
Digest string `json:"digest,omitempty"`
LinkTarget string `json:"linkTarget,omitempty"`
Component string `json:"component,omitempty"`
}
type ManifestRef ¶
type ManifestRef struct {
ID string `json:"id"`
Version string `json:"version,omitempty"`
Path string `json:"path"`
Descriptor Descriptor `json:"descriptor"`
}
type ModelRequirement ¶
type NetworkAccess ¶
type Platform ¶
type PlatformImage ¶
type PlatformImage struct {
Platform Platform `json:"platform"`
ImageRef string `json:"imageRef"`
Image Descriptor `json:"image"`
}
type RecordChange ¶
type RemoteHeader ¶
type RemoteHeader struct {
Name string `json:"name"`
SecretRef SecretKeyRef `json:"secretRef"`
}
type RemoteNetworkRequirement ¶
type RemoteNetworkRequirement struct {
DestinationRef string `json:"destinationRef"`
}
type RemoteTimeouts ¶
type RemoteToolProvider ¶
type RemoteToolProvider struct {
Transport string `json:"transport"`
EndpointRef string `json:"endpointRef"`
Headers []RemoteHeader `json:"headers,omitempty"`
Network []RemoteNetworkRequirement `json:"network"`
Timeouts RemoteTimeouts `json:"timeouts"`
Cancellation string `json:"cancellation"`
Connection string `json:"connection"`
}
type Report ¶
type Report struct {
Name string `json:"name"`
Agents int `json:"agents"`
ToolProviders int `json:"toolProviders"`
ToolProviderCompositions int `json:"toolProviderCompositions"`
Compositions int `json:"compositions"`
Capabilities []string `json:"capabilities"`
AgentPlatforms []AgentPlatform `json:"agentPlatforms"`
CompositionSelections []CompositionSelection `json:"compositionSelections"`
}
func ValidateDirectory ¶
ValidateDirectory validates extracted AgentSuite content without OCI layout auto-detection. Consumers of loose manifests must validate this same view.
func ValidatePath ¶
ValidatePath validates either an extracted AgentSuite content directory or an OCI image-layout directory containing one AgentSuite artifact.
type ResolvedToolProvider ¶
type RuntimeRequirement ¶
type SecretKeyRef ¶
type Suite ¶
type Suite struct {
SchemaVersion string `json:"schemaVersion"`
MediaType string `json:"mediaType"`
Name string `json:"name"`
Agents []ManifestRef `json:"agents"`
ToolProviderCatalog ManifestRef `json:"toolProviderCatalog"`
ToolProviderCompositions []ToolProviderCompositionRef `json:"toolProviderCompositions,omitempty"`
Compositions []CompositionRef `json:"compositions"`
BuildProfiles []ManifestRef `json:"buildProfiles"`
Capabilities []string `json:"capabilities,omitempty"`
Extensions []Extension `json:"extensions,omitempty"`
}
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
InputSchema FileRef `json:"inputSchema"`
OutputSchema *FileRef `json:"outputSchema,omitempty"`
Effects []string `json:"effects,omitempty"`
Effect string `json:"effect,omitempty"`
Approval string `json:"approval,omitempty"`
DelegatedAuthorization *DelegatedAuthorization `json:"delegatedAuthorization,omitempty"`
}
Tool is one model-callable function exposed by a ToolProvider.
type ToolProvider ¶
type ToolProvider struct {
SchemaVersion string `json:"schemaVersion"`
MediaType string `json:"mediaType"`
ID string `json:"id"`
Version string `json:"version"`
Retained *bool `json:"retained,omitempty"`
Protocol string `json:"protocol"`
Revision string `json:"revision"`
Tools []Tool `json:"tools"`
Variants []ToolProviderVariant `json:"variants,omitempty"`
Remote *RemoteToolProvider `json:"remote,omitempty"`
Extensions []Extension `json:"extensions,omitempty"`
}
ToolProvider is a versioned contract and its bundled or remote implementations. The abstraction is protocol-neutral; the declared protocol contributes to identity.
type ToolProviderCatalog ¶
type ToolProviderCatalog struct {
SchemaVersion string `json:"schemaVersion"`
MediaType string `json:"mediaType"`
ToolProviders []ManifestRef `json:"toolProviders"`
}
type ToolProviderComposition ¶
type ToolProviderComposition struct {
SchemaVersion string `json:"schemaVersion"`
MediaType string `json:"mediaType"`
ID string `json:"id"`
Version string `json:"version"`
ManifestDigest string `json:"manifestDigest"`
Platform Platform `json:"platform"`
VariantDigest string `json:"variantDigest"`
BuildProfile string `json:"buildProfile"`
}
type ToolProviderCompositionRef ¶
type ToolProviderCompositionRef struct {
ID string `json:"id"`
Version string `json:"version"`
Platform Platform `json:"platform"`
Path string `json:"path"`
Descriptor Descriptor `json:"descriptor"`
}
type ToolProviderDependency ¶
type ToolProviderRequirement ¶
type ToolProviderVariant ¶
type ToolProviderVariant struct {
Platform Platform `json:"platform"`
VariantDigest string `json:"variantDigest"`
InstallRoot string `json:"installRoot"`
Relocatable bool `json:"relocatable,omitempty"`
PayloadRoot string `json:"payloadRoot"`
Entrypoint string `json:"entrypoint"`
Arguments []string `json:"arguments,omitempty"`
SearchPath []string `json:"searchPath,omitempty"`
Environment []EnvironmentName `json:"environment,omitempty"`
WritablePaths []string `json:"writablePaths,omitempty"`
Network []NetworkAccess `json:"network,omitempty"`
Runtime RuntimeRequirement `json:"runtime"`
Files []InventoryEntry `json:"files"`
Dependencies []ToolProviderDependency `json:"dependencies,omitempty"`
SBOM *Descriptor `json:"sbom,omitempty"`
Provenance *Descriptor `json:"provenance,omitempty"`
}