Skip to main content

No project description provided

Project description

Freeplay Python SDK

The official Python SDK for Freeplay
The ops platform for enterprise AI engineering teams

version License

DocsQuick StartSDK SetupAPI ReferenceChangelogContributing


Overview

Freeplay is the only platform your team needs to manage the end-to-end AI application development lifecycle. It provides an integrated workflow for improving your AI agents and other generative AI products. Engineers, data scientists, product managers, designers, and subject matter experts can all review production logs, curate datasets, experiment with changes, create and run evaluations, and deploy updates.

Use this SDK to integrate with Freeplay's core capabilities:

  • Observability
    • Sessions — group related interactions together, e.g. for multi-turn chat or complex agent interactions
    • Traces — track multi-step agent workflows within sessions
    • Completions — record LLM interactions for observability and debugging
    • Customer Feedback — append user feedback and events to traces and completions
  • Prompts — version, format, and fetch prompt templates across environments
  • Test Runs — execute evaluation runs against prompts and datasets

Requirements

  • Python 3.8 or higher
  • A Freeplay account + API key

Installation

pip install freeplay

Quick Start

import os
from freeplay import Freeplay, RecordPayload
from openai import OpenAI

fp_client = Freeplay(
    freeplay_api_key=os.environ["FREEPLAY_API_KEY"],
)
openai_client = OpenAI()

project_id = os.environ["FREEPLAY_PROJECT_ID"]

# Fetch a prompt from Freeplay
formatted_prompt = fp_client.prompts.get_formatted(
    project_id=project_id,
    template_name="my-prompt",
    environment="prod",
    variables={"user_input": "Hello, world!"},
)

# Call your LLM provider with formatted_prompt.llm_prompt
response = openai_client.chat.completions.create(
    model=formatted_prompt.prompt_info.model,
    messages=formatted_prompt.llm_prompt,
)

# Record the interaction for observability
fp_client.recordings.create(
    RecordPayload(
        project_id=project_id,
        all_messages=formatted_prompt.all_messages({
            "role": "assistant",
            "content": response.choices[0].message.content,
        }),
    )
)

See the SDK Setup guide for complete examples.

Configuration

Environment variables

export FREEPLAY_API_KEY="fp_..."
export FREEPLAY_PROJECT_ID="xy..."
# Optional: override if using a custom domain / private deployment
export FREEPLAY_API_BASE="https://app.freeplay.ai/api"

API base URL
Default: https://app.freeplay.ai/api

Custom domain/private deployment: https://<your-domain>/api

Versioning

This SDK follows Semantic Versioning (SemVer): MAJOR.MINOR.PATCH.

  • PATCH: bug fixes
  • MINOR: backward-compatible features
  • MAJOR: breaking changes

Before upgrading major versions, review the changelog.

Support

Contributing

See CONTRIBUTING.md.

License

Apache-2.0 — see LICENSE.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

freeplay-0.5.12.tar.gz (894.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

freeplay-0.5.12-py3-none-any.whl (38.6 kB view details)

Uploaded Python 3

File details

Details for the file freeplay-0.5.12.tar.gz.

File metadata

  • Download URL: freeplay-0.5.12.tar.gz
  • Upload date:
  • Size: 894.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for freeplay-0.5.12.tar.gz
Algorithm Hash digest
SHA256 626af527e12f84694d206289f81ad6aff53354718c88bcaadb4d1bb0119d93df
MD5 2919328b190ba65934b05f921f97c778
BLAKE2b-256 5ae8af4ba99d45313d8bcad4c2d9d8069d9b61b8207bbf2dab9c9af09ae3cb0b

See more details on using hashes here.

File details

Details for the file freeplay-0.5.12-py3-none-any.whl.

File metadata

  • Download URL: freeplay-0.5.12-py3-none-any.whl
  • Upload date:
  • Size: 38.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for freeplay-0.5.12-py3-none-any.whl
Algorithm Hash digest
SHA256 b6efc8a4547401688b65d6d552d258f795c342181a0a89274c136471afc6c1e6
MD5 597bab9b89e2e4fc47d37b95ddb9ba98
BLAKE2b-256 3f32d2260627f03ecab87ea2112a29ad84170873498e193b20d2d4715582a6e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page