Registry / ai-ml / foundry-local-sdk

foundry-local-sdk

JSON →
library1.0.0pypypi✓ verified 33d ago

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.

ai-mlllm-agents
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
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 32.4MB
glibc
py 3.103.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.")
Debug
Known footguns
gotchaThe `foundry-local-sdk` Python library is a client to the Foundry Local runtime. It requires the Foundry Local application/service to be installed and running on your system for any API calls to function.
gotchaModels used with the SDK must be downloaded to your local Foundry Local instance. Attempting to use a model that hasn't been downloaded will result in a `ModelNotFoundError`.
gotchaEarly versions (pre-1.0.0, e.g., v0.8.113) had a limitation of supporting only one tool call per request. While this might be improved in newer versions, be aware of potential limitations with complex tool-calling scenarios.
gotchaSome users experienced issues with tool calling on NVIDIA GPUs with older Foundry Local runtime versions (e.g., v0.8.117). This indicates potential hardware-specific runtime bugs.
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.

Agent activity
27 hits · last 30 days
gptbot
4
ahrefsbot
4
bytedance
4
script
1
Resources