Files
wehub-resource-sync 0d3cb498a3
Deploy local.promptfoo.app / Deploy to Cloudflare Pages (push) Waiting to run
Test and Publish Multi-arch Docker Image / test (push) Waiting to run
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-amd64 platform:linux/amd64 runner:ubuntu-latest]) (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-arm64 platform:linux/arm64 runner:ubuntu-24.04-arm]) (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / merge-docker-digests (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / Attest Multi-arch Image (push) Blocked by required conditions
Validate Renovate Config / Validate Renovate Configuration (push) Waiting to run
CI / Shell Format Check (push) Has been cancelled
CI / Check Ruby (3.4) (push) Has been cancelled
CI / CI Config (push) Has been cancelled
CI / Test on Node ${{ matrix.node }} and ${{ matrix.os }}${{ matrix.shard && format(' (shard {0}/3)', matrix.shard) || '' }} (push) Has been cancelled
CI / Build on Node ${{ matrix.node }} (push) Has been cancelled
CI / Style Check (push) Has been cancelled
CI / Generate Assets (push) Has been cancelled
CI / Check Python (3.14) (push) Has been cancelled
CI / Check Python (3.9) (push) Has been cancelled
CI / Build Docs (push) Has been cancelled
CI / Code Scan Action (push) Has been cancelled
CI / Site tests (push) Has been cancelled
CI / webui tests (push) Has been cancelled
CI / Run Integration Tests (push) Has been cancelled
CI / Run Smoke Tests (push) Has been cancelled
CI / Go Tests (push) Has been cancelled
CI / Share Test (push) Has been cancelled
CI / Redteam (Production API) (push) Has been cancelled
CI / Redteam (Staging API) (push) Has been cancelled
CI / GitHub Actions Lint (push) Has been cancelled
CI / Check Ruby (3.0) (push) Has been cancelled
release-please / release-please (push) Has been cancelled
release-please / build (push) Has been cancelled
release-please / publish-npm (push) Has been cancelled
release-please / publish-npm-backfill (push) Has been cancelled
release-please / docker (push) Has been cancelled
release-please / publish-code-scan-action (push) Has been cancelled
release-please / attest-code-scan-action (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:24:08 +08:00
..

azure/foundry-agent (Azure AI Foundry Agent)

This example demonstrates how to use the Azure Foundry Agent provider with promptfoo. This provider uses the @azure/ai-projects SDK and the v2 Responses agent runtime instead of the old threads/runs API.

You can run this example with:

npx promptfoo@latest init --example azure/foundry-agent
cd azure/foundry-agent

Setup

  1. Install the required Azure SDK packages:
npm install @azure/ai-projects @azure/identity
  1. Set up your Azure credentials. The provider uses DefaultAzureCredential, so you can authenticate via:

    • Azure CLI: az login
    • Environment variables
    • Managed Identity
    • Service Principal
  2. Set your Azure AI Project URL:

export AZURE_AI_PROJECT_URL="https://your-project.services.ai.azure.com/api/projects/your-project-id"

Configuration

The provider uses the azure:foundry-agent:agent-name-or-id format. Agent names are preferred. Legacy agent IDs still work as a fallback lookup if the agent exists in the project.

providers:
  - id: azure:foundry-agent:my-foundry-agent
    config:
      projectUrl: 'https://your-project.services.ai.azure.com/api/projects/your-project-id'
      temperature: 0.7
      max_tokens: 150

tests:
  - vars:
      question: 'What is the capital of France?'
    assert:
      - type: contains
        value: 'Paris'

Configuration Options

These per-request settings are supported:

  • instructions
  • temperature
  • top_p
  • max_tokens / max_completion_tokens (mapped to max_output_tokens)
  • response_format
  • tools
  • tool_choice
  • functionToolCallbacks
  • modelName
  • reasoning_effort
  • verbosity
  • metadata
  • passthrough
  • maxPollTimeMs

These request-time settings are ignored by the v2 runtime and should be configured on the Foundry agent instead:

  • tool_resources
  • frequency_penalty
  • presence_penalty
  • seed
  • stop
  • timeoutMs
  • retryOptions

Function Tool Callbacks

You can provide custom function callbacks just like with the regular Azure Assistant provider:

providers:
  - id: azure:foundry-agent:my-foundry-agent
    config:
      projectUrl: 'https://your-project.services.ai.azure.com/api/projects/your-project-id'
      functionToolCallbacks:
        getCurrentWeather: |
          (args) => {
            const { location } = JSON.parse(args);
            return `The weather in ${location} is sunny and 75°F`;
          }

Differences from Regular Azure Assistant Provider

The main differences are:

  1. SDK Usage: Uses @azure/ai-projects SDK instead of direct HTTP calls
  2. Authentication: Uses DefaultAzureCredential for Azure authentication
  3. Project URL: Requires an Azure AI Project URL instead of Azure OpenAI endpoint
  4. Provider Format: Uses azure:foundry-agent:agent-name-or-id instead of azure:assistant:assistant-id
  5. Runtime: Uses responses.create(..., agent_reference) instead of threads/messages/runs

Environment Variables

  • AZURE_AI_PROJECT_URL: Your Azure AI Project URL (can be overridden in config)
  • Standard Azure credential environment variables (if not using other auth methods)

Error Handling

The provider includes the same comprehensive error handling as the regular Azure Assistant provider:

  • Content filter detection and guardrails reporting
  • Rate limit handling
  • Service error detection
  • Automatic retries for transient errors