Skip to content

[agentserver-core] Add FoundryStateStore durable KV storage layer#47763

Open
shanmukha1200 wants to merge 10 commits into
Azure:mainfrom
shanmukha1200:foundry-state-store-core
Open

[agentserver-core] Add FoundryStateStore durable KV storage layer#47763
shanmukha1200 wants to merge 10 commits into
Azure:mainfrom
shanmukha1200:foundry-state-store-core

Conversation

@shanmukha1200

@shanmukha1200 shanmukha1200 commented Jun 30, 2026

Copy link
Copy Markdown

Add azure.ai.agentserver.core.storage: protocol-neutral FoundryStorageClient (transport, endpoint, pipeline policies, error hierarchy) plus FoundryStateStore, a generic durable key-value store over /storage/state:read|:write|:listKeys with namespace/key/value/tags, optional if_match optimistic concurrency, and ordered paged list_keys. Adds azure-core dependency and tests.

Responses has its own storage providers idea is to make responses re-use this storage clients in a follow-up PR

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings June 30, 2026 05:45
@github-actions github-actions Bot added Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Hosted Agents sdk/agentserver/* labels Jun 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution @shanmukha1200! We will review the pull request and get back to you soon.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new protocol-neutral storage layer (azure.ai.agentserver.core.storage) to azure-ai-agentserver-core. It introduces FoundryStorageClient (a base owning the AsyncPipelineClient, policy chain, and error handling) and FoundryStateStore, a generic durable key-value store over POST /storage/state:read|:write|:listKeys with namespace/key/value/tags, optional if_match optimistic concurrency, and ordered, paged list_keys. This generalizes the existing responses-package FoundryStorageProvider into the shared core so protocol packages can build resource-specific clients on top.

Changes:

  • New storage subpackage: client/transport, endpoint resolution, error hierarchy, pipeline policies, JSON helpers, and the FoundryStateStore KV store with its serializer.
  • Added azure-core>=1.30.0 dependency and a CHANGELOG 2.0.0b6 (Unreleased) entry.
  • Added unit tests for request construction and response handling.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
storage/__init__.py Public exports for the new storage package.
storage/_client.py FoundryStorageClient base: pipeline, policies, _send_storage_request.
storage/_endpoint.py FoundryStorageEndpoint resolution and versioned URL building.
storage/_errors.py Storage exception hierarchy incl. new FoundryStoragePreconditionError (412).
storage/_policies.py UA + per-retry logging policies with URL masking.
storage/_state.py FoundryStateStore read/write/list_keys/get/set/delete.
storage/_state_serializer.py Wire (de)serialization + StateItem/StateKey/KeyPage types.
storage/_json.py Small JSON parsing helper.
tests/test_foundry_state_store.py Unit tests for request/response behavior.
pyproject.toml Adds azure-core>=1.30.0 dependency.
CHANGELOG.md Adds 2.0.0b6 (Unreleased) feature entry (version not synced — see comment).

Comment thread sdk/agentserver/azure-ai-agentserver-core/CHANGELOG.md
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

@shanmukha1200 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"
Contributor License Agreement

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
and conveys certain license rights to Microsoft Corporation and its affiliates (“Microsoft”) for Your
contributions to Microsoft open source projects. This Agreement is effective as of the latest signature
date below.

  1. Definitions.
    “Code” means the computer software code, whether in human-readable or machine-executable form,
    that is delivered by You to Microsoft under this Agreement.
    “Project” means any of the projects owned or managed by Microsoft and offered under a license
    approved by the Open Source Initiative (www.opensource.org).
    “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any
    Project, including but not limited to communication on electronic mailing lists, source code control
    systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of
    discussing and improving that Project, but excluding communication that is conspicuously marked or
    otherwise designated in writing by You as “Not a Submission.”
    “Submission” means the Code and any other copyrightable material Submitted by You, including any
    associated comments and documentation.
  2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any
    Project. This Agreement covers any and all Submissions that You, now or in the future (except as
    described in Section 4 below), Submit to any Project.
  3. Originality of Work. You represent that each of Your Submissions is entirely Your original work.
    Should You wish to Submit materials that are not Your original work, You may Submit them separately
    to the Project if You (a) retain all copyright and license information that was in the materials as You
    received them, (b) in the description accompanying Your Submission, include the phrase “Submission
    containing materials of a third party:” followed by the names of the third party and any licenses or other
    restrictions of which You are aware, and (c) follow any other instructions in the Project’s written
    guidelines concerning Submissions.
  4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else
    for whom You are acting in making Your Submission, e.g. as a contractor, vendor, or agent. If Your
    Submission is made in the course of Your work for an employer or Your employer has intellectual
    property rights in Your Submission by contract or applicable law, You must secure permission from Your
    employer to make the Submission before signing this Agreement. In that case, the term “You” in this
    Agreement will refer to You and the employer collectively. If You change employers in the future and
    desire to Submit additional Submissions for the new employer, then You agree to sign a new Agreement
    and secure permission from the new employer before Submitting those Submissions.
  5. Licenses.
  • Copyright License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license in the
    Submission to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute
    the Submission and such derivative works, and to sublicense any or all of the foregoing rights to third
    parties.
  • Patent License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under
    Your patent claims that are necessarily infringed by the Submission or the combination of the
    Submission with the Project to which it was Submitted to make, have made, use, offer to sell, sell and
    import or otherwise dispose of the Submission alone or with the Project.
  • Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement.
    No additional licenses or rights whatsoever (including, without limitation, any implied licenses) are
    granted by implication, exhaustion, estoppel or otherwise.
  1. Representations and Warranties. You represent that You are legally entitled to grant the above
    licenses. You represent that each of Your Submissions is entirely Your original work (except as You may
    have disclosed under Section 3). You represent that You have secured permission from Your employer to
    make the Submission in cases where Your Submission is made in the course of Your work for Your
    employer or Your employer has intellectual property rights in Your Submission by contract or applicable
    law. If You are signing this Agreement on behalf of Your employer, You represent and warrant that You
    have the necessary authority to bind the listed employer to the obligations contained in this Agreement.
    You are not expected to provide support for Your Submission, unless You choose to do so. UNLESS
    REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, AND EXCEPT FOR THE WARRANTIES
    EXPRESSLY STATED IN SECTIONS 3, 4, AND 6, THE SUBMISSION PROVIDED UNDER THIS AGREEMENT IS
    PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF
    NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
  2. Notice to Microsoft. You agree to notify Microsoft in writing of any facts or circumstances of which
    You later become aware that would make Your representations in this Agreement inaccurate in any
    respect.
  3. Information about Submissions. You agree that contributions to Projects and information about
    contributions may be maintained indefinitely and disclosed publicly, including Your name and other
    information that You submit with Your Submission.
  4. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and
    the parties consent to exclusive jurisdiction and venue in the federal courts sitting in King County,
    Washington, unless no federal subject matter jurisdiction exists, in which case the parties consent to
    exclusive jurisdiction and venue in the Superior Court of King County, Washington. The parties waive all
    defenses of lack of personal jurisdiction and forum non-conveniens.
  5. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and
    supersedes any and all prior agreements, understandings or communications, written or oral, between
    the parties relating to the subject matter hereof. This Agreement may be assigned by Microsoft.

@shanmukha1200 shanmukha1200 force-pushed the foundry-state-store-core branch from a6d75fa to 13e374f Compare July 2, 2026 16:56
Adds azure.ai.agentserver.core.storage: a protocol-neutral Foundry storage
layer (FoundryStorageClient transport, endpoint, pipeline policies, error
hierarchy) and FoundryStateStore, a durable namespace-scoped key-value store
over POST /storage/state:read|:write|:listKeys with if_match optimistic
concurrency, per-item TTL, tags, and ordered, paged list_keys.

The public contract is strongly typed: writes use the Upsert/Delete change
objects (WriteChange), stored values are typed as JSONValue, and list order is
a Literal ("asc"/"desc"). Internal helpers and pipeline policies are kept out
of the public surface.

Includes unit tests for the state store, error mapping, endpoint resolution,
and pipeline policies; a developer guide (docs/state-store-guide.md); a
runnable sample; and README/CHANGELOG updates.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@shanmukha1200 shanmukha1200 force-pushed the foundry-state-store-core branch from 13e374f to 1d7b980 Compare July 2, 2026 19:07
shanmukha1200 and others added 2 commits July 9, 2026 13:38
Refactor FoundryStateStore to follow the explicit /storage/statestores/* protocol while keeping it as the public developer-facing entry point.

This removes the old namespace-scoped batch/session-isolation model in favor of explicit store lifecycle APIs plus single-item operations, store-level TTL, delegated x-ms-user-id support on item paths, and updated docs/samples/tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add get_or_create and create_or_get helpers for explicit store setup while keeping FoundryStateStore construction side-effect free.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
item_ttl_seconds=3600,
description="Checkpoint store for thread abc",
) as store:
await store.get_or_create()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you simplify?

store = FoundryStateStore.get_or_create(...)
await store.set(...)

Stores are **explicit resources**. Create or resolve them before writing items.

```python
info = await store.create()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole surface needs some polish

store = await FoundryStateStore.create(...);
store = await FoundryStateStore.get(name);
store = await FoundryStateStore.get_or_create(...);
store = await store.update(...);
store = await store.delete(...);

shanmukha1200 added a commit to shanmukha1200/azure-sdk-for-python that referenced this pull request Jul 10, 2026
…e-storage spec (foundrysdk_specs#247)

Per the latest commit on coreai-microsoft/foundrysdk_specs#247
("rename route to /storage/state_stores, add store PATCH update, align
object descriptors"), the state-store REST path is /storage/state_stores/*
(snake_case with underscore), not /storage/statestores/*.

- _state.py: store path + create() now target state_stores.
- _policies.py: masked-logging allowlist updated to the new segment name.
- Updated docs/state-store-guide.md, README, and test URL assertions.
- Fixed the core CHANGELOG/README, which still described the earlier
  namespace-based design (pre-dating the PR Azure#47763 pull) instead of the
  current store-bound statestores-protocol API; also dropped an unused
  aiohttp dependency left over from that earlier design.

No functional change beyond the route rename -- the object-type descriptor
changes in the spec commit (state_store / state_store.item) are response-only
fields the SDK does not parse or assert on.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
shanmukha1200 added a commit to shanmukha1200/azure-sdk-for-python that referenced this pull request Jul 12, 2026
…te/get/update/delete

Per review feedback on PR Azure#47763 (constructor-then-create felt awkward) and
the guide-first workflow: reshape the store-admin surface to four verbs
instead of six, and stop threading the per-request delegated-user header
through the constructor.

- FoundryStateStore.get_or_create(name, ...) is now the sole entry point (an
  async classmethod): resolves the store in one call (fetch, or create on
  first use, refetching on a create/create race), replacing the previous
  constructor + separate create()/create_or_get()/get_or_create() dance.
- get(key=None) and delete(key=None, ...) are overloaded on whether a key is
  supplied: no key acts on the bound store itself (was get_properties /
  delete_store); a key acts on one item (unchanged item-level behavior).
  update(...) replaces update_metadata(...) (no collision, simple rename).
- Removed the constructor's user_id parameter. x-ms-user-id is a per-request
  delegation header, not a store-level setting -- it is now resolved
  dynamically, per call, from azure.ai.agentserver.core's existing
  request-scoped platform context (get_request_context().user_id), the same
  mechanism protocol hosts already populate from the inbound x-agent-user-id
  header. A single (possibly long-lived, reused) FoundryStateStore instance
  can now safely serve requests for different users.
- azure-ai-agentserver-activity's FoundryStorage updated to call the new
  classmethod for writes while keeping the plain constructor for reads/
  deletes (both already tolerate a not-yet-created store gracefully), so the
  "only create on first write" behavior is unchanged.
- Rewrote the core state-store tests, the sample, and the developer guide for
  the new shape; added a "Limits" section to the guide mirroring the spec's
  field-constraints tables (no equivalent guide exists yet for the
  resilient-task primitive to model this section after).

Verified: black, mypy, and pytest all clean for both packages (148 + 99
passed). Two mypy findings in _state.py (tags Union narrowing in update(),
**query kwargs in list_keys) are pre-existing, inherited verbatim from PR
Azure#47763's pulled code -- unrelated to this rename and left as-is.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
shanmukha1200 and others added 3 commits July 12, 2026 14:52
…te/get/update/delete

Addresses PR review feedback (constructor-then-create felt awkward) and
aligns the SDK with the latest state-storage spec commit (route renamed to
/storage/state_stores/*).

- Route rename: /storage/statestores/* -> /storage/state_stores/* in
  _state.py's request paths and _policies.py's masked-logging allowlist.
- FoundryStateStore.get_or_create(name, ...) is now the sole entry point (an
  async classmethod): resolves the store in one call (fetch, or create on
  first use, refetching on a create/create race), replacing the previous
  constructor + separate create()/create_or_get()/get_or_create() dance.
- get(key=None) and delete(key=None, ...) are overloaded on whether a key is
  supplied: no key acts on the bound store itself (was get_properties /
  delete_store); a key acts on one item (unchanged item-level behavior).
  update(...) replaces update_metadata(...) (no collision, simple rename).
- The user_id constructor parameter (delegated x-ms-user-id) is unchanged on
  this branch: this base predates azure.ai.agentserver.core's request-scoped
  platform context (added later, in 2.0.0b7), so the "resolve user_id
  per-request instead of at construction" fix from the sibling PR (Azure#47978)
  does not apply here yet without also backporting that module. Flagging for
  a follow-up once this PR is based on (or merges after) that work.
- Rewrote the state-store tests, the sample, the developer guide, and the
  README snippet for the new shape; added a "Limits" section to the guide
  mirroring the spec's field-constraints tables.

Verified: black and pytest clean for the storage surface (41 storage tests
pass). Three pre-existing mypy findings in _state.py / _state_serializer.py
(tags Union narrowing in update(), **query kwargs in list_keys) predate this
change and are left as-is. Three unrelated pre-existing test_tracing.py
failures in this branch's older tracing code (opentelemetry-sdk version
mismatch) are also unrelated to this change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…s from a TypeSpec contract

Same change as PR Azure#47978, ported onto this branch's base (which predates
_request_context.py, so the constructor-based user_id parameter is
unchanged here -- see FoundryStateStore.__init__/_request()).

Replace hand-rolled dataclasses + ad hoc JSON (de)serialization in
FoundryStateStore with real Python model classes generated from a formal
TypeSpec contract (type_spec/main.tsp), the same @azure-tools/typespec-python
emitter azure-ai-agentserver-responses uses. The contract does not live
under Azure/azure-rest-api-specs yet, so models are compiled locally for now
(see type_spec/README.md) instead of tsp-client sync.

- Added type_spec/main.tsp, package.json/README, and a Makefile
  generate-models target.
- Added azure/ai/agentserver/core/storage/_generated/: generated model
  classes (StateStore, StateStoreItem, StateStoreItemMetadata,
  DeletedStateStore, DeletedStateStoreItem, StateStoreKey,
  CreateStateStoreRequest, UpdateStateStoreRequest, CreateItemRequest,
  PutItemRequest, ListResponseStateStore(Key)) plus the model_base.py
  runtime it depends on. Added mypy.ini excluding _generated and the
  isodate dependency model_base.py requires.
- Renamed public types to match the generated/spec names exactly:
  StateStoreInfo -> StateStore, StateItem -> StateStoreItem,
  StateItemMetadata -> StateStoreItemMetadata, DeletedStateItem ->
  DeletedStateStoreItem, StateKey -> StateStoreKey. KeyPage stays a
  hand-written convenience wrapper.
- Rewrote _state_serializer.py's serialize_*/deserialize_* helpers to
  build/parse the generated models instead of raw dicts, preserving
  update()'s description/tags tri-state semantics via the generated
  model's mapping constructor.
- Added @overload pairs to get()/delete() so callers get a narrow return
  type based on whether key is supplied, instead of one wide union.
- Updated tests, CHANGELOG, and README for the above.

27/27 storage-specific tests pass (3 pre-existing, unrelated
test_tracing.py failures confirmed environment/version-related); mypy
clean aside from the same pre-existing finding already called out in the
prior commit on this branch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tate-store guide

The guide's code samples returned typed objects (StateStore, StateStoreItem,
etc.) but never imported or named the types, so every example read as if
get()/set()/list_keys() returned raw dicts. Added a Typed Models section
mapping each method to its return model, and added explicit imports/type
annotations to the Getting Started, Store Lifecycle, Fetch-one-item, and
Listing Keys examples. StateStoreItem.value stays intentionally untyped
(opaque application JSON) -- called that out explicitly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
shanmukha1200 added a commit to shanmukha1200/azure-sdk-for-python that referenced this pull request Jul 12, 2026
…tate-store guide

Same fix as the sibling PR Azure#47763: the guide's code samples returned typed
objects (StateStore, StateStoreItem, etc.) but never imported or named the
types, so every example read as if get()/set()/list_keys() returned raw
dicts. Added a Typed Models section mapping each method to its return
model, and added explicit imports/type annotations to the Getting Started,
Store Lifecycle, Fetch-one-item, and Listing Keys examples.
StateStoreItem.value stays intentionally untyped (opaque application JSON)
-- called that out explicitly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
shanmukha1200 and others added 3 commits July 12, 2026 21:02
…yword

Same change as the sibling PR Azure#47978, ported onto this branch's base
(constructor-based user_id parameter unchanged here).

The constructor, get_or_create(), update(), create_item(), and set() still
took only scattered kwargs (user_isolation, item_ttl_seconds, description,
tags) even after the underlying request bodies became typed generated
models -- there was no way to build/reuse a CreateStateStoreRequest etc. and
pass it straight through. Each of those methods now also accepts an
'options' keyword: a typed request model bundling its scattered keywords
into one object, mutually exclusive with them per call.

- Constructor / get_or_create(): options: CreateStateStoreRequest | None.
  options.name is ignored -- the store's name always comes from the
  required `name` parameter. Absent fields on options fall back to the
  same defaults the scattered kwargs use.
- update(): options: UpdateStateStoreRequest | None. Building options via
  its mapping constructor (e.g. UpdateStateStoreRequest({"tags": None}))
  preserves the omit-vs-null distinction the description/tags keywords
  make via the _UNSET sentinel -- a field's absence from options means
  "leave unchanged", presence with None means "clear it".
- create_item() / set(): options: CreateItemRequest | PutItemRequest |
  None. Only options.tags is read; key/value always come from the
  method's own required parameters.
- Added _resolve_create_options()/_resolve_tags_option() helpers in
  _state.py implementing the reconciliation + mutual-exclusion checks.
- Re-exported CreateStateStoreRequest, UpdateStateStoreRequest,
  CreateItemRequest, and PutItemRequest from
  azure.ai.agentserver.core.storage (previously internal-only, used only
  by _state_serializer.py).
- Documented the new options keyword in the state-store guide (with the
  update() unset-vs-null gotcha called out) and added CHANGELOG coverage.
- Added 10 new tests covering the options path, its defaulting behavior,
  and the mutual-exclusion ValueError for all five methods.

141/146 core tests pass (3 pre-existing, unrelated test_tracing.py
failures confirmed environment/version-related, 5 skipped); mypy clean
aside from the same pre-existing finding already called out in prior
commits on this branch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rewrite the durable state store guide prose to be customer-first: remove
internal architecture references (FoundryStorageClient pipeline,
/storage/state_stores/* protocol, type_spec/main.tsp, "protocol's single-item
PUT", on-the-wire base64url encoding) and defensive "not a raw dict / does not
and cannot" framing. Content, examples, tables, and limits are unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make FoundryStateStore opinionated toward simple key-value semantics:
remove the typed request-object `options=` keyword from the constructor,
get_or_create(), update(), create_item(), and set(). Callers now pass
plain scalar keywords only (user_isolation, item_ttl_seconds, description,
tags), matching every sibling store (MAF CheckpointStorage, ADK
BaseMemoryService, in-SDK InMemoryResponseProvider, azure-ai-projects
BetaMemoryStoresOperations) -- none exposes generated request-body models
as a caller-facing options= param. Responses stay typed.

- Delete _resolve_create_options() and _resolve_tags_option() helpers.
- Stop re-exporting CreateStateStoreRequest / UpdateStateStoreRequest /
  CreateItemRequest / PutItemRequest from storage/__init__ and the
  serializer __all__ (still used internally to build wire bodies).
- Keep item_ttl_seconds naming (matches our own state-store wire
  contract; the memory-store default_ttl_seconds precedent is a
  different, nested resource).
- Update guide (remove "Accepted request options" section, flat-kwargs
  examples), CHANGELOG, and tests (remove 10 options= tests).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Any item write renews the TTL window for that item
- Reads do **not** renew the TTL window

## Single-Item Operations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow the same naming convention for all item operations <create/set/deleteget>_item()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack..updated

|---|---|
| `get_or_create()`, `get()` (no `key`), `update()` | `StateStore` |
| `delete()` (no `key`) | `DeletedStateStore` |
| `create_item()`, `set()` | `StateStoreItemMetadata` |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why StateStoreItemMetadata and not StateStoreItem?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StateStoreItem has a value by definition maybe metadata sounds vague but we would need another typed response object

@shanmukha1200 shanmukha1200 Jul 13, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe

stateStoreItem
           ----> StateStoreItemKey
                    --->Name
                    ---->etag
                    -----> createdAt
                    ----> updatedAt
           -----> Value

follow this heirarchy and return StateStoreItemKey for create and StateStoreItem for get

| `create_item()`, `set()` | `StateStoreItemMetadata` |
| `get(key)` | `StateStoreItem` |
| `delete(key)` | `DeletedStateStoreItem` |
| `list_keys()` | `KeyPage` (of `StateStoreKey`) |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StateStoreItemKeysPage

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs typespec change will take it up once all other comments are resolved

print(store.name)
```

`get()` and `delete()` are overloaded on whether you pass a `key`: with no

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of overload is bad. Lets avoid this and make item methods separate and explicit *_item methods.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack..updated

Address review feedback (PR Azure#47763): remove the key-vs-no-key @Overloads on
FoundryStateStore.get/delete and give every item operation an explicit,
consistently named method.

- set -> set_item
- get(key) -> get_item(key); bare get() stays store-scoped
- delete(key) -> delete_item(key); bare delete() stays store-scoped
- create_item / list_keys unchanged

Store-level get()/update()/delete() now unambiguously act on the bound store.
Updates README, state-store guide, samples, tests, and CHANGELOG to match.
No TypeSpec/generated-model changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Hosted Agents sdk/agentserver/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants