Repository navigation
Added a new sample to show how to bring your own store. #1005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Sapinder Pal Singh (sapinderpalsingh)
wants to merge
29
commits into
microsoft-foundry:main
Choose a base branch
from
sapinderpalsingh:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,351
−0
Open
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
240b5e0
Added a new sample to show how to bring your own store.
sapinderpalsingh ddbaabc
Fixed PR checks
sapinderpalsingh 5bdf640
Merge branch 'microsoft-foundry:main' into main
sapinderpalsingh a7b979f
Merge branch 'main' into main
sapinderpalsingh 34fbfbe
Merge branch 'main' into main
sapinderpalsingh b468c17
Enhance Redis provisioning with post-deploy access hooks
sapinderpalsingh 147ce10
Resolved copilot review comments
sapinderpalsingh 0abe62b
Merge branch 'main' into main
sapinderpalsingh fc69864
Add conversation_id check in response retrieval
sapinderpalsingh 67823cb
Refactor response envelope checks for clarity
sapinderpalsingh da76f26
Resolved review comments
sapinderpalsingh 1859e69
Merge branch 'main' into main
sapinderpalsingh 6bc060a
Merge branch 'main' into main
sapinderpalsingh e643c61
Resolved review comments
sapinderpalsingh 6dc754b
Merge branch 'main' into main
sapinderpalsingh 0948ed0
renamed sample to 25-custome-store
sapinderpalsingh fc94c74
Merge branch 'main' into main
sapinderpalsingh 5275576
Merge branch 'main' into main
sapinderpalsingh 90cd19e
fix(hosted-agents): make post-deploy hook executable
sapinderpalsingh b9ed180
Resolved review comments
sapinderpalsingh 6ebb9f4
Merge branch 'main' into main
sapinderpalsingh c0c9e9a
Merge branch 'main' into main
sapinderpalsingh 63c84e8
Merge branch 'main' into main
sapinderpalsingh 0104320
Add Azure CLI installation and authentication instructions
sapinderpalsingh 7cdc7fa
Merge branch 'main' into main
sapinderpalsingh cce47fe
Merge branch 'main' into main
sapinderpalsingh abfda9a
Renamed sample to 26-custom-store
sapinderpalsingh e9e5631
As per the review policy comment added uv.lock
sapinderpalsingh f6d9754
Refactor condition for conversation ID check
sapinderpalsingh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
...pelines/hosted-agent-tests/python/agent-framework/responses/26-custom-store/test-spec.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| version: 1 | ||
|
|
||
| sample: | ||
| owner: sapsing | ||
| experiences: [azd, vscode] | ||
|
|
||
| tests: | ||
| - name: validates-response-and-session-stores | ||
| turns: | ||
| - input: Remember the exact marker INC-2301 for my next message. Reply briefly. | ||
| - input: | | ||
| What exact marker did I ask you to remember? Then call | ||
| inspect_custom_store exactly once and include its result verbatim. | ||
| assertions: | ||
| - source: assistant_text | ||
| type: contains | ||
| value: INC-2301 | ||
|
|
||
| - source: assistant_text | ||
| type: regex | ||
| value: 'agent_session_store=[1-9][0-9]*' | ||
|
|
||
| - name: validates-checkpoint-store | ||
| turns: | ||
| - input: | | ||
| Call validate_checkpoint_store exactly once with marker CHK-2301. | ||
| Include the tool result verbatim. | ||
| assertions: | ||
| - source: assistant_text | ||
| type: contains | ||
| value: CHECKPOINT_STORE_OK CHK-2301 | ||
|
|
||
| - name: validates-function-approval-store | ||
| turns: | ||
| - input: | | ||
| Call approve_incident_change exactly once with change_id CHG-2301. | ||
| Include the tool result verbatim after approval. | ||
| approvals: | ||
| mcp: | ||
| - server_label: agent_framework | ||
| name: approve_incident_change | ||
| assertions: | ||
| - source: assistant_text | ||
| type: contains | ||
| value: APPROVAL_STORE_OK CHG-2301 | ||
|
|
||
| - name: confirms-all-four-stores-contain-data | ||
| turns: | ||
| - input: Call inspect_custom_store exactly once and include its result verbatim. | ||
| assertions: | ||
| - source: assistant_text | ||
| type: regex | ||
| value: 'response_store=[1-9][0-9]*' | ||
|
|
||
| - source: assistant_text | ||
| type: regex | ||
| value: 'agent_session_store=[1-9][0-9]*' | ||
|
|
||
| - source: assistant_text | ||
| type: regex | ||
| value: 'checkpoint_store=[1-9][0-9]*' | ||
|
|
||
| - source: assistant_text | ||
| type: regex | ||
| value: 'function_approval_store=[1-9][0-9]*' | ||
59 changes: 59 additions & 0 deletions
59
samples/python/hosted-agents/agent-framework/responses/26-custom-store/AGENTS.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| --- | ||
| description: Coding agent guidance for the custom store hosted-agent sample | ||
| --- | ||
|
|
||
| # Coding Agent Instructions | ||
|
|
||
| This sample is a Microsoft Foundry hosted Agent Framework agent served through | ||
| the Responses protocol. It replaces all four hosting storage extension points | ||
| with custom Redis-backed implementations: the Responses store, the agent | ||
| session store, the workflow checkpoint store, and the function approval store. | ||
|
|
||
| ## Key files | ||
|
|
||
| * `azure.yaml` defines the Foundry project, model, agent, runtime configuration, | ||
| deployed environment variables, and the layered infrastructure (Foundry layer | ||
| plus a Bicep layer that provisions Azure Managed Redis). | ||
| * `docker-compose.yml` runs a local Redis for `python main.py` development. | ||
| * `infra/redis/main.bicep` provisions Azure Managed Redis and exports its `REDIS_HOST` and `REDIS_PORT` outputs consumed by `azure.yaml`; the `hooks/` postdeploy scripts grant the deployed agent identity Redis data access. | ||
| * `src/agent-framework-agent-custom-store-responses/main.py` creates the agent | ||
| and supplies the response store plus the three store providers to | ||
| `ResponsesHostServer`. | ||
| * `src/agent-framework-agent-custom-store-responses/redis_database.py` owns the | ||
| shared async Redis client, key namespacing, and per-user partitioning helper. | ||
| * `src/agent-framework-agent-custom-store-responses/redis_response_store.py` | ||
| implements `ResponseProviderProtocol`. | ||
| * `src/agent-framework-agent-custom-store-responses/redis_state_stores.py` | ||
| implements the session, checkpoint, and function approval stores and their | ||
| providers. | ||
| * `README.md` documents local and hosted execution paths. | ||
|
|
||
| Preserve per-user partitioning, namespaced keys, and native key TTLs when | ||
| changing the stores. All four stores share one Redis instance and each owns its | ||
| own key prefix. | ||
|
|
||
| Do not commit `.vscode` launch or task files generated by Foundry Toolkit. Keep | ||
| the service virtual environment beside `pyproject.toml` under the service | ||
| directory, and keep `uv.lock` synchronized with project dependencies. | ||
|
|
||
| ## Development workflow | ||
|
|
||
| Use `azd` from an initialized agent project: | ||
|
|
||
| ``` | ||
|
|
||
| azd provision | ||
| azd ai agent run | ||
| azd ai agent invoke --local "your message" | ||
| azd deploy | ||
| azd ai agent invoke "your message" | ||
|
|
||
| ``` | ||
|
|
||
| This project was built with the `microsoft-foundry` skill. Before working on or | ||
| answering questions about Foundry agents, read the `vscode-microsoft-foundry` | ||
| skill first when using VS Code, then read the `microsoft-foundry` skill. | ||
|
|
||
| ## References | ||
|
|
||
| * [Hosted agents overview](https://learn.microsoft.com/azure/foundry/agents/concepts/hosted-agents) |
10 changes: 10 additions & 0 deletions
10
samples/python/hosted-agents/agent-framework/responses/26-custom-store/CLAUDE.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| description: Claude Code entry point for the sample coding agent instructions | ||
| --- | ||
|
|
||
| # Claude Code Instructions | ||
|
|
||
| This project uses [AGENTS.md](./AGENTS.md) as the source of truth for coding | ||
| agent instructions. | ||
|
|
||
| @AGENTS.md |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.