You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f488ec5
Browse filesBrowse the repository at this point in the historyBrowse files
> **Update (2026-11-05):**`HostedFoundryMemoryProviderScopes` was removed during pre-stable
15
+
> API cleanup. Hosted memory samples now read `session.GetFoundryHostedUserId()` directly when
16
+
> constructing `FoundryMemoryProvider.State`, keeping the trusted identity-to-memory-scope mapping
17
+
> visible without a memory-specific hosting helper.
18
+
>
19
+
> `HostedSessionIsolationKeyProvider` was also removed. The handler now reads
20
+
> `ResponseContext.PlatformContext.UserIdKey` directly. Local requests without a user id run
21
+
> unscoped, while tests or local clients that need distinct users can send `x-agent-user-id` for
22
+
> AgentServer to populate `PlatformContext`.
23
+
>
24
+
> The public `HostedSessionContext` / `GetHostedContext()` surface was replaced by
25
+
> `AgentSession.GetFoundryHostedUserId()`. The hosting layer persists the resolved user id as a plain string
26
+
> in the session state bag, making clear that it is a user partition and not the Foundry hosted
27
+
> session id.
28
+
14
29
## Context and Problem Statement
15
30
16
31
[ADR-0026](0026-hosted-session-identity-context.md) sourced the hosted-agent end-user identity from `ResponseContext.Isolation` (an `IsolationContext` typed `UserIsolationKey` / `ChatIsolationKey`), injected by the platform as the `x-agent-user-isolation-key` and `x-agent-chat-isolation-key` headers.
Copy file name to clipboardExpand all lines: docs/decisions/0041-foundry-hosting-resilient-long-running-agents.md
+7-9Lines changed: 7 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ and checkpoint storage introduced for Foundry state stores (PR #7649).
33
33
- Pair each persisted workflow response snapshot with the exact workflow checkpoint it represents.
34
34
- Opt-in and off by default; non-resilient hosts pay nothing.
35
35
- Prefer workflows: they already checkpoint between supersteps.
36
-
- Keep a lean API on `FoundryResponsesOptions`, forwarded to `ResponsesServerOptions`.
36
+
- Keep a lean API on `FoundryResponsesServerOptions`, forwarded to `ResponsesServerOptions`.
37
37
- Persist agent sessions through the Foundry state store (or its local fallback), not a second disk layout.
38
38
39
39
## Decision Outcome
@@ -42,7 +42,7 @@ Chosen option: **turn resilience on through the existing handler and registratio
42
42
43
43
### Public surface
44
44
45
-
`FoundryResponsesOptions.ResilientBackground` and `FoundryResponsesOptions.SteerableConversations`
45
+
`FoundryResponsesServerOptions.ResilientBackground` and `FoundryResponsesServerOptions.SteerableConversations`
46
46
are forwarded to `ResponsesServerOptions` so the AgentServer SDK enables recovery and steering.
47
47
This forwarding must happen in the callback passed directly to `AddResponsesServer`. The SDK makes
48
48
two process-level choices during that registration call: whether local SSE replay uses durable
@@ -147,7 +147,7 @@ paired recovery boundary. The superseded response still reaches a terminal `comp
147
147
|---|---|---|
148
148
| Resilient task, SSE events, `ResponseObject` snapshots, `_last_checkpoint_id`| AgentServer | Re-invoke the handler and identify the workflow checkpoint represented by each response snapshot |
149
149
| Serialized `AgentSession`| Foundry Hosting | Restore agent-owned state and the workflow checkpoint reference |
150
-
| Workflow execution checkpoints | Workflow runtime through `FoundryJsonCheckpointStore`| Restore executors, queued messages, pending requests, and workflow state |
150
+
| Workflow execution checkpoints | Workflow runtime through Foundry state-store-backed checkpoint storage| Restore executors, queued messages, pending requests, and workflow state |
151
151
152
152
The handler calls `ResponseEventStream.Checkpoint()` only after a workflow superstep supplies a new
153
153
checkpoint ID and the matching `AgentSession` save succeeds. `PersistedResponse.Output.Count` is not
@@ -156,10 +156,9 @@ workflow storage.
156
156
157
157
### Relationship to durable storage (PR #7649)
158
158
159
-
Sessions and workflow checkpoints already go through `FoundryAgentSessionStore` /
Copy file name to clipboardExpand all lines: docs/specs/004-python-function-calling-loop.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -548,7 +548,8 @@ that manually replay messages own the equivalent rule: do not resend an approval
548
548
approval continuation. Interactive, delayed, or durable approval belongs in a workflow. When
549
549
`propagate_session=True`, child application-state changes merge back into the parent while framework approval and
550
550
invocation-budget state remain isolated, including approval queues stored under custom child middleware
551
-
`source_id` values. Parent and child `ToolApprovalMiddleware` instances must use distinct `source_id` values; an
551
+
`source_id` values. Parent and child `ToolApprovalMiddleware` instances must use distinct `source_id` values, whether
552
+
the parent middleware is configured on the agent or passed to a single run; an
552
553
overlap fails before the child runs. The automatic function loop also supplies the parent agent/client's declared
553
554
provider-owned state keys. A custom loop that directly invokes the agent tool must set
554
555
`FunctionInvocationContext.parent_service_session_state_keys` explicitly; when that ownership is unavailable, a
@@ -640,7 +641,7 @@ that manually replay messages own the equivalent rule: do not resend an approval
640
641
| Mixed approved/rejected batch | Every call gets one correctly correlated terminal result. |`packages/core/tests/core/test_function_invocation_logic.py::test_rejected_approval`|
641
642
| Persisted approval replay | Resume executes with the prior call available. |`test_persisted_approval_messages_replay_correctly`|
642
643
| Hosted approval pass-through | Hosted requests/responses are bound to the recorded provider request and are not processed as local calls. |`test_hosted_tool_approval_response`, `test_hosted_mcp_approval_response_passthrough`, `test_session_approval_binding_reconstructs_hosted_response`, `test_mixed_local_and_hosted_approval_flow`|
643
-
| Agent-tool child approval | A child `ToolApprovalMiddleware` can auto-approve runtime tool requests inside one delegated invocation; unresolved child approvals execute nothing and do not enter the caller's approval state or dispatch a same-named parent tool, including with propagated application state. Mixed batches preserve non-approval user-input requests. Shared parent and child state rejects overlapping `ToolApprovalMiddleware.source_id` values before running the child; parent approval state is neither visible nor mutable inside the child, and custom child approval queues do not leak into later delegations. | `packages/core/tests/core/test_agents.py::test_chat_agent_as_tool_auto_approves_child_tool_with_middleware`, `test_chat_agent_as_tool_fails_closed_for_unresolved_child_approval`, `test_chat_agent_as_tool_child_approval_does_not_dispatch_same_named_parent_tool`, `test_chat_agent_as_tool_preserves_non_approval_requests_from_mixed_child_batch`, `test_chat_agent_as_tool_shared_session_requires_distinct_tool_approval_source_ids`, `test_chat_agent_as_tool_isolates_custom_parent_approval_state`, `test_chat_agent_as_tool_approved_delegation_does_not_confuse_framework_approval_state`, `test_chat_agent_as_tool_does_not_restore_custom_approval_queue_on_fresh_delegation` |
644
+
| Agent-tool child approval | A child `ToolApprovalMiddleware` can auto-approve runtime tool requests inside one delegated invocation; unresolved child approvals execute nothing and do not enter the caller's approval state or dispatch a same-named parent tool, including with propagated application state. Mixed batches preserve non-approval user-input requests. Shared parent and child state rejects overlapping `ToolApprovalMiddleware.source_id` values before running the child; parent approval state, including state of middleware passed to a single parent run, is neither visible nor mutable inside the child (a child cannot add standing rules or forge a decision for a pending request), and custom child approval queues do not leak into later delegations. | `packages/core/tests/core/test_agents.py::test_chat_agent_as_tool_auto_approves_child_tool_with_middleware`, `test_chat_agent_as_tool_fails_closed_for_unresolved_child_approval`, `test_chat_agent_as_tool_child_approval_does_not_dispatch_same_named_parent_tool`, `test_chat_agent_as_tool_preserves_non_approval_requests_from_mixed_child_batch`, `test_chat_agent_as_tool_shared_session_requires_distinct_tool_approval_source_ids`, `test_chat_agent_as_tool_isolates_custom_parent_approval_state`, `test_chat_agent_as_tool_isolates_run_level_parent_approval_state`, `test_chat_agent_as_tool_run_level_approval_state_cannot_authorize_pending_request`, `test_chat_agent_as_tool_run_level_approval_ownership_is_per_invocation`, `test_chat_agent_as_tool_approved_delegation_does_not_confuse_framework_approval_state`, `test_chat_agent_as_tool_does_not_restore_custom_approval_queue_on_fresh_delegation` |
644
645
| Approval-time user input | Every user-input request from one approved execution returns in order with assistant role and no extra model call; the execution consumes one call-budget unit. |`packages/core/tests/core/test_harness_tool_approval.py::test_approval_resume_returns_all_user_input_requests_without_another_model_call`, `packages/core/tests/core/test_function_invocation_logic.py::test_approval_resume_user_input_counts_toward_function_call_budget`|
645
646
| Mixed terminal result and follow-up input | Completed siblings remain tool-role while only follow-up input requests use assistant-role messages/updates. |`packages/core/tests/core/test_function_invocation_logic.py::test_approval_resume_separates_terminal_results_from_follow_up_requests`, `packages/openai/tests/openai/test_openai_chat_completion_client.py::test_mixed_approval_resume_roles_serialize_function_result_as_tool`, `packages/core/tests/core/test_harness_tool_approval.py::test_dynamic_policy_approval_partitions_safe_sibling_result_roles`|
646
647
| Approval-time middleware termination | Terminal result returns with no extra model call in either response mode. |`packages/core/tests/core/test_function_invocation_logic.py::test_approval_resume_honors_middleware_termination`|
<PackageVersionInclude="MessagePack"Version="3.1.12" /> <!-- Transitive dependency of Aspire pinned to newer version due to vulnerability in 2.5.192 -->
0 commit comments