Skip to main content
The Python SDK is frozen and not recommended for production use.profy-sdk on PyPI is still 0.1.0, which ships only OAuth and event reporting (ProfyApp) — it does not contain the unified Profy client documented on this page. Every example here targets the unreleased 1.0.0 source, so pip install profy-sdk followed by from profy import Profy raises ImportError.Until the Python SDK is published again, call the REST /v1 endpoints directly, or use the TypeScript SDK.
profy is the official Python SDK for the Profy platform, providing both async and sync clients with built-in authentication, streaming, and error handling.

Installation

The distribution is named profy-sdk; the import name is profy (from profy import Profy). Requires Python 3.9+. The SDK is built on httpx.

Quick Start

Sync Client

Client Configuration

Resource Namespaces

The SDK organizes API methods through resource namespaces:

Agents

agents.run() — Invoke an Expert

Returns an AgentRunResponse object:

agents.run_stream() — Stream an Expert Invocation

Each AgentRunChunk contains:

Chat Completions

chat.completions.create() — Chat Completion

Non-streaming:
Streaming:
ChatResponse object:

Models

models.list() — Get Model List

Events

events.report() — Report a Custom Event

/v1/events requires an OAuth Access Token (pass it as api_key when constructing the client). Calling with an sk-pro- API Key returns 401 (Custom events require OAuth token, not API key).

Error Handling

The SDK raises ProfyApiError when the API returns a 4xx/5xx status code:

Timeout Handling

agents.run() will attempt to return partial results already received on timeout (result.partial = True) rather than raising an exception directly.

Sync Client

ProfySync provides the exact same API but with synchronous methods:
ProfySync exposes the exact same resource namespaces as Profy (including events). Note: events.report() requires constructing the client with an OAuth Access Token (ProfySync(api_key=oauth_token)); calling /v1/events with an sk-pro- API Key returns 401.

Full Example: Multi-Turn Chat Bot

Next Steps

TypeScript SDK

TypeScript SDK guide

API Reference

Complete API documentation