
Python Sdk
Python SDK is an agent skill for the Build phase that teaches integration with the inference.sh inferencesh Python client for apps, streaming, and agents.
npx skills add https://github.com/inference-sh/skills --skill python-sdk| Installs | 535 |
|---|---|
| GitHub stars | ★ 512 |
| Security audit | 1 / 3 scanners passed |
| Last updated | May 20, 2026 |
| Repository | inference-sh/skills ↗ |
What it does
You want programmatic access to inference.sh apps from Python without guessing auth, run payloads, and async setup.
Who is it for?
Indie builders adding inference.sh-backed AI features to Python backends, scripts, or agent runners.
Skip if: Projects that only need one-off curl calls with no ongoing Python codebase or no inference.sh account.
When should I use this skill?
Python integration, inference.sh, pip install inferencesh, async inference, Python agent, tool builder, or programmatic AI on inference.sh.
What you get
You can install inferencesh, authenticate with an API key, and run hosted AI apps or agent patterns from Python with documented sync/async options.
- Working Python client initialization
- Example client.run invocation for a hosted app
- Notes for async/streaming and agent patterns
Related skills
How it compares
Integration skill for the official Python client, not a marketplace browser or non-Python SDK.
FAQ
Who is python-sdk for?
Python developers wiring inference.sh into apps, automations, or custom agents with the inferencesh package.
When should I use python-sdk?
During Build integrations while implementing client.run flows, async workers, streaming UX, or tool-builder agents against inference.sh.
Is python-sdk safe to install?
Review the Security Audits panel on this Prism page; treat API keys as secrets and scope them per environment.
SKILL.md
> **Install the belt CLI skill:** `npx skills add belt-sh/cli` # Python SDK Build AI applications with the [inference.sh](https://inference.sh) Python SDK.  ## Quick Start ```bash pip install inferencesh ``` ```python from inferencesh import inference client = inference(api_key="inf_your_key") # Run an AI app result = client.run({ "app": "infsh/flux-1-dev", "input": {"prompt": "A sunset over mountains"} }) print(result["output"]) ``` ## Installation ```bash # Standard installation pip install inferencesh # With async support pip install inferencesh[async] ``` **Requirements:** Python 3.8+ ## Authentication ```python import os from inferencesh import inference # Direct API key client = inference(api_key="inf_your_key") # From environment variable (recommended) client = inference(api_key=os.environ["INFERENCE_API_KEY"]) ``` Get your API key: Settings → API Keys → Create API Key ## Running Apps ### Basic Execution ```python result = client.run({ "app": "infsh/flux-1-dev", "input": {"prompt": "A cat astronaut"} }) print(result["status"]) # "completed" print(result["output"]) # Output data ``` ### Fire and Forget ```python task = client.run({ "app": "google/veo-3-1-fast", "input": {"prompt": "Drone flying over mountains"} }, wait=False) print(f"Task ID: {task['id']}") # Check later with client.get_task(task['id']) ``` ### Streaming Progress ```python for update in client.run({ "app": "google/veo-3-1-fast", "input": {"prompt": "Ocean waves at sunset"} }, stream=True): print(f"Status: {update['status']}") if update.get("logs"): print(update["logs"][-1]) ``` ### Run Parameters | Parameter | Type | Description | |-----------|------|-------------| | `app` | string | App ID (namespace/name@version) | | `input` | dict | Input matching app schema | | `setup` | dict | Hidden setup configuration | | `infra` | string | 'cloud' or 'private' | | `session` | string | Session ID for stateful execution | | `session_timeout` | int | Idle timeout (1-3600 seconds) | ## File Handling ### Automatic Upload ```python result = client.run({ "app": "image-processor", "input": { "image": "/path/to/image.png" # Auto-uploaded } }) ``` ### Manual Upload ```python from inferencesh import UploadFileOptions # Basic upload file = client.upload_file("/path/to/image.png") # With options file = client.upload_file( "/path/to/image.png", UploadFileOptions( filename="custom_name.png", content_type="image/png", public=True ) ) result = client.run({ "app": "image-processor", "input": {"image": file["uri"]} }) ``` ## Sessions (Stateful Execution) Keep workers warm across multiple calls: ```python # Start new session result = client.run({ "app": "my-app", "input": {"action": "init"}, "session": "new", "session_timeout": 300 # 5 minutes }) session_id = result["session_id"] # Continue in same session result = client.run({ "app": "my-app", "input": {"action": "process"}, "session": session_id }) ``` ## Agent SDK ### Template Agents Use pre-built agents from your workspace: ```python agent = client.agent("my-team/support-agent@latest") # Send message response