Skip to main content
@profy-ai/sdk is the official TypeScript SDK for the Profy platform. It uses the native fetch API and supports both Node.js and browser environments.

Installation

Requires Node.js 18+ (native fetch support needed).

Quick Start

Client Configuration

Resource Namespaces

Agents

agents.run() — Invoke an Expert

AgentRunResult type definition:

agents.runStream() — Stream an Expert Invocation

AgentRunChunk type definition:

Chat Completions

chat.completions.create() — Chat Completion

Non-streaming (returns ChatResponse):
Streaming (returns AsyncGenerator<ChatChunk>):
The SDK uses TypeScript function overloads for type safety:

Models

models.list() — Get Model List

Datasets and experiments

The eval client is @profy-ai/agent-sdk. The key owner must be that expert’s creator. The verifier on each example writes the score. This client has no method that submits one. HTTP fields are on Offline eval.
create turns examples into one dataset.json and uploads it. Pass files instead of examples when the package is already built. Omitting suite uses seed. evaluate runs every example on the platform, then polls until the experiment leaves running. Use experiments.run to start without waiting. Use experiments.create when you run each turn yourself, and pass profyEval to agents.run:
That is sent as metadata.profy_eval. After the turn, call experiments.closeRun(expert, experimentId, { task, trial }). Other reads:

Error Handling

The SDK throws ProfyApiError when the API returns a non-2xx status code:

Timeout Handling

agents.run() will attempt to return partial results already received on timeout (result.partial = true).

Browser Environment

The SDK uses native fetch and works in the browser:
Do not use API Keys in browser frontend code. Use OAuth Tokens on the browser side. API Keys should only be used in Node.js server-side code.

Full Example: Express API Proxy

Full Example: Multi-Turn Conversation

Next Steps

Python SDK

Python SDK guide

API Reference

Complete API documentation