Commit Graph

2581 Commits

Author SHA1 Message Date
Ben Thomas 443c70d186 Use distinct private AgentServer wheel versions
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1674d491-af7d-4f9e-99aa-5a829db81591
2026-07-16 08:21:59 -07:00
Ben Thomas b9f23c7b6c Address durable workflow review feedback
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1674d491-af7d-4f9e-99aa-5a829db81591
2026-07-15 15:30:11 -07:00
Ben Thomas 216ae1d531 Removing intentional sleep from samples as intentional crashes now make the point better. 2026-07-15 14:16:15 -07:00
Ben Thomas 596538ffea Fix hosted workflow checkpoint persistence
Store hosted workflow checkpoints and approval state in the persistent session home, and add a deployable resilience sample that proves recovery across container crashes.

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

Copilot-Session: 1674d491-af7d-4f9e-99aa-5a829db81591
2026-07-15 14:02:02 -07:00
Ben Thomas 00a08c55b0 Use released core with preview hosting wheel
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1674d491-af7d-4f9e-99aa-5a829db81591
2026-07-15 10:48:56 -07:00
Ben Thomas e139ad2a91 Fail fast without durability preview
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1674d491-af7d-4f9e-99aa-5a829db81591
2026-07-15 09:35:55 -07:00
Ben Thomas 1bfe26919c Document private preview wheel setup
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1674d491-af7d-4f9e-99aa-5a829db81591
2026-07-15 09:27:01 -07:00
Ben Thomas 094f3653b4 Fix durable workflow recovery boundaries
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1674d491-af7d-4f9e-99aa-5a829db81591
2026-07-15 09:04:53 -07:00
Ben Thomas 9208c65f44 Address durable workflow review feedback
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1674d491-af7d-4f9e-99aa-5a829db81591
2026-07-14 20:28:49 -07:00
Ben Thomas 8936d718c9 Add durable workflow response recovery
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1674d491-af7d-4f9e-99aa-5a829db81591
2026-07-14 14:18:35 -07:00
Ben Thomas fa10c3f5bc fix: update agentserver wheel sources and fix 2 failing tests
- Switch agentserver wheel sources from GitHub raw URLs to find-links at
  local long-running-agents-private-preview checkout; remove [tool.uv.sources]
  URL entries from python/pyproject.toml
- Re-lock uv.lock for find-links path sources
- Guard tracker.close() in cancellation path to avoid ValueError when
  the SDK state machine is in not_started state
- Fix test assertions to access _ContextAwareCheckpointStorage._inner.storage_path
  instead of .storage_path (which is not exposed directly on the wrapper)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-14 14:18:34 -07:00
Tao Chen fca1bce5d0 Commit response state at checkpoint creation 2026-07-14 14:18:34 -07:00
Tao Chen de33b756cb Code cleanup 2026-07-14 14:18:33 -07:00
Tao Chen ce8aa4bd80 Remove non-streaming in invoking the inner agent 2026-07-14 14:18:33 -07:00
Tao Chen 072b8ddd0f Detect if checkpoint is supported via option and flag 2026-07-14 14:18:32 -07:00
Tao Chen d28d9c7d1d Add workflow context aware checkpoint storage and recovery path 2026-07-14 14:18:32 -07:00
Tao Chen d9e718e2f8 Add workflow sample 2026-07-14 14:18:31 -07:00
Tao Chen ec0ba56513 Fix samples 2026-07-13 14:56:01 -07:00
Ben Thomas d7b5f5c0ce Python: Replace manual kill steps with automated demo.py in 14_resilience
The previous README asked users to Ctrl+C the server at the right moment
while counting to 1000, which was unreliable and the model often refused
the prompt anyway.

demo.py orchestrates everything automatically:
1. Starts main.py as a subprocess
2. Sends a background request (returns in_progress immediately)
3. Kills the server after 2s (no timing pressure)
4. Restarts the server (recovery scanner fires)
5. Polls until the response completes and prints it

Uses a substantive prose prompt (explain how the internet works) that
reliably generates a long response without model refusals.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-13 14:54:49 -07:00
Ben Thomas d2053a4317 Python: Move steering and resilience to dedicated samples (13, 14)
- 01_basic: restore to minimal server-only sample; remove client.py,
  test_steering.py, and all steering/resilience content from README.
  Add brief 'Next steps' links to 13 and 14.

- 13_steering: new sample demonstrating steerable_conversations=True.
  main.py starts the server; client.py is an interactive two-terminal
  demo that sends two concurrent turns and shows the queued/steered flow.

- 14_resilience: new sample demonstrating resilient_background=True.
  main.py starts the server with crash recovery enabled. README walks
  through testing crash recovery locally (kill the server mid-response,
  restart, and poll the response to see it recover).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-13 14:54:49 -07:00
Ben Thomas e7e2692a71 Python: Add client.py steering demo to 01_basic sample
Add client.py — a two-terminal steering demonstration.  Run main.py in
one terminal and client.py in a second to see steering in action with a
real Foundry agent:

- Turn 1 streams the agent counting to 50
- 2 s later, turn 2 arrives on the same conversation with a different question
- Turn 2 is accepted with status=queued (not HTTP 409)
- Turn 1's handler is cancelled and emits response.completed with partial output
- Turn 2 runs and its answer is printed

client.py accepts an optional SERVER_URL argument so it can be pointed at
a deployed instance as well as localhost.

Also enable steerable_conversations=True in main.py and update README with
the two-terminal usage instructions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-13 14:54:49 -07:00
Ben Thomas d101df2fbe Python: Make resilient_background opt-in, remove auto-enable
resilient_background=True was previously auto-enabled when running in a
hosted Foundry environment. This is now opt-in: callers must pass it
explicitly via ResponsesServerOptions.

  server = ResponsesHostServer(
      agent,
      options=ResponsesServerOptions(resilient_background=True),
  )

Reasoning: auto-enabling crash recovery silently can cause unexpected
behaviour for agents with non-idempotent side effects. Requiring explicit
opt-in makes the behaviour transparent and intentional.

Updates:
- _responses.py: remove auto-enable logic and AgentConfig check
- test_responses.py: replace auto-enable tests with a single test
  asserting resilient_background is never auto-enabled
- 01_basic/main.py: rewrite comment to describe opt-in pattern
- 01_basic/README.md: rewrite durability section as opt-in

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-13 14:54:48 -07:00
Ben Thomas bc488965d8 Python: Update steering test to use real FoundryChatClient agent
Replaces the mock slow agent with a real FoundryChatClient + Agent using
FOUNDRY_PROJECT_ENDPOINT and AZURE_AI_MODEL_DEPLOYMENT_NAME env vars,
consistent with the 01_basic sample. Loads .env via python-dotenv.
Asks the agent to count to 100 (produces a long streaming response),
then steers with a joke request after 2s.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-13 14:54:47 -07:00
Ben Thomas bb37af0f01 Python: Fix _handle_response async generator + steering test
Fix async generator handler signature (b8 compatibility):
  _handle_response was async def returning AsyncIterable. The b8 SDK
  passes the raw handler result directly to _intercept_checkpoints which
  does 'async for raw in handler_iterator' — this fails on a coroutine
  with TypeError (caught as B8 pre-creation error), silently producing
  empty responses. Changed to async generator (using yield) so calling
  it returns an AsyncGenerator immediately iterable without awaiting.

Update 01_basic sample (durable_background -> resilient_background):
  main.py comments and README referenced the old durable_background field
  name (renamed to resilient_background in b8). Updated both to use the
  correct API and added steerable_conversations documentation.

Add steering integration test (test_steering.py):
  Self-contained end-to-end test using Hypercorn on a loopback port and
  concurrent asyncio tasks. Demonstrates the full steering flow:
  turn 1 streams, turn 2 arrives while turn 1 is in_progress and gets
  status=queued, turn 1 emits response.completed (cancellation terminal
  fix), turn 2 runs and completes. Requires clean ~/.agentserver state
  (no stale task files) on first run; uses unique UUID per test run.

Also add pre-existing sample exclusions to pyrightconfig.samples.json
for monty/tools samples not installed in the dev environment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-13 14:54:47 -07:00
Ben Thomas b2ee149c19 Python: Add steerable_conversations support to ResponsesHostServer
- Fix resilient_background rename: ResponsesServerOptions no longer
  accepts durable_background (renamed to resilient_background in b8).
  The old name caused a silent TypeError that disabled crash recovery
  in hosted environments.

- Add steerable_conversations parameter to ResponsesHostServer.__init__.
  When True, concurrent turns on the same conversation chain are queued
  rather than rejected with 409 conversation_locked. The flag is threaded
  into ResponsesServerOptions and composed with resilient_background in
  the auto-enable path for hosted environments.

- Fix streaming cancellation terminal: both _handle_inner_agent and
  _handle_inner_workflow now emit response.completed before returning
  when cancellation_signal fires. Per spec §10, the handler must emit
  a terminal event; the framework overrides completed → cancelled when
  context.client_cancelled=True (real client cancel), and leaves it as
  completed for steering pressure (client_cancelled=False). Previously
  returning without a terminal caused the framework to force failed,
  which broke the steered-turn chain.

- Add comment in _handle_inner_workflow explaining the relationship
  between previous_response_id and conversation_chain_id for steerable
  turns (they resolve to the same key, so the existing restore logic
  is already correct).

- Update tests: rename resilient_background tests, update cancellation
  test to assert response.completed is emitted, add three new tests
  for steerable_conversations threading and precedence rules.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-13 14:53:27 -07:00
Ben Thomas 084ce7bf5d Python: Bump azure-ai-agentserver-* to b7/b6/b8 pre-release wheels
- azure-ai-agentserver-core: 2.0.0b5 -> 2.0.0b7 (resilient task primitive, event streaming API)
- azure-ai-agentserver-invocations: 1.0.0b3 -> 1.0.0b6 (bug fixes, requires core >=b7)
- azure-ai-agentserver-responses: 1.0.0b7 -> 1.0.0b8 (resilient background responses, steerable conversations, developer checkpoints)

New versions are unreleased on PyPI; source them via direct URL to the
pinned commit in azure-sdk-for-python via [tool.uv.sources].

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-13 14:50:05 -07:00
pratik wayase 43568f1ef2 Fix: coalesce reasoning deltas into single block when content.id is None (#6804)
python/packages/ag-ui/tests/ag_ui/test_run_commoclear
:wq
2026-07-13 21:11:22 +00:00
VectorPeak 52005ff17d Python: accept AG-UI state data URI parameters (#6905)
* Python: Accept AG-UI state data URI parameters

* Python: Handle invalid AG-UI state base64

---------

Co-authored-by: VectorPeak <VectorPeak@users.noreply.github.com>
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
2026-07-13 21:05:27 +00:00
pratik wayase a4e4a5a51c Python: Fix: Ollama parallel tool calls collide on same call_id (#6822)
* Fix: Ollama parallel tool calls collide on same call_id

* fix(ollama): use uuid4 for tool call IDs and support colons in tool names

---------

Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
2026-07-13 21:02:24 +00:00
Alireza Afzali c8fb491644 Python: docs: add env example files for durabletask samples (#5948)
* docs: add env example files for durabletask samples

* docs: clarify env example values and comments

* docs: set default Redis URL in streaming sample env example
2026-07-13 21:01:19 +00:00
westey e57f046d8a Graduate mode and todo providers (#7052) 2026-07-13 13:47:58 +00:00
westey c9b19e831f Gradudate mode and todo providers (#7053) 2026-07-13 13:47:53 +00:00
westey beb65b21a8 .NET: [BREAKING] Graduate message injection out of experimental (#7044)
* Remove experiemental flags for MessageInjection component

* Improve locking on message injection.
2026-07-13 11:26:01 +00:00
westey b3d523ee50 Python: [BREAKING] Fix harness before-strategy compaction under per-service-call persistence (#7055)
* Fix middleware ordering to ensure compaction runs

* Address PR comments

* Fix build issue
2026-07-13 09:51:00 +00:00
Copilot 6f38cb724d .NET: Enable Valkey NuGet package publishing (#7059)
* Initial plan

* Enable Valkey NuGet package publishing

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-07-13 09:31:49 +00:00
Tao Chen 8e74360d52 Python: Add Microsoft OpenTelemetry Distro sample (#5632)
* Add Microsoft OpenTelemetry Distro sample

* Verify and add README

* Add dependency header

* Add maf dependency in PEP 723 block
2026-07-13 01:51:15 +00:00
ByteWise 7f4cc296fd Python: preserve tool span context for parallel calls (#6512)
* Python: preserve tool span context for parallel calls

* Python: address parallel tool span review feedback

* Python: fix parallel tool span test checks

---------

Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
2026-07-13 00:07:53 +00:00
Benke Qu f3057ef20c Python: fix: clear service_session_id in _agent_wrapper when propagate_session=True (#5875)
* fix: clear service_session_id in _agent_wrapper when propagate_session=True

When propagate_session=True, the child agent inherits the parent's
service_session_id. After the parent's first LLM call, MAF auto-populates
this from the Responses API conversation_id. The child sends it as
previous_response_id which the server rejects because the parent's
tool_call is still pending (400 error).

This fix saves and clears service_session_id before calling the child
agent and restores it in a finally block, preserving session.state
sharing while isolating the server-side conversation pointer.

Fixes #5874

* refactor: use child session copy instead of in-place mutation

Address Copilot review comments:
- Create a child AgentSession with shared state dict but isolated
  service_session_id, avoiding race conditions under concurrent
  asyncio.gather tool invocations.
- Update tests to verify child gets a separate session object and
  that child-set service_session_id does not leak to parent.

* fix: update test_chat_agent_as_tool_propagate_session_true for child session isolation

The existing test asserted captured_session is parent_session, but since
we now create a separate child AgentSession (to avoid racing under concurrent
asyncio.gather), the child is a different object. Updated assertions to verify:
- child is NOT the parent object (isolation)
- child shares the same session_id and state dict (by reference)
- child's service_session_id is None (isolated)

* fix: add type narrowing asserts for captured_session

Add 'assert captured_session is not None' before attribute access to
satisfy mypy/pyright type checking on Optional values.

* Python: Fix test typing checks

---------

Co-authored-by: Benke Qu <bequ@microsoft.com>
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
Co-authored-by: Evan Mattson <evan.mattson@microsoft.com>
2026-07-12 23:37:53 +00:00
Eduard van Valkenburg 68136ee081 Python: Clean up dependency groups and compatibility (#7046)
* Python: Clean up dependency management

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

Copilot-Session: 2f7b1c89-f3ff-418d-ab4e-4f014fda308f

* Python: Harden Mistral SDK import fallback

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

Copilot-Session: 2f7b1c89-f3ff-418d-ab4e-4f014fda308f
2026-07-10 22:40:42 +00:00
Peter Ibekwe 875031ff56 Fix broken sample 2026-07-10 11:26:05 -07:00
Evan Mattson 87af313119 Python: [BREAKING]: Emit TOOL_CALL events for workflow participant tool calls in AG-UI (#7039)
* Python: emit participant tool calls in AG-UI workflows

Decisions:
- Pass function call, function result, and approval request content from streaming agent updates regardless of role.
- Preserve the assistant-role gate for text and reuse the shared AG-UI content emitters without dual custom-event emission.

Files changed:
- packages/ag-ui/agent_framework_ag_ui/_workflow_run.py
- packages/ag-ui/tests/ag_ui/test_workflow_run.py

Verification:
- uv run poe test -P ag-ui
- uv run poe pyright -P ag-ui
- uv run poe test-typing -P ag-ui
- uv run poe syntax -P ag-ui -C

Notes:
- Existing workflow golden scenarios do not exercise participant tool calls, so no snapshot changed.
- No blockers.

* Python: guard participant tool call duplication

Decisions:
- Assert the workflow stream emits one TOOL_CALL_START when a streamed call is also present in final conversation history.
- Keep production flow unchanged because latest-assistant final-response conversion prevents duplication.

Files changed:
- packages/ag-ui/tests/ag_ui/test_workflow_run.py

Verification:
- uv run pytest packages/ag-ui/tests/ag_ui/test_workflow_run.py -k 'participant_tool_call or repeat_tool_call' -q
- uv run poe test -P ag-ui
- uv run poe pyright -P ag-ui
- uv run poe test-typing -P ag-ui
- uv run poe syntax -P ag-ui -C
- git diff --check

Notes:
- No blockers; no call-id guard was required.

* Python: scope workflow tool content bypass to resumable tool calls

- Exclude approval request content from the role bypass. Workflow approvals
  resume through request_info pending state, so an approval interrupt emitted
  from streamed content would have no pending request to resume against.
- Admit mcp_server_tool_call and mcp_server_tool_result so provider-hosted MCP
  tool calls from workflow participants emit standard tool call events.
- Add unit tests for MCP passthrough, approval exclusion, and mixed
  text-plus-tool content in non-assistant updates.
2026-07-10 16:58:07 +00:00
Evan Mattson 9ac548ad15 Python: keep attachments close (#7038)
* Python: keep attachments close

* Python: close attachment edge cases
2026-07-10 16:57:29 +00:00
Peter Ibekwe 737042fc93 Fix workflow session bug (#7032) 2026-07-10 16:56:57 +00:00
Patrick Woo-Sam e677ccc3b1 .NET: Fix CompactionMessageIndex.IsSummaryMessage (#7042)
* Fix CompactionMessageIndex.IsSummaryMessage

* Add more robust JsonElement value checking and tests cases
2026-07-10 15:03:26 +00:00
Theo van Kraay d9c0c36379 Fix CosmosChatHistoryProvider: omit ttl when MessageTtlSeconds is null (#6992) (#7030) 2026-07-10 13:01:59 +00:00
HaoJun 32a547a1a7 Python: bind AG-UI tool arguments to call IDs (#6342)
Co-authored-by: White-Mouse <15983334+White-Mouse@users.noreply.github.com>
2026-07-10 06:54:53 +00:00
Evan Mattson 7464a59228 Python: Bump Python package versions for 1.11.0 release (#7035)
* Bump Python package versions for 1.11.0 release

Bump the CHANGELOG-selected packages for the 1.11.0 release: core and the root package move to 1.11.0 for the new stable APIs, Foundry and OpenAI receive patch bumps, changed prerelease packages receive the 260709 stamp or next RC counter, and Monty joins the bump set for corrected published dependency metadata. No beta cohort bump was applied. Raise core floors conservatively on every package publishing this cycle and correct dependency floors exposed by lower-bound validation.

Copilot-Session: ee33d338-c1fc-4182-9106-0345ccf26b8e

* Fix Gemini streaming type suppression

Move the targeted Pyright suppression to the SDK contents argument, where the google-genai invariant content-list alias produces the compatibility diagnostic, and remove the now-unnecessary member suppression.

Copilot-Session: ee33d338-c1fc-4182-9106-0345ccf26b8e

* Raise Monty core dependency floor

Align Monty with the conservative release policy by requiring agent-framework-core 1.11.0 or later for the package version published in this cycle.

Copilot-Session: ee33d338-c1fc-4182-9106-0345ccf26b8e
python-1.11.0
2026-07-10 12:15:26 +09:00
Ethan qu 01ec3b7bcf Fix AG-UI approval thread aliases (#6908)
Co-authored-by: godququ5-code <256881196+godququ5-code@users.noreply.github.com>
2026-07-10 00:51:49 +00:00
westey ce96fd4b72 Python: Integrate message injection into harness agent (#7027)
* Integrate message injection into harness agent and sample console

* Add agents.md update.

* Address PR comments
2026-07-10 00:33:31 +00:00
Evan Mattson 52237b8eff Python: consolidate dependency updates (#7033) 2026-07-10 00:25:30 +00:00