Skip to main content

App Service Custom AI Middleware

Python middleware and tools for AI agents hosted behind Azure App Service Authentication and App Service Hooks.

Install

pip install aw-appservice-custom-ai-middleware-extension

The distribution name is aw-appservice-custom-ai-middleware-extension. The stable Python import remains:

import app_service_extensions as ase

For Azure Functions:

pip install "aw-appservice-custom-ai-middleware-extension[functions]"

For Azure Functions hosted skills:

pip install "aw-appservice-custom-ai-middleware-extension[hosted-skills]"

The hosted-skills integration patches runtime seams that are not yet public API. Its dependency range is intentionally narrow and is expanded only after the integration suite passes against a new runtime release.

Azure Functions

Configure the middleware before creating the hosted-skills app, then attach it to the generated Function app:

import app_service_extensions as ase
from azure_functions_agents import create_function_app

ase.configure()
app = create_function_app()
ase.configure(app)

Or use the convenience factory, which runs that same sequence internally:

import app_service_extensions as ase

app = ase.create_function_app()

Both initialization styles remain supported. Choose one style for an app rather than combining them.

The package preserves App Service caller identity and the opaque X-MS-Hook-Invocation recursion chain for same-site callbacks. It does not send those credentials to third-party MCP servers.

ase.current_request().request.origin exposes the proxy-aware, client-facing site origin supplied by App Service Hooks for callbacks to the originating site.

Publish to PyPI

Publishing is manual because this repository does not have an Actions runner. PyPI does not allow replacing an existing release, so first update the version in both pyproject.toml and src\app_service_extensions\__init__.py.

Save the token once from the repository root in PowerShell:

.\scripts\publish-pypi.ps1 -SaveToken

This prompts for the token, stores it outside the repository at $env:LOCALAPPDATA\AppExtensionsLibrary\pypi-token.dpapi, encrypted by Windows DPAPI for the current user and machine, and exits without publishing.

To publish, run:

.\scripts\publish-pypi.ps1

The publish command verifies that both version declarations match, installs the build tools, runs the tests, rebuilds a clean dist directory, validates the artifacts, and uploads them using the saved token.

Remove the saved token with:

.\scripts\publish-pypi.ps1 -ForgetToken

The script exposes the decrypted value only to the twine child process and restores the process environment afterward. Do not save the plaintext token in the script, commit it, or include it in an issue, pull request, or chat.

After the upload succeeds, tag the exact commit that produced the package:

$version = python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])"
git tag "v$version"
git push origin "v$version"

Metadata

Release files for aw-appservice-custom-ai-middleware-extension 0.3.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aw-appservice-custom-ai-middleware-extension 0.3.6
File Size Uploaded
aw_appservice_custom_ai_middleware_extension-0.3.6.tar.gz 70.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aw-appservice-custom-ai-middleware-extension 0.3.6
File Interpreter ABI Platform
aw_appservice_custom_ai_middleware_extension-0.3.6-py3-none-any.whl Python 3 none any Details

Total release size: 159.8 kB

Release files / aw_appservice_custom_ai_middleware_extension-0.3.6.tar.gz

Download URL aw_appservice_custom_ai_middleware_extension-0.3.6.tar.gz
Size 70.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0cbb72167d16f78878527003212788fc54e55ca83073192eead4815b0aeff604
BLAKE2b-256 checksum
How to use checksums
79fb9d92b54af64e4f3c255b367a310f60d064b40cdb02c6ee8229e223ae5172
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / aw_appservice_custom_ai_middleware_extension-0.3.6-py3-none-any.whl

Download URL aw_appservice_custom_ai_middleware_extension-0.3.6-py3-none-any.whl
Size 89.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9d222a3cfe7c72ec7ff16f06ab19856f69b8ea2f3e712c2318fefd48b1d3ca6
BLAKE2b-256 checksum
How to use checksums
7221d14969bfc9f51576d3f4cc39ed30159aa2cea1cc90a725e6da94d7ecf6ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

This release

0.3.6 This release

2 release files

0.3.5

2 release files

0.3.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page