Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ def _render_for_llm(
result,
include_markdown="markdown" in self.output_sections,
include_fields="fields" in self.output_sections,
metadata={"source": filename},
custom_metadata={"source": filename},
)

# ------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1663,13 +1663,13 @@ async def test_per_file_analyzer_overrides_provider_default(
class TestWarningsExtraction:
"""Verify that CU RAI warnings are surfaced via ``to_llm_input`` rendering.

The SDK serializes ``result.warnings`` under the reserved ``rai_warnings``
The SDK serializes ``result.warnings`` under the reserved ``warnings``
YAML front-matter key. Telemetry filtering of stray ``LLMStats:`` lines is
handled by the SDK helper (azure-ai-contentunderstanding >= 1.2.0b2).
"""

def test_warnings_included_when_present(self) -> None:
"""Non-empty warnings should appear under ``rai_warnings`` front-matter key."""
"""Non-empty warnings should appear under ``warnings`` front-matter key."""
provider = _make_provider()
fixture = {
"contents": [
Expand All @@ -1694,16 +1694,16 @@ def test_warnings_included_when_present(self) -> None:
result_obj = AnalysisResult(fixture)
rendered = provider._render_for_llm(result_obj, "doc.pdf")

assert "rai_warnings:" in rendered
assert "warnings:" in rendered
assert "ContentFiltered" in rendered
assert "Content was filtered due to Responsible AI policy." in rendered
assert "Violence content detected and filtered." in rendered

def test_warnings_omitted_when_empty(self, pdf_analysis_result: AnalysisResult) -> None:
"""The PDF fixture has no warnings, so ``rai_warnings:`` should not appear."""
"""The PDF fixture has no warnings, so ``warnings:`` should not appear."""
provider = _make_provider()
rendered = provider._render_for_llm(pdf_analysis_result, "report.pdf")
assert "rai_warnings:" not in rendered
assert "warnings:" not in rendered


class TestCategoryExtraction:
Expand Down
39 changes: 32 additions & 7 deletions python/packages/foundry_hosting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,46 @@ This package provides the integration of Agent Framework agents and workflows wi

## State store

### Local persistence

Outside the Foundry hosting environment, state is persisted as JSON files under
`~/.agentserver/state_stores` by default. Set `AGENTSERVER_STATE_ROOT` to use a
different root directory; the files will be written to its `state_stores`
subdirectory instead.

Each logical store is saved as one JSON file whose name is a URL-safe Base64
encoding of the store name. For example:

- Agent sessions: `YWdlbnRfc2Vzc2lvbnM.json`
- Function approvals: `ZnVuY3Rpb25fYXBwcm92YWxz.json`
- Workflow checkpoints: one file per context, encoded from `checkpoints/<context_id>`

> Read more about the Foundry durable state store in the [developer guide](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/agentserver/azure-ai-agentserver-core/docs/state-store-guide.md).

### User isolation

When hosted on Foundry, the default state stores automatically isolate data by the
platform user ID supplied with each request. Sessions, workflow checkpoints, and
function approvals written for one user cannot be read or modified by another user.
No additional partitioning configuration is required when using the default stores.

### Agent Sessions

`ResponsesHostServer` persists the Agent Framework `AgentSession` durably. By default it
uses the `FoundryAgentSessionStore` when hosted and an in-memory `SessionStore` locally.
When hosted, the stored sessions will be isolated by the platform user ID and scoped
under `agent_sessions`.
uses the `FoundryAgentSessionStore`, backed by Foundry storage when hosted and file-based
storage locally. Stored sessions are scoped under `agent_sessions`.

See the [custom storage provider sample](../../samples/04-hosting/foundry-hosted-agents/responses/custom_storage/)
for an example that uses an in-memory session store locally and Azure Cosmos DB when hosted.

### Workflow checkpoints

`ResponsesHostServer` persists workflow checkpoints durably. By default, it uses the
`FoundryCheckpointStore` when hosted and an in-memory `InMemoryCheckpointStorage` locally.
When hosted, the stored checkpoints will be isolated by the platform user ID and scoped
under `checkpoints`.
`FoundryCheckpointStore`, backed by Foundry storage when hosted and file-based storage
locally. Stored checkpoints are scoped under `checkpoints`.

### Function approvals

`ResponsesHostServer` persists function approvals durably. By default, it uses the
`FoundryFunctionApprovalStore` when hosted and an in-memory `InMemoryFunctionApprovalStore` locally. When hosted, the stored approvals will be isolated by the platform user ID and scoped under `function_approvals`.
`FoundryFunctionApprovalStore`, backed by Foundry storage when hosted and file-based
storage locally. Stored approvals are scoped under `function_approvals`.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from typing_extensions import Any, AsyncGenerator

from ._feature_usage import FeatureIndex
from ._request_context import validate_foundry_request_context


class InvocationsHostServer(InvocationAgentServerHost):
Expand Down Expand Up @@ -55,7 +54,6 @@ def _partition_key(self) -> str:
RuntimeError: If the context doesn't contain the expected IDs.
"""
context = get_request_context()
validate_foundry_request_context(context, is_hosted=self.config.is_hosted)

if self.config.is_hosted:
if not context.session_id or not context.user_id:
Expand Down

This file was deleted.

Loading
Loading