Foundry Local SDK for Python provides a control-plane interface to Foundry Local, a unified on-device AI runtime that enables local generative AI inference. It allows developers to interact with locally run models, perform chat completions, and manage local AI resources without network latency or per-token costs. The current version is 1.0.0, and it has moved to General Availability, suggesting a stable, but potentially evolving, release cadence.
Install & Compatibility
Where this runs
tested against v0.5.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 32.4MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 12.1s · import 0.000s · 32MB
299MB installed
● package 299MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
from foundry_local_sdk import FoundryLocalManager
from foundry_local_sdk import Configuration
from foundry_local_sdk import catalog
Initializes the Foundry Local client and performs a simple chat completion using a locally available model. Before running, ensure the Foundry Local runtime is installed and running, and a model (e.g., `phi3-mini-4k-instruct`) has been downloaded via the `foundry` CLI.
from foundry import FoundryLocal
import os
# Ensure the Foundry Local runtime is installed and running.
# For example, download the 'phi3-mini-4k-instruct' model via the Foundry Local CLI:
# foundry download phi3-mini-4k-instruct
try:
client = FoundryLocal()
# You might need to explicitly download a model if not already present.
# client.download_model("phi3-mini-4k-instruct") # Uncomment and run once if needed
print("FoundryLocal client initialized. Attempting chat completion...")
response = client.chat.completions.create(
model="phi3-mini-4k-instruct", # Replace with a model you have downloaded
messages=[
{"role": "user", "content": "What is the capital of France?"}
],
max_tokens=50
)
print("Response:", response.choices[0].message.content)
except Exception as e:
print(f"An error occurred: {e}")
print("Please ensure the Foundry Local runtime is installed, running, and the specified model is downloaded.")
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.