"""Step 14 — GATED live Foundry-profile check (trivial response on the cheapest model, D6). NOT default CI: skips cleanly without a configured Foundry endpoint + deployment. When set, a trivial agent responds on a real FoundryChatClient (cheapest model, hard-capped per D6). """ import os import pytest from agent_framework import Agent from portfolio_optimiser.backends import AzureFoundryBackend _ENDPOINT = os.environ.get("PORTFOLIO_FOUNDRY_PROJECT_ENDPOINT") _DEPLOYMENT = os.environ.get("PORTFOLIO_FOUNDRY_DEPLOYMENT") _NO_FOUNDRY = not (_ENDPOINT and _DEPLOYMENT) @pytest.mark.skipif( _NO_FOUNDRY, reason="Foundry not configured (set PORTFOLIO_FOUNDRY_PROJECT_ENDPOINT + PORTFOLIO_FOUNDRY_DEPLOYMENT)", ) async def test_foundry_profile_trivial_response() -> None: client = AzureFoundryBackend().create_chat_client(model=_DEPLOYMENT) # type: ignore[arg-type] agent = Agent(client, "Answer in exactly one word.", name="probe") result = await agent.run("Reply with the single word OK.") assert getattr(result, "text", "") # a trivial response came back