Azure AI Foundry Integration
Provision, update, and manage Azure AI Foundry Hosted Agents from the CLI or Python SDK. Threads, runs, and streaming all handled.
A Python framework for building deployment-ready AI agents on Azure. Purpose-built for enterprise internal tooling and client-facing chat applications — with ETL helper, AI search, ToolBuilder utilities, and full Azure AI Foundry integration baked in.
Use Cases
foundry-kit is the framework you use to ship AI agents into production — not a development workflow tool. These are the production applications it targets.
Build agents that query your internal knowledge bases, process documents, call internal APIs, and surface answers inside Teams or your intranet — all governed, all auditable.
Deploy RAG-powered chat grounded in your proprietary data — policies, product docs, contracts. Answers are always cited, always accurate. Ship via Azure Functions in minutes.
Ingest PDF, DOCX, and XLSX documents into Azure AI Search with one CLI command. AI-enriched metadata, overlap-aware chunking, and idempotent re-ingestion built in.
Vector similarity search over your knowledge base using Azure AI Search HNSW indexes and Azure OpenAI embeddings. Plug SearchTool directly into any agent.
Core Capabilities
Provision, update, and manage Azure AI Foundry Hosted Agents from the CLI or Python SDK. Threads, runs, and streaming all handled.
Create HNSW vector indexes, embed documents with Azure OpenAI, and run semantic similarity queries — no raw Search SDK required.
Full ingestion pipeline: extract (PDF/DOCX/XLSX/ZIP) → chunk with overlap → AI-enrich metadata → embed → upsert to Azure AI Search.
Define function, API, and search tools with zero boilerplate. Auto-generates OpenAI function schemas from Python type hints and docstrings.
foundry-kit packages and deploys your agent as an Azure Function. No manual host.json or function.json authoring.
Local development server with Swagger UI. POST /chat/{name} to test agents before deploying to Azure.
Document ETL Helper
The ETL pipeline extracts text from PDF, DOCX, XLSX, and ZIP files, splits it into overlap-aware chunks, optionally enriches each chunk with AI-detected metadata, then embeds and upserts to your Azure AI Search index in one command.
PDF, DOCX, XLSX, ZIP
Extracts text from all common enterprise document formats
Overlap-aware chunking
ParagraphChunker with configurable chunk size and overlap
AI metadata enrichment
LLM extracts document type, dates, entities — improves retrieval
Idempotent re-ingestion
SHA-256 chunk IDs — uploading the same file twice is safe
pip install "foundry-kit[documents]"for PDF, DOCX, and XLSX support.AI Search Helper
SearchManager wraps Azure AI Search and Azure OpenAI embeddings into a clean API. Create indexes, embed documents, and run semantic similarity queries — all without touching the underlying Azure SDK.
HNSW vector indexes
Create and manage Azure AI Search indexes with one CLI command
Automatic embedding
Uses Azure OpenAI text-embedding-3-small (configurable)
SearchTool integration
Plug directly into ToolBuilder — agents get RAG in three lines
Responses API streaming
ResponsesEngine emits source citations as SSE events
Azure AI Foundry Integration
init to deploy.foundry-kit wraps the Azure AI Foundry Agents API and Threads/Runs API into a simple SDK. Agents, configuration, and deployment all live in one foundry-kit.yaml.
Hosted Agent Management
FoundryClient.create_agent(), update_agent(), delete_agent() — full CRUD from CLI or Python.
Dual Engine Support
engine: threads uses Azure AI Foundry Threads/Runs API. engine: responses uses OpenAI Responses API with tool-calling loop (up to 10 iterations) and SSE streaming.
Azure Functions Deploy
foundry-kit deploy packages your app as an Azure Functions HTTP trigger via ASGI middleware. One command, zero manual configuration.
DefaultAzureCredential
All Azure SDK clients use the credential chain — az login locally, Managed Identity or service principal in CI/CD. No secrets in source.
ToolBuilder Utilities
The ToolBuilder SDK lets you define OpenAI function-call tools from Python functions, HTTP endpoints, or Azure AI Search indexes — with zero schema boilerplate. Type hints and docstrings generate the OpenAI function schema automatically.
@tool / FunctionToolWrap any Python function. Schema auto-generated from type hints and docstrings. Supports str, int, float, bool, list[str] parameter types.
@tool
def get_policy(policy_number: str) -> str:
"""Retrieve policy by number."""
return fetch_from_db(policy_number)ApiToolBack a tool with an HTTP endpoint. URL templating for path parameters. Non-2xx responses are caught and returned as error strings to the model.
ApiTool("get_claim", "Look up a claim.",
method="GET",
url_template="https://api.internal/claims/{id}",
parameters={...})SearchToolBack a tool with an Azure AI Search index. The model calls search_kb(query) and gets cited sources back. Integrates directly with ResponsesEngine.
SearchTool("search_kb", "Search knowledge base",
index_name="policies", search=search_manager)ToolRegistry.dispatch() catches all tool errors and returns them as error strings to the model — the agent handles them gracefully. The tool-calling loop runs up to 10 iterations.
Python SDK
FoundryClient and SearchManagerThin, typed wrappers around the Azure SDKs. Chat with a Foundry agent, query a vector index, and assemble a FastAPI app — all with three imports.
Async-first
Built on asyncio — no blocking calls in your event loop
Config-driven
Endpoints and deployment names read from foundry-kit.yaml
DefaultAzureCredential
Works with az login locally, service principals in CI
Quickstart
CLI Reference
foundry-kit config init
Scaffold foundry-kit.yaml interactively
foundry-kit agent init <name>
Provision a Foundry Hosted Agent
foundry-kit agent update <name>
Update agent prompt or model
foundry-kit agent list
List all registered agents
foundry-kit agent show <name>
Show agent details and status
foundry-kit agent delete <name>
Delete agent from Foundry and config
foundry-kit index create <name>
Create an Azure AI Search HNSW index
foundry-kit index ingest <path>
Full ETL: extract, chunk, embed, upsert
foundry-kit index upsert
Embed and upload raw text to an index
foundry-kit index query
Run a vector similarity query
foundry-kit serve
Start local FastAPI dev server at :8000
foundry-kit deploy
Deploy agents to Azure Functions
REST API
foundry-kit serve starts a FastAPI dev server on port 8000 with Swagger UI at /docs. The same app deploys as an Azure Function.
/health
Health check — returns {"status": "ok"}
/agents
List all agents from foundry-kit.yaml
/agents/{name}
Get details and status for a single agent
/chat/{name}
Send a message — JSON response or SSE stream (?stream=true)
Authentication
foundry-kit uses Azure's credential chain. Run az login locally or set environment variables for CI/CD — no secrets ever touch your source.
Service Principal
CI/CD and production deployments
AZURE_CLIENT_IDAZURE_CLIENT_SECRETAZURE_TENANT_IDDeveloper Workstation
Local development — no secrets needed
az loginPrerequisites
Star the repo, open an issue, or explore the enterprise platform for multi-tenant isolation, MCP integrations, audit trails, and production SLA support.