Skip to content

Commit 2befd3e

Browse files
committed
feat: improve local, deploy, and invoke. Add temp eval infra for testing
1 parent 8ddef08 commit 2befd3e

9 files changed

Lines changed: 312 additions & 4 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,3 +359,4 @@ dashboard/**/dist/
359359

360360
# Local vally eval outputs
361361
results/
362+
tmp/
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Vally eval config for Azure-authenticated Microsoft Foundry E2E checks.
2+
# The filename is e2e-eval.yaml so default discovery does not include it in full.
3+
4+
name: microsoft-foundry-e2e-eval
5+
description: |
6+
E2E evaluation for the microsoft-foundry skill in a workflow that has already
7+
logged into Azure CLI and configured azd to use Azure CLI authentication.
8+
9+
tags:
10+
type: e2e
11+
skill: microsoft-foundry
12+
13+
config:
14+
runs: 1
15+
timeout: "30m"
16+
executor: integration-test-agent-runner
17+
model: claude-sonnet-4.6
18+
19+
scoring:
20+
threshold: 0.8
21+
22+
stimuli:
23+
- name: "Create and deploy hosted agent"
24+
tags:
25+
id: create-and-deploy-hosted-agent
26+
type: e2e
27+
tier: full
28+
cost: llm
29+
area: deploy
30+
prompt: |
31+
Create a Python hosted agent for B2B customer onboarding and deploy it to my existing Foundry project. Use the Responses protocol. After it is done, run in locally to make sure it can run successfully; then deploy it to foundry and ensure it can respond to users correctly.
32+
Alaways create a new .venv in the working directory and install the agent's dependencies there, instead of installing them globally.
33+
Use an agent name with the `foundry-skill-e2e` prefix and add a random suffix.
34+
Use these environment variables as the Foundry-related configuration values:
35+
Foundry project endpoint: https://foundry-test-0603-resource.services.ai.azure.com/api/projects/foundry-test-0603
36+
Foundry Arm resource: /subscriptions/1756abc0-3554-4341-8d6a-46674962ea19/resourceGroups/anchenyi-ai/providers/Microsoft.CognitiveServices/accounts/foundry-test-0603-resource/projects/foundry-test-0603
37+
Foundry model deployment name: gpt-5.4-mini
38+
graders:
39+
- type: skill-invocation
40+
config:
41+
required:
42+
- microsoft-foundry
43+
- type: completed
44+
- type: prompt
45+
config:
46+
scoring: binary
47+
threshold: 1
48+
prompt: |
49+
Verify that the coding agent generated hosted-agent code, deployed the agent
50+
successfully to Microsoft Foundry, invoked the deployed agent after deployment,
51+
and received a successful response from that deployed agent. Fail if
52+
code was not generated, deployment did not succeed, the deployed agent was not
53+
actually invoked after deployment, or the deployed agent invocation failed.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Vally eval config for Azure-authenticated Microsoft Foundry E2E checks.
2+
# The filename is e2e-eval.yaml so default discovery does not include it in full.
3+
4+
name: microsoft-foundry-e2e-eval
5+
description: |
6+
E2E evaluation for the microsoft-foundry skill in a workflow that has already
7+
logged into Azure CLI and configured azd to use Azure CLI authentication.
8+
9+
tags:
10+
type: e2e
11+
skill: microsoft-foundry
12+
13+
config:
14+
runs: 1
15+
timeout: "30m"
16+
executor: integration-test-agent-runner
17+
model: claude-sonnet-4.6
18+
19+
scoring:
20+
threshold: 0.8
21+
22+
stimuli:
23+
- name: "Create and deploy hosted agent"
24+
tags:
25+
id: create-and-deploy-hosted-agent
26+
type: e2e
27+
tier: full
28+
cost: llm
29+
area: deploy
30+
prompt: |
31+
Create a Python hosted agent for B2B customer onboarding and deploy it to a new Foundry project. Use the Responses protocol. After it is done, run in locally to make sure it can run successfully; then deploy it to foundry and ensure it can respond to users correctly
32+
Alaways create a new .venv in the working directory and install the agent's dependencies there, instead of installing them globally.
33+
Use an agent name with the `foundry-skill-e2e` prefix and add a random suffix.
34+
graders:
35+
- type: skill-invocation
36+
config:
37+
required:
38+
- microsoft-foundry
39+
- type: completed
40+
- type: prompt
41+
config:
42+
scoring: binary
43+
threshold: 1
44+
prompt: |
45+
Verify that the coding agent generated hosted-agent code, deployed the agent
46+
successfully to Microsoft Foundry, invoked the deployed agent after deployment,
47+
and received a successful response from that deployed agent. Fail if
48+
code was not generated, deployment did not succeed, the deployed agent was not
49+
actually invoked after deployment, or the deployed agent invocation failed.

plugin/skills/microsoft-foundry/foundry-agent/create/references/local-run.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ Use this when iterating on a hosted agent before deploying.
88
> AZURE_AI_MODEL_DEPLOYMENT_NAME=<model-deployment-name>
99
> ```
1010
> If you already ran `azd provision`, extract these from `azd env get-values`.
11+
>
12+
> **Critical: keep `.env` and `azd env` in sync.** `azd ai agent run` injects the active `azd env` values into the agent process before Python loads `.env`. Many samples use `load_dotenv(override=False)`, so an existing process environment value wins over `.env`. If you change the project endpoint or model deployment, update both `.env` and `azd env`:
13+
> ```bash
14+
> azd env set FOUNDRY_PROJECT_ENDPOINT "https://<account>.services.ai.azure.com/api/projects/<project>"
15+
> azd env set AZURE_AI_MODEL_DEPLOYMENT_NAME "<model-deployment-name>"
16+
> azd env get-values
17+
> ```
18+
> A stale `AZURE_AI_MODEL_DEPLOYMENT_NAME` in `azd env` can make local run call the wrong deployment even when `.env` is correct, commonly surfacing as a Foundry responses API `404 Not Found`.
1119
1220
## Start the agent locally
1321
@@ -19,7 +27,7 @@ What this does:
1927

2028
1. Resolves the agent service from `azure.yaml` (auto-picks when only one exists).
2129
2. Detects the project type (Python, .NET, Node.js) from files in the service source dir.
22-
3. Installs dependencies if needed (`uv pip install -e .`, `npm install`, `dotnet restore`).
30+
3. Installs dependencies if needed (`pip install -r requirements.txt`, `npm install`, `dotnet restore`).
2331
4. Starts the agent in the foreground on `localhost:8088` (default).
2432
5. Opens **Agent Inspector** in your browser (unless `--no-inspector`).
2533

plugin/skills/microsoft-foundry/foundry-agent/deploy/deploy.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ azd deploy --no-prompt
164164
165165
Each env has its own `AGENT_<SVC>_*` vars.
166166
167-
## Common failure modes -- Hosted
167+
## Common failure -- Hosted
168168
169169
| Error | Fix |
170170
|-------|-----|
@@ -176,6 +176,7 @@ Each env has its own `AGENT_<SVC>_*` vars.
176176
| `container registry endpoint not found` | ACR not configured. Use `azd env set AZURE_CONTAINER_REGISTRY_ENDPOINT <url>`, or switch to direct code deployment. |
177177
| Agent version poll times out | Image still building; retry `azd ai agent show` after a minute. |
178178
| `session_not_ready` (424) | Cold start — wait 30-60 seconds and retry. For direct code deployments, first invocation installs dependencies. Use `1` CPU / `2Gi` memory minimum. **Also verify:** (1) a capability host exists on the Foundry account (see Step 2 above), (2) the agent's managed identity has `Cognitive Services User` role on the Foundry account — missing capability host or role are the most common causes of persistent `session_not_ready`. See [direct-code-deployment Task 8-9](references/direct-code-deployment.md) and [invoke](../invoke/invoke.md). |
179+
| `could not resolve agent service in azd project: no azure.ai.agent service named '<agentName>' found in azure.yaml` from `azd ai agent invoke` | Name mismatch. Update the agent name to the deployed agent name. |
179180
| `subscription quota exceeded` | Ask user to request quota; don't auto-retry. |
180181
| Bicep deploy errors | Forward `error.details[]` verbatim to the user. |
181182
| `RoleAssignmentUpdateNotPermitted` during provision | A role assignment already exists but conflicts. Check for existing role assignments with `az role assignment list --scope <resource-scope>`. The provision may have succeeded for all resources except RBAC — verify with `azd ai project show` and manually assign the `Cognitive Services User` role to the agent identity if needed. |

plugin/skills/microsoft-foundry/foundry-agent/deploy/references/direct-code-deployment.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ Do not send `x-ms-agent-name` on `POST /agents/<agent-name>/versions` or `POST /
315315

316316
Update agent and create version are idempotent on zip SHA-256 plus agent definition. If both are unchanged from the latest version, the service can return the existing version instead of creating a duplicate. To force a new version, change the zip contents or definition.
317317

318+
If the write response contains `versions.latest`, use `versions.latest.version`, `versions.latest.status`, and `versions.latest.instance_identity.principal_id`. Do not poll `/versions/None`; if no version can be extracted, list versions first and pick the newest returned version.
319+
318320
Other useful REST operations:
319321

320322
| Purpose | Method and endpoint | Notes |

plugin/skills/microsoft-foundry/foundry-agent/invoke/invoke.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ Use `session_delete` to release compute resources when done. Undeleted sessions
120120
| Hosted agent not active | Version still provisioning or failed | Check version status via `agent_get` |
121121
| Session not found | Invalid ID or expired | Create new session with `session_create` |
122122
| `424 FailedDependency` or `session_not_ready` | Hosted agent session is still warming up or readiness has not completed | Wait 15-30 seconds, check `session_logstream` if needed, then retry `agent_invoke` with the same `sessionId` if one was returned; if no `sessionId` was returned, retry `session_create`. If this persists across 3+ retries (with exponential backoff: 15s, 30s, 60s), the container likely cannot start within the readiness probe deadline — redeploy with higher CPU/memory (recommended minimum: `1` CPU / `2Gi` for direct-code deployments). Also verify the model deployment name is correct via `model_deployment_get`. |
123+
| `could not resolve agent service in azd project: no azure.ai.agent service named '<agentName>' found in azure.yaml` from `azd ai agent invoke` | Name mismatch. | Update the agent name to the deployed agent name. |
123124
| Invocation failed | Model error, timeout, or invalid input | Check agent logs, verify model deployment |
124125
| Invocations schema mismatch | Request body does not match what the agent expects | Inspect agent's route handler or API docs for the correct JSON schema; do not guess |
125126
| File operation failed | Session not active or invalid path | Verify session with `session_get` |

0 commit comments

Comments
 (0)