Skill 180 · Foundry Agentic Loop
Subchapter 180.11
references/hosted-integration-checkpoint.mdMarkdown13 KBView on GitHub
Read for architecture, the first hosted deployment, and changed identity/endpoint integrations. Prove the hosted boundary before expanding orchestration or implementing the full application. This is an acceptance gate, not a replacement for microsoft-foundry platform workflows.
Record these distinct values in the root README.md (rapid) or docs/implementation.md (SDD) and persist discovered values in the applicable deployment configuration and Git-ignored .env. Record their source, authentication audience, consuming component and version. Unknown values remain pending until discovery; do not synthesize endpoints from display names.
| Application variable | Meaning and validation |
|---|---|
APP_FOUNDRY_PROJECT_ENDPOINT | Full project URL including /api/projects/<project>, returned by project discovery. Used by project clients. |
MODEL_API_BASE_URL | Actual model-hosting account’s OpenAI-compatible base ending in /openai/v1/. Used by the model provider; it is not the project or hosted-agent URL. Record model deployment name separately. |
HOSTED_RESPONSES_ENDPOINT | Deployed agent’s actual Responses request URL, including required API version and agent routing. Record the agent version used by the probe; distinguish this complete request URL from an SDK base URL that appends /responses. |
TOOLBOX_ENDPOINT | Toolbox MCP URL, including api-version=v1, mapped from the azd-written TOOLBOX_<NAME>_MCP_ENDPOINT. Record the toolbox name, its published default version and whether the URL is the consumer form (follows the default) or pins /versions/<v>/. |
Keep FOUNDRY_PROJECT as the project ARM ID, not an endpoint. Keep platform-owned FOUNDRY_* variables untouched. A reported build had its custom FOUNDRY_PROJECT_ENDPOINT overwritten with an account-only URL; use APP_FOUNDRY_PROJECT_ENDPOINT for the application’s verified full URL, explicitly pass it to project clients, and validate its path at startup. Do not silently append guessed project names or fall back to the reserved value. Verify how current adapters consume platform configuration through microsoft-foundry.
N/A with its reason; mocks or skipped checks cannot pass a required boundary.active only enables the probe; it does not pass it.azd ai agent show <agent> --output json: instance_identity takes Azure roles; the blueprint takes none, and its client ID only joins MCP Easy Auth allow-lists). A new principal cannot be checked before creation. Distinguish object ID from client/application ID and the agent resource ID. Record tenant, agent/version, principal, resource scope and required operation/role.microsoft-foundry.| Principal | Resource scope | Role to verify when this path requires it |
|---|---|---|
| Runtime instance identity | Foundry project | Foundry User for explicit project/toolbox access, including runtime skill download (without it the hosted invoke returns 500); account for platform-provided access and current role definitions. |
| Runtime instance identity | Account actually hosting the model | Cognitive Services OpenAI User for direct account-level OpenAI inference. Project access alone does not establish this. |
| Identity directly emitting authenticated Application Insights telemetry | Application Insights component | Monitoring Metrics Publisher. Verify the runtime instance identity when the agent is the emitter; do not substitute the deployer’s grant. |
| Collector identity for native Azure Monitor OTLP ingestion, when used | Destination Data Collection Rule (DCR) | Monitoring Metrics Publisher. Verify the collector’s actual principal, which can differ from the agent; do not add this route or grant when unused. |
Keep the deployer, project managed identity, agent identity, runtime caller and toolbox connection identity separate. Agent-to-toolbox access and connection-to-downstream MCP/service access are different checks. Confirm the configured connection auth mode and its principal/resource permissions; an agent grant cannot repair the wrong downstream identity.
Invoke the deployed endpoint with an authorized caller, but ensure downstream model/toolbox operations use the hosted workload credential and platform caller context. A developer token can authorize the external probe; it must not replace the agent’s internal credential. No copied az login tokens or secret-key fallback to make the checkpoint pass.
AgenticIdentityToken tool calls fail outside the host (“requires AgentInstanceClientId and AgentBlueprintClientId”).<server>___<tool> in Responses output: parse the server prefix and require the exact tool name. Check the toolbox version the agent uses: read back the published default version (azd ai toolbox show <name>) or, for a pinned URL, the version in its path, and require the expected tools and skills there.response.completed; EOF, [DONE], text deltas, session.idle or a stopped spinner alone are insufficient. For nonstreaming JSON, require a final response object with status: "completed"; queued/in-progress responses require bounded polling. Also prove the streaming terminal event when streaming is supported.response.failed, response.incomplete, cancellation, timeout, protocol errors and embedded error payloads as failures, even with HTTP 200 or CLI exit code zero. A CLI wrapper must parse the response and return failure for unsuccessful terminal status.| Failure | Next bounded action |
|---|---|
| Import, startup or dependency resolution | Capture exact Python, SDK, hosting adapter and running Copilot runtime versions. Check installed signatures and package/runtime compatibility. For remote-resolution failures use the conditional packaging fallback, not a framework rewrite. |
| 401 | Compare endpoint/base path, expected token audience, refresh callback and forwarded platform context for direct versus SDK requests under the same deployed identity. Log no tokens or caller-context header values. |
| 403 | Check actual principal/resource/role combinations and toolbox downstream identity separately. After a confirmed role change, retry the minimal probe with backoff and a fixed deadline (for example five attempts within five minutes). Refresh credentials through the supported provider; do not repeatedly redeploy identical code. |
| Developer probe passes, hosted probe fails | Compare the actual identities, network access, full project URL, model account and platform caller context. Developer success is not hosted proof. Do not disable network isolation to bypass a failure. |
| Direct hosted request passes, SDK fails | Compare sanitized method, route, deployment name, API version, audience, header names, content type and payload schema. Check adapter/SDK/runtime signatures before changing RBAC. |
| HTTP success but failed/missing output | Inspect response ID, final status, structured error and matching service request IDs. Parse JSON/SSE correctly; never reinterpret transport success as agent success. |
| Intermittent failures under load | Check request-local context, response-ID matching, session isolation, token refresh, cancellation and atomic tool-budget reservation before async work. |
| Missing or host-only telemetry | Check host and runtime producer configuration separately, active trace context, receiver/export route, destination/schema, actual exporter identity permissions, sampling and lifecycle flush. Allow bounded ingestion delay; do not pass the gate or repeatedly redeploy unchanged code. |
Transient postdeploy failure after a successful deploy | Rerun only the idempotent hook (azd hooks run postdeploy) and its read-back checks; do not redeploy unchanged code. |
Log safe structured diagnostics: application correlation ID, response ID, hosted and SDK session IDs, agent name/version, available service request IDs, SDK/runtime versions, status/error code and sanitized error summary. Capture response headers such as x-agent-session-id on failures too. Exclude Authorization, cookies, tokens, opaque caller-context values, .env dumps and sensitive bodies.
Retry only transient failures within a declared attempt/deadline budget; do not blindly replay non-idempotent tool calls. Redeploy only for changed code, dependencies or deployment configuration. Track debug processes and hosted/SDK sessions created by this task; stop only those temporary resources afterward. Preserve the user’s sessions and the local app servers required by the acceptance handoff.
Add targeted tests before expanding each boundary, then run the applicable full-app cases at local acceptance:
message output item: the top-level output_text can be null when tool items precede it. Omit previous_response_id on a first turn; null returns HTTP 400.Resolve commands and changing platform contracts through the installed microsoft-foundry skill. References checked on 2026-09-22: