Skip to main content
Version: v1.0

Setup and Installation

This guide shows you how to set up the Agenta SDK for managing prompts programmatically.

Prerequisites​

Before starting, familiarize yourself with how versioning works in Agenta. Details are available on the concepts page.

Versioning in Agenta

Agenta uses a Git-like structure for prompt versioning:

  • Create multiple branches called variants
  • Each variant is versioned.
  • Deploy specific versions to environments (development, staging, production)

Typical workflow:

  1. Create a variant (branch)
  2. Commit changes to the variant creating a new version
  3. Deploy the version to an environment

Setup the SDK​

Initialize the SDK before using any operations:

import os
import agenta as ag

# Set your API credentials
os.environ["AGENTA_API_KEY"] = "your-api-key-here"
os.environ["AGENTA_HOST"] = "https://cloud.agenta.ai" # only needed if self-hosting

# Initialize the SDK
ag.init()
info

You can skip this step if you are using the API directly.