Skip to main content
The Permitech SDKs provide a comprehensive set of tools for logging, evaluating, and experimenting with LLM applications. Regardless of how you go about logging your AI application, you will still need to install the Permitech SDK and initialize your API keys by following the steps below.

Python SDK

The Permitech Python SDK on PyPI.

TypeScript SDK

The Permitech TypeScript SDK on npm.

Installation

If you want to use the OpenAI wrapper in Python, you need to install with the optional OpenAI dependencies.

Initialization and authentication

You need a Permitech API key set as an environment variable called PERMITECH_API_KEY. The Permitech SDK will automatically pick this up from the environment variable at run time. You can also optionally set the following environment variables to define the project, Log stream, and console URL that Permitech should use.
If you are using the free version of Permitech, permi.tech, there is no need to set the PERMITECH_CONSOLE_URL environment variable.
When developing your application, you should use a .env file. Create or update a .env file with the following values as required:
You can then load the environment variables from this file:
For Python, you will need to install python-dotenv if you haven’t already.

Logging

The Permitech SDKs allow you to log all prompts, responses, and statistics around your LLM usage. There are three main ways to log your application:
  1. Use a third-party integration - use wrappers that integrate with common SDKs to automatically log LLM calls or agentic workflows.
  2. Use a decorator - by decorating a function that calls an LLM with the @log decorator or log wrapper, the Permitech SDK logs all AI prompts within.
  3. Directly using the PermitechLogger class - For more control over your logging, you can use the PermitechLogger directly. This allows you to manually create sessions, start traces, and log spans. This can be mixed with the other methods, for example accessing the logger directly inside a decorated function call to manually add spans.

Log experiments

Experiments are logged automatically when they are run, but you can use these same SDK concepts inside the code being run by your experiment for greater control and additional logging. This allows you to not only create distinct experiments, such as in notebooks, but to also add experiments to your production application code. See our run experiments with code documentation for more details.

Next steps

Logging with the SDKs

Learn how to log experiments

Learn how to run experiments with multiple data points using datasets and prompt templates

Permitech logger

Log with full control over sessions, traces, and spans using the Permitech logger.

Log decorator

Quickly add logging to your code with the log decorator and wrapper.

Permitech context

Manage logging using the Permitech context manager.

How-to guides

Log Using the OpenAI Wrapper

Learn how to integrate and use OpenAI’s API with Permitech’s wrapper client.
Python

Log Using the @log Decorator

Learn how to use the Permitech @log decorator to log functions to traces
Python

Create Traces and Spans

Learn how to create log traces and spans manually in your AI apps
Python

SDK reference

Python SDK Reference

The Permitech Python SDK reference.

TypeScript SDK Reference

The Permitech TypeScript SDK reference.