Long-running agents are in preview. APIs and package versions are subject to change.
Store progress and checkpoints
FoundryStateStore is a durable, server-backed key-value store for state that must survive crashes and idle eviction. Keep progress markers and checkpoints in separate items so a recovered attempt can identify both the next step and the results already written.
A store is bound to one caller-chosen name. Encode the workflow, session, thread, or run scope in that name. For the full store surface, see Durable state store for hosted agents.
409 Conflict or 412 Precondition Failed response, reread the items and reconcile the existing checkpoint before you retry.
Key behaviors:
get_or_create()fetches or creates the store in one call. It appliesuser_isolationanditem_ttl_secondsonly on first creation.- Store name = scope. Names can contain
/; use it as a hierarchy separator and choose a stable scheme up front. - Optimistic concurrency. Use
if_match=item.etagfor mutable items such as progress markers. Usecreate_item()for append-only checkpoints so a competing write doesn’t overwrite an existing value. - Limits. An item value can contain up to 1 MB of serialized JSON. A store name can contain 1 through 128 characters, and an item can have up to 16 tags.
Back a framework checkpointer
Point a LangGraph or Microsoft Agent Framework (MAF) checkpointer atFoundryStateStore and the framework’s own recovery becomes durable across crashes - no custom recovery code.
Checkpoints are append-only - each save uses a fresh ID, so there’s no write contention and you never need
if_match on the checkpoint path.
Keep inputs small
Task inputs are persisted before the handler runs (that’s what recovery rests on), so keep them small - the per-input limit is about 10 MiB after JSON serialization, and larger inputs raiseInputTooLarge before any network call. Externalize big payloads to blob storage and pass a reference.