* add class-based skills
* address formating issues
* Remove generated filtered-unit.slnx and add to .gitignore
The filtered solution file is generated dynamically by
eng/scripts/New-FilteredSolution.ps1 during CI. Checking it in
risks it becoming stale and out-of-sync with the real solution.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove generated filtered-unit.slnx and add to .gitignore
The filtered solution file is generated dynamically by
eng/scripts/New-FilteredSolution.ps1 during CI. Checking it in
risks it becoming stale and out-of-sync with the real solution.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* consolidate DI samples into one
* fix file encoding
* suppress compatibility warning
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add github actions workflow for verify-samples
* Make workflow run as part of PR (for now)
* Update workflow to remove pr trigger
* Address PR comments
* fix: Remove Timeout from InputWait in StreamingRunEventStream
* fix: Race condition when the workflow executes to halt before TakeEventStream
* test: Make the OffThread Delay test more nimble
* fix: Remove slight window where runStatus could be stale
* Fix GitHubCopilotAgent not calling context provider hooks (#3984)
GitHubCopilotAgent accepted context_providers in its constructor but
never called before_run()/after_run() on them in _run_impl() or
_stream_updates(), silently ignoring all context providers.
Add _run_before_providers() helper to create SessionContext and invoke
before_run on each provider. Both _run_impl() and _stream_updates() now
run the full provider lifecycle: before_run before sending the prompt
(with provider instructions prepended) and after_run after receiving the
response. This follows the same pattern used by A2AAgent.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Python: Fix GitHubCopilotAgent to invoke context provider before_run/after_run hooks
Fixes#3984
* fix(#3984): address review feedback for context provider integration
- Build prompt from session_context.get_messages(include_input=True) so
provider-injected context_messages are included in both non-streaming
and streaming paths (review comments #1, #2)
- Preserve timeout in opts (use get instead of pop) so providers can
observe it via context.options (review comment #3)
- Eliminate streaming double-buffer: move after_run invocation to a
ResponseStream result_hook (matching Agent class pattern) instead of
maintaining a separate updates list in the generator (review comment #4)
- Improve _run_before_providers docstring
Add tests for:
- Context messages included in prompt (non-streaming + streaming)
- Error path: after_run NOT called when send_and_wait/streaming raises
- Multiple providers: forward before_run, reverse after_run ordering
- BaseHistoryProvider with load_messages=False is skipped
- Streaming after_run response contains aggregated updates
- Streaming with no updates still sets empty response
- Timeout preserved in session context options for providers
Note: _run_before_providers remains on GitHubCopilotAgent for now. A
follow-up PR should extract it to BaseAgent so subclasses can reuse it
without duplicating the provider iteration logic.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address review feedback for #3984: Python: [Bug]: GitHubCopilotAgent Memory Example
* refactor(#3984): promote _run_before_providers to BaseAgent
Move _run_before_providers from GitHubCopilotAgent into BaseAgent,
mirroring the existing _run_after_providers helper. Agent's
_prepare_session_and_messages now delegates to the shared base method,
eliminating the near-duplicate provider iteration logic that could
drift as the provider contract evolves.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address review feedback for #3984: Python: [Bug]: GitHubCopilotAgent Memory Example
* revert: keep _run_before_providers in GitHubCopilotAgent only
Undo the promotion of _run_before_providers to BaseAgent. The method
stays in GitHubCopilotAgent where it is needed, and _agents.py
retains its original inline provider iteration in RawAgent.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: replace deprecated BaseContextProvider/BaseHistoryProvider with ContextProvider/HistoryProvider
Update imports and usages in GitHubCopilotAgent and its tests to use
the new non-deprecated class names from the core package.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: address review feedback - reorder providers before session, wrap streaming after_run in try/except, assert after_run on skipped HistoryProvider
- Move _run_before_providers before _get_or_create_session so provider
contributions can affect session configuration
- Wrap _run_after_providers in try/except in streaming _after_run_hook
to prevent provider errors from replacing successful responses
- Add after_run assertion to test_history_provider_skip_when_load_messages_false
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add deduplication to `prepend_instructions_to_messages()` to skip
instructions that are already present as leading messages with the
same role and text. This prevents duplicate system messages when
instructions are injected by multiple layers (e.g. Agent + chat client).
Fixes#5049
* Update Foundry Responses as ChatClientAgent
* Migrate obsolete AzureAI integration tests to versioned agent pattern
Replace obsolete CreateAIAgentAsync/GetAIAgentAsync calls with
Agents.CreateAgentVersionAsync() + AsAIAgent(AgentVersion) in all
AzureAI integration tests.
- Rename AIProjectClient* test files to FoundryVersionedAgent*
- Register AIFunction tools in PromptAgentDefinition.Tools for
server-side visibility via AsOpenAIResponseTool()
- Skip structured output tests (AzureAIProjectChatClient clears
ResponseFormat for versioned agents)
- Remove all [Obsolete] attributes and #pragma warning disable CS0618
* Merge FoundryMemory package into AzureAI under Memory/ folder
Move all FoundryMemory source, unit tests, and integration tests into
the Microsoft.Agents.AI.AzureAI package. Change namespace from
Microsoft.Agents.AI.FoundryMemory to Microsoft.Agents.AI.AzureAI.
- Add [Experimental] to FoundryMemoryProviderOptions and Scope
- Rename internal AIProjectClientExtensions to MemoryStoreExtensions
- Update AzureAI .csproj with Compliance.Abstractions, Redaction
- Remove FoundryMemory from solution and release filter
- Update sample to reference AzureAI instead of FoundryMemory
- Delete old Microsoft.Agents.AI.FoundryMemory project and tests
* Add EnsureMemoryStoreCreatedAsync and memory existence checks to integration tests
- Ensure memory store is created before testing memory operations
- Add AZURE_AI_EMBEDDING_DEPLOYMENT_NAME config setting
- Assert memories exist in store via SearchMemoriesAsync before cleanup
- Verify scope isolation with direct memory store queries
* Fix and rename AzureAI unit tests for RAPI vs Versioned clarity
- Rename AsAIAgentAsync_* to AsAIAgent_* (drop Async from method group)
- Add _Rapi_ prefix to non-versioned (Responses API) tests
- Add _Versioned_ prefix to versioned agent tests where needed
- Fix RAPI tests: assert GetService<AIProjectClient>() is null
- Fix Versioned tests: assert IsType<FoundryAgent> and
GetService<AIProjectClient>() returns the client instance
- Fix UserAgent header tests: proper HTTP handler routing
- Fix ChatClient_UsesDefaultConversationIdAsync test setup
- All 153 unit tests pass with 0 failures
* Rename Microsoft.Agents.AI.AzureAI to Microsoft.Agents.AI.Foundry
Rename the project, namespace, folder, and all references from
Microsoft.Agents.AI.AzureAI to Microsoft.Agents.AI.Foundry.
Also rename Workflows.Declarative.AzureAI to .Foundry.
- Rename src, unit test, integration test, and workflow folders
- Update namespaces in all source and test .cs files
- Update ProjectReferences in ~47 sample and test .csproj files
- Update solution files (.slnx, .slnf)
- Update sample using statements
- Update READMEs, SKILL.md, ADRs in docs/
- Disable package validation baseline for renamed packages
- Fix UTF-8 BOM encoding on all affected .cs files
- AzureAI.Persistent left completely unchanged
* Fix format: remove ImplicitUsings, add explicit usings, fix BOM encoding
- Remove ImplicitUsings=enable from Foundry csproj to resolve IDE0005
on shared ReplacingRedactor.cs
- Add explicit System usings to all source files that relied on them
- Sort usings alphabetically per editorconfig rules
- Fix UTF-8 BOM on 12 sample Program.cs files
- Rename Azure AI Foundry Agents to Microsoft Foundry Agents in docs
* Python: Fix broken samples and add missing READMEs
- simple_context_provider: move instructions kwarg into options dict
- suspend_resume_session: use OpenAIChatCompletionClient for in-memory demo
- foundry_chat_client_with_hosted_mcp: move store kwarg into options dict
- Add README.md for context_providers and conversations sample folders
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Python: Fix additional sample issues in context_providers
- mem0_basic: send preferences query before sleep so Mem0 can learn them,
print result from new session recall
- mem0_sessions: add session for multi-turn conversation in agent-scoped
example, remove user_id from agent-scoped provider (Mem0 API stores
memories without user_id when agent_id is provided), use single message
for storing preferences
- redis_basics: print retrieved context messages instead of raw object
- redis_sessions: add missing load_dotenv() call
- redis_basics/redis_sessions: fix docstrings referencing wrong client type
- azure_redis_conversation: replace duplicate copyright with load_dotenv()
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Python: Fix broken link in declarative README
openai_responses_agent.py was renamed to openai_agent.py
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Refactor Anthropic model option and provider clients
Rename the Anthropic client model option from model_id to model, add provider-specific Anthropic wrappers for Foundry, Bedrock, and Vertex, and expose them through the Anthropic, Foundry, Amazon, and Google namespaces. Update core option handling, docs, samples, and tests accordingly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix Anthropic skills sample typing
Cast the Anthropic beta client to Any in the skills sample so the pre-commit sample pyright check no longer fails on beta skills and files endpoints that are not exposed by the current SDK stubs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* undo sample mypy
* Retry CI after transient external failures
Retrigger PR validation after an unrelated Copilot review workflow SAML failure and a transient external tau2 git fetch failure in the Windows Python test setup.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address review feedback on model option merging
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address Anthropic compatibility review feedback
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* moved all to `model`
* fixes for azure ai search
* Python: standardize remaining sample env var names
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Python: fix foundry-local pyright compatibility
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* updated env vars in cicd
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Eduard van Valkenburg
·
2026-04-01 19:00:18 +00:00
* Fix RequestInfoEvent lost when resuming workflow from checkpoint
* Fix streaming run double disposal in tests and lockstep republishing before Started event is emitted.
* Fix bug to remove messages after sending to avoid losing messages on send failure.
* Fix declarative test harness
* Fix agent_with_hosted_mcp sample to use AzureOpenAIResponsesClient (#4861)
The agent_with_hosted_mcp sample used AzureOpenAIChatClient with an MCP tool
dict, but the Chat Completions API only supports 'function' and 'custom' tool
types, not 'mcp'. This caused a 400 error at runtime.
Switch the sample to AzureOpenAIResponsesClient which natively supports MCP
tools via the Responses API. Use get_mcp_tool() to construct the tool config.
Changes:
- main.py: Replace AzureOpenAIChatClient with AzureOpenAIResponsesClient
- requirements.txt: Update azure-ai-agentserver-agentframework to 1.0.0b16
and use agent-framework-azure-ai package
- agent.yaml: Use AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME env var
- Add regression test documenting chat client MCP tool passthrough behavior
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Python: Fix agent_with_hosted_mcp sample to use Responses API client for MCP tools
Fixes#4861
* Remove REPRODUCTION_REPORT.md investigation artifact (#4861)
Remove the reproduction report markdown file from the test directory.
Investigation notes belong in the GitHub issue or PR description,
not as committed files in the source tree. The regression test in
test_openai_chat_client.py already provides automated verification.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add MCP tool API rejection regression test (#4861)
Add test_mcp_tool_dict_causes_api_rejection to verify that MCP tool
dicts passed through to the Chat Completions API result in a clear
ChatClientException rather than being silently dropped. This completes
the regression test coverage requested in code review.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* small fix
* Revert deletion of dotnet local.settings.json files
Restore the two local.settings.json files that were accidentally deleted in this PR.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix _add_text_reasoning_content dropping id during coalescing (#4852)
Preserve the id field (rs_* identifier) when coalescing text_reasoning
Content objects by passing id=self.id or other.id to the Content
constructor. This fixes the encrypted reasoning round-trip where the
missing id prevented _prepare_content_for_openai from including it in
the serialized reasoning item.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Python: Fix `_add_text_reasoning_content` to preserve `id` during coalescing
Fixes#4852
* Raise AdditionItemMismatch on conflicting text_reasoning ids (#4852)
Detect when both operands have different non-empty ids during
text_reasoning Content coalescing and raise AdditionItemMismatch
instead of silently keeping one. This prevents mis-associating
encrypted_content during round-trips.
Also adds tests for conflicting ids and the neither-has-id edge case.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address review feedback for #4852: Python: [Bug]: Content._add_text_reasoning_content drops id during coalescing, breaking encrypted reasoning round-trip
* test fix
---------
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Python: Remove unsupported memory scoping params from samples and docs
Fixes#4353
The `Mem0ContextProvider` and `RedisContextProvider` no longer support
`thread_id` or `scope_to_per_operation_thread_id` parameters. This commit
updates the affected samples and READMEs to use only the currently
supported API (`user_id`, `agent_id`, `application_id`).
Changes:
- mem0_sessions.py: Remove `thread_id` and
`scope_to_per_operation_thread_id` from examples 1 and 2, rewrite to
demonstrate user-scoped and agent-scoped memory patterns
- redis_sessions.py: Update module docstring to remove references to
removed thread scoping params
- mem0/README.md: Update Memory Scoping docs to reflect current API
- redis/README.md: Remove `thread_id` and
`scope_to_per_operation_thread_id` references from docs
* Address Copilot review: rename thread_scope functions, fix docstring
- Rename `example_global_thread_scope` -> `example_global_memory_scope`
- Rename `example_per_operation_thread_scope` -> `example_agent_scoped_memory`
- Update example 2 docstring to mention `application_id` alongside
`user_id` and `agent_id` since it's set in the provider config
- Update module docstring scenario 2 to include `application_id`
* fix: rebase onto main, address giles17 review feedback
- Resolve merge conflicts by rebasing all 4 original files onto current main
- Address giles17's agent review suggestions:
- mem0_basic.py: update comment to remove thread_id from scoping list
- mem0_oss.py: update comment to remove thread_id from scoping list
- redis_sessions.py: rename Example 2 from "Agent-Scoped Memory" to
"Hybrid Vector Search" to accurately describe what it demonstrates
- redis/README.md: update Example 2 description to match renamed example
---------
Co-authored-by: Tao Chen <taochen@microsoft.com>
Co-authored-by: Giles Odigwe <79032838+giles17@users.noreply.github.com>
* Add Python A2A agent-as-function-tools sample
Port of the .NET A2AAgent_AsFunctionTools sample to Python.
Resolves a remote A2A agent card, converts each skill to a
FunctionTool via as_tool(), and registers them with a host agent
using AzureOpenAIResponsesClient.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Sanitize A2A skill names before passing to as_tool()
as_tool() only auto-sanitizes when name is omitted. Since we pass
skill.name explicitly, we need to strip special characters ourselves.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>