Skip to main content

Storage execution and local persistence

Storage management is documented in Storages. FR #1040 adds the execution adapters consumed by Data Source and Knowledge integrations. It adds no Console journey or public content-management endpoint.

Consumer contract​

IStorageContentGateway belongs to Agentstration.Storage.Contracts. Select an exact StorageRevisionReference, the trusted consumer scope/address and a StorageContentPolicy. Each call validates current permissions and the complete saved binding again. Use runs/execute for actual content invocation in addition to Storage discovery/use and the consuming feature's own authorization.

Supported operations are bounded list, stat, read and conditional/idempotent write. Rules can narrow operation rights, prefix, key range and payload/page bounds. They cannot replace the connection, type, configuration or Storage envelope. Connection, configuration and envelope stay protected and distinct. Unsupported constraints fail explicitly. Errors are bounded and redact provider messages and locations.

A write without ExpectedVersion creates only. Replacement requires the exact current version. Keep the original request ID, deadline, content and restrictions when retrying an uncertain write. Changed arguments under the same request identity fail. Reads/stat require a protected object reference; pagination cursors also pin the original query. Reauthorization and exact resource checks run on every call.

Builtin local type​

There is one Instance-owned local StorageType with functional version 1.0.0, implementing list/stat/read/write. Storage has not shipped; the maintainer chose one initial functional version rather than retaining intermediate metadata-only contracts. No migration or compatibility version is introduced. Published version immutability and explicit consumer pins remain enforced.

Configuration is {}. The local envelope uses StorageContentPolicy fields: list, stat, read, write, prefix, maximumPageSize, maximumReadBytes, maximumWriteBytes, keyFrom and keyBefore. Missing fields use the contract defaults; omitted numeric limits add no restriction to the server budgets, and write defaults to false. Both schema and pure local restriction validation run during management, without resolving a Secret or touching content.

The local type adds no payload or page ceiling below the contracts' numeric range. Defaults are 10 MiB per read/write and content object, 100 items/page, 1,024 current objects, 64 MiB total current content and 512 outstanding write receipts per Storage. Expired receipts are pruned at a subsequent write. Capacity refusal is explicit. Overwritten object versions become unavailable; no stable-version or durable Snapshot retention capability is advertised.

Operator ceilings and per-Storage limits​

Configure the authoritative server in appsettings.json or environment variables:

{
"Agentstration": {
"StorageContent": {
"MaximumReadBytes": 10485760,
"MaximumWriteBytes": 10485760,
"MaximumObjectBytes": 10485760,
"TransferChunkBytes": 65536,
"MaximumPageSize": 100,
"LocalMaximumStoreBytes": 67108864,
"LocalMaximumObjects": 1024,
"LocalMaximumReceipts": 512,
"LocalMaximumPublications": 1024
},
"DataSourceContent": {
"MaximumValueBytes": 10485760,
"MaximumHttpResponseBytes": 10485760
},
"FunctionContent": { "MaximumValueBytes": 10485760 },
"XmlContent": {
"MaximumDocumentBytes": 10485760, "MaximumDepth": 32, "MaximumNodes": 8192,
"MaximumAttributesPerElement": 64, "MaximumSelectedNodes": 8192,
"MaximumArrayItems": 100, "MaximumMappingOperations": 32768
},
"FlowContent": { "MaximumValueBytes": 10485760 }
}
}

For example, Agentstration__StorageContent__MaximumWriteBytes=10485760 sets the server write ceiling to 10 MiB. Restart the authority to apply configuration. Invalid values fail during composition. All budgets and quotas must be positive; local decoded object capacity must be at least the configured object budget. There is no additional hard-coded upper ceiling: byte, chunk, page and count options use positive Int32 values, and store capacity uses positive Int64 values. The values in the example are defaults, not maximum supported values. Publication count is per Storage and execution Workspace; object, decoded-byte and receipt quotas apply to the mutable local object backend, independently of retained publications and native Artifact files.

In the Console Storage editor, use the existing envelope to restrict a particular Storage, for example:

{
"list": true, "stat": true, "read": true, "write": true,
"maximumReadBytes": 2097152, "maximumWriteBytes": 2097152
}

A consumer's rule can reduce this again. The effective read/write limit is the minimum of the operator ceiling, exact StorageType limits, Storage envelope and consumer rule. A write also obeys the server object-size ceiling. Raising the server limit does not alter an existing envelope or consumer rule. Newly provisioned local defaults use the configured server read/write limits. Lowering limits may refuse content or local state that no longer fits; it does not delete data.

MaximumWriteBytes limits one product write; native dataset results are written whole. MaximumObjectBytes bounds native content and retained publication objects. Native Artifact copies transfer multiple chunks bounded by TransferChunkBytes. The integrated ASC remote adapters and standalone protocols are unchanged. Content wire/contribution ceilings remain 64 KiB and advertised remote type/provider limits still apply. Structured documents keep their separate maximumDocumentBytes and maximumResultBytes policies; these content settings do not widen document/query limits. Native JSON record collections use the configured acquisition and Storage budgets, without a separate 64 KiB aggregate payload ceiling. The existing record cardinality and shape contracts remain enforced. A server setting cannot widen a remote capability.

MaximumHttpResponseBytes counts raw bytes from builtin HTTP GET acquisitions. MaximumValueBytes counts the complete serialized JSON operation input/output. Wrapping a response in JSON, escaping text and UTF-8 encoding add bytes: a body that fits its HTTP budget can still exceed its dataset budget. Storage and publication limits apply separately. FunctionContent:MaximumValueBytes controls serialized native transformation inputs/outputs, including JSON wrappers and record metadata. Configure it alongside the acquisition budget when a dataset uses transformations. FlowContent:MaximumValueBytes controls serialized values passed into child Flow compositions. Foreach Artifact input/output byte budgets are positive Flow rules, without a second fixed publication ceiling; execution still enforces the configured Storage object budget. The Console type and Flow editors accept these larger values. Agent text-read windows, retrieval scan budgets, configuration schemas and ordinary file buffers retain their own bounds.

The local 1.0.0 schema/contract is updated for a maintainer-authorized reseed. Instances using the previous immutable contract must be reseeded before testing this baseline; no automatic reset, migration or consumer rebinding is performed. See ADR-0236.

Provisioning attempts a local-default using the existing Storage service and its current generic Use authorization and exact resource checks. It creates no grants, writes no UsePolicy and changes no access overlay. An existing default retains its UID, enabled state, configuration, envelope and policies; a reserved-name/ownership collision fails.

The single Instance-owned type starts with no automatic descendant sharing. Workspace/Tenant defaults remain unavailable until an administrator explicitly grants generic Use. A grant to a Tenant with propagation permits its Workspaces; Discover alone is insufficient. Empty embedded UsePolicy metadata creates no second lock while #1078 is deferred. The Instance operational default works in its logical Instance context. No type copies, global exemptions or automatic sharing are introduced to make a blocked default usable.

A blocked attempt returns unavailable with a bounded diagnostic and writes a structured operator warning containing Workspace/scope/code, without failing the rest of Workspace initialization. Existing defaults are observed without repair or mutation. Generic Use is the current Storage-family authorization contract; embedded UsePolicy metadata is not an additional gate. #1064 owns existing generic grant administration, #1077 new user-permission work and #1078 UsePolicy work; this increment implements none of those deferred policy features.

Operator configuration and Docker​

The default root is <Data:Directory>/storages, which is /data/storages in the standard Docker image. Override it using Agentstration:LocalStorage:RootDirectory, or environment variable Agentstration__LocalStorage__RootDirectory.

For example, retain /data for metadata, keys and historical Artifact content and mount a separate local content root:

docker run --name agentstration \
--mount type=volume,src=agentstration-data,dst=/data \
--mount type=volume,src=agentstration-storages,dst=/storage \
-e Agentstration__LocalStorage__RootDirectory=/storage \
-p 8080:8080 agentstration:local

A bind mount can replace either named volume. The process user needs read/write and directory traversal permission. Keep the roots operator-owned, unavailable to ordinary application callers and protected against concurrent filesystem edits. Symbolic/reparse links are refused. Separate Storage UIDs receive separate directories, including two Storages within one Workspace. Physical names are not part of ordinary resource/Tool results or diagnostics.

Persist both metadata and bytes when replacing a container. Losing metadata creates different UIDs; retained directories are never automatically adopted by name. The independent builtin Artifact backend keeps /data/durable-artifacts. When no selectable default exists, new builtin Artifact writes retain that existing backend. Workspace-scoped Artifact Flows also retain it in operational Workspaces: they do not implicitly select the administrative default owned at Instance/Tenant scope. This neither grants Storage access nor retargets a selected reference. When an authorized default is selected, new receipts pin its exact Storage revision and use its directory; disabled, revoked, stale or incompatible selections fail without falling back. Backup/restore must preserve these locations and resource/receipt identities together.

The native Artifact adapter uses the logical key artifacts/<object-id> and respects the selected Storage envelope, including read/write/stat permissions, prefix/key range and per-call payload limits. Copies use a pending file; only a complete file matching the pinned length and SHA-256 is atomically promoted. Readers never see pending content. A retry verifies an existing committed file and cannot truncate or overwrite it. At most 128 unfinished copies can be staged per Workspace/Storage directory; retrying the same receipt recovers its pending copy. Pending files are not deleted automatically. Operators must preserve active copy state and retained content during recovery.

The explicit deployment probe under tests/fixtures/StorageVolumeProbe runs the production module composition without a model, provider account or UI. It verifies that the business default stays blocked under existing restrictions, then uses the authorized Instance default in its operational context. Its write/read phases verify exact default UID, content reference, Artifact receipt and historical Artifact content across separate processes/containers, without creating grants. It is not a product endpoint or a silently skipped functional test.

Build and run the deployment check from the repository root:

dotnet publish tests/fixtures/StorageVolumeProbe/StorageVolumeProbe.csproj -c Release -o artifacts/storage-probe
docker build -f tests/fixtures/StorageVolumeProbe/Dockerfile -t agentstration-storage-probe artifacts/storage-probe
python3 scripts/ci/test-local-storage-volume.py --image agentstration-storage-probe

The script creates only uniquely named test volumes/containers and removes them afterward. It removes the write container before creating the read container and retains both volumes between phases. It does not use an external model or service.

AEP/ASC extension contract​

Each Storage Type version explicitly declares asc.contract as agentstration.storage.contracts.mcp.v1 (ASC.mcp.v1), asc.revision as 1.0 and asc.mcpProtocolVersion as 2026-07-28, alongside its profile, MCP server, Tool prefix and exact provider pins. These identities are validated independently of AEP capability and provider software versions. See the identity inventory and development-state procedure.

An extension advertises aep.storage-types version 1.0 and versioned StorageTypes contributions. Each includes exact schema digests, typed/protected requirements, actual capabilities/limits and an asc.content/1 MCP mapping. Requirements use the existing bound-values/Secret-access capabilities as needed. Enrollment keeps the exact registration UID/generation, extension namespace and contribution digest. An unchanged version cannot absorb provider drift.

The product rechecks the live authenticated manifest before invocation. Only saved manual export bindings are resolved. The protected authenticated POST /aep/storage/bindings exchange carries connection grants, opaque configuration, opaque envelope and consumer restrictions separately. A short-lived lease selects the configured target through X-Agentstration-Asc-Binding; MCP business arguments remain the SDK's { store, arguments } envelope.

The optional independent Agentstration.Asc.Aep library provides bounded lease handling and the configuration endpoint. Its IAscAepBindingFactory must validate provider-specific schemas/envelopes, resolve AEP grants privately and authorize the actual authenticated caller independently on every operation. Explicitly authorize which callers may configure bindings. Use the declared immutable provider ID, version and schema. The provider may further narrow the requested operation, prefix, range and payload rules when applying its opaque envelope; widening any restriction is refused. No product resource assembly or other extension is required.

Originating user/Agent authority is checked in the product; the extension checks its actual service or direct consumer identity. An opaque authorization revision partitions references but is not a delegation credential. Providers needing actual end-user delegation must refuse unsupported service-identity execution.

The SDK's static bindings remain usable directly by authorized consumers. A target selector, forged subject field or possession of another caller's lease never grants authority. Configuration grants expire within 30 seconds, capacity is 128 leases, configuration payloads are bounded, and Secret capabilities are revoked when the product invocation ends. No operation is automatically published as an Agent Tool; optional fixed-target exposure belongs to #1044.

Remaining integrations​

  • #1064: StorageType administration and existing generic scoped resource grants; #1065: its gated reusable UX scenario. #1077 owns new user-permission work and #1078 owns UsePolicy authoring/composition; current restrictive checks remain.
  • #1041: dataset/acquisition selection, rules, consumer authorization and execution.
  • #1042: projection, freshness, publication and retrieval. Durable Snapshots require real stable-version/retention guarantees beyond the current content profile.
  • #1039: OpenDAL and provider packaging. It consumes this contract without a direct Connected Service-extension dependency.
  • #1033: integrated UX scenario, after its existing implemented-UX approval/merge gate.

ASC progressive content contract​

FR #1085 directly replaces the unreleased asc_read/asc_write wire methods with asc_read_text, asc_read_blob, asc_write_text and asc_write_blob. Providers supply byte-oriented streams; the independent SDK manages scoped implicit sessions, sequencing, bounded replay receipts and explicit finalization. The product's bounded content port delegates to these methods without exposing a backend to the Agent. Every continuation and status/cleanup call rechecks the current binding and grant. See the ASC protocol and ADR-0205.

Structured documents​

The additive document/query vertical uses the same MCP, AEP, Connected Service and exact Storage resolution boundaries. Its separate asc.documents/1 mapping does not change the content sessions described above.

XML instance validation and mapping use the positive Agentstration:XmlContent settings documented in Transformation Schemas. The XML document budget defaults to 10 MiB; mapped JSON uses the existing function value budget. These replace the unreleased fixed 64 KiB XML instance/output caps without changing the schema-authoring or external protocol profiles. Limit errors carry measured counts, units and configuration keys, without source content.