IBM's Azure Foundry Enterprise Kit

Python SDK Starter

Build agents in Python. Production-ready modules for creating, evaluating, and managing AI agents on Azure AI Foundry — including toolbox management, PII masking, agent-to-agent delegation, and MCP authentication.

Modules

ModulePurposeEntry Point
agent_client.pyCreate and run agents from YAML manifestsAgentFactory.from_manifest()
eval_runner.pyRun evaluation suites against agentspython eval_runner.py --manifest ...
toolbox_manager.pyManage Foundry Toolbox connectionsToolboxManager
a2a_manager.pyAgent-to-Agent delegation (A2A v0.3)A2AManager
pii_masker.pyPII detection and maskingPIIMasker
mcp_auth_provider.pyMCP authentication (Entra, OAuth, API key)MCPAuthProvider
toolbox_endpoint_resolver.pyResolve tool endpoints from API CenterToolboxEndpointResolver

Setup

# Install dependencies
pip install -r requirements.txt

# Copy and configure environment
cp .env.template .env
# Edit .env with your Azure AI Foundry connection string

Required Environment Variables

AZURE_AI_PROJECT_CONNECTION_STRING="<your-foundry-project-connection-string>"
# Optional — only needed if not using DefaultAzureCredential
AZURE_TENANT_ID="<tenant-id>"
AZURE_CLIENT_ID="<client-id>"

Usage

Create and Run an Agent

from agent_client import AgentFactory

# Load agent from manifest
factory = AgentFactory.from_manifest(
    "agent-templates/knowledge-agent/agent-manifest.yaml"
)

# Create a conversation thread
thread = factory.create_thread()

# Run the agent
response = factory.run(
    thread_id=thread.id,
    user_message="What is the company PTO policy?"
)
print(response.content)

Evaluate an Agent

# Run built-in evaluators
python eval_runner.py \
  --manifest agent-templates/knowledge-agent/agent-manifest.yaml \
  --eval-pack eval-packs/builtin/builtin-evaluators.yaml \
  --output scorecard.json

# Run with custom dataset
python eval_runner.py \
  --manifest agent-templates/analyst-agent/agent-manifest.yaml \
  --dataset eval-packs/datasets/analyst-test-cases.jsonl

Agent-to-Agent Delegation

from a2a_manager import A2AManager

a2a = A2AManager(project_client=factory.client)

# Delegate a sub-task to another agent
result = await a2a.delegate(
    target_agent="analyst-agent",
    task="Summarize Q3 revenue trends",
    context={"department": "Sales"}
)

PII Masking

from pii_masker import PIIMasker

masker = PIIMasker()
safe_text = masker.mask("Call John at 555-0123 or john@acme.com")
# Output: "Call [NAME] at [PHONE] or [EMAIL]"

Module Details

agent_client.py — AgentFactory

The core module. Reads a YAML agent manifest and creates a fully configured Foundry agent with:

  • Foundry Guardrails — Content safety, PII detection, prompt attack defense
  • Toolbox SDK — MCP tools, OpenAPI tools, Azure Functions, SharePoint, Fabric
  • Memory — User-scoped long-term memory via Foundry Memory service
  • Telemetry — OpenTelemetry spans + Azure Monitor export
  • HITL — Human-in-the-loop escalation via Durable Functions

eval_runner.py — Evaluation Runner

Runs evaluation suites using the azure-ai-evaluation SDK:

  • Built-in evaluators: groundedness, coherence, relevance, fluency, safety
  • Custom evaluators: business intent, policy compliance
  • Score normalization across 0–5, 0–10, and 0–100 scales
  • JSON scorecard output for CI/CD gating

Related Resources