Skip to main content

Python SDK for AOps — prompt version management

Project description

aops

PyPI Python

Python SDK for AOps — prompt version management platform.

Provides a framework-agnostic raw pull() that works with any LLM SDK, as well as a LangChain integration.

Installation

pip install aops

LangChain 통합이 필요한 경우:

pip install "aops[langchain]"

Quick Start

OpenAI SDK

import aops
from aops import pull
from openai import OpenAI

aops.init(api_key="aops_...", agent="my-agent")

system_prompt = pull("my-chain")  # agent resolved from init()

client = OpenAI()
response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "system", "content": system_prompt},
        {"role": "user", "content": "Hello!"},
    ],
)
print(response.choices[0].message.content)

Anthropic SDK

import aops
from aops import pull
from anthropic import Anthropic

aops.init(api_key="aops_...", agent="my-agent")

system_prompt = pull("my-chain")  # agent resolved from init()

client = Anthropic()
message = client.messages.create(
    model="claude-haiku-4-5-20251001",
    max_tokens=1024,
    system=system_prompt,
    messages=[{"role": "user", "content": "Hello!"}],
)
print(message.content[0].text)

LangChain

import aops
from aops.langchain import pull
from langchain_core.prompts import ChatPromptTemplate, HumanMessagePromptTemplate
from langchain_core.output_parsers import StrOutputParser
from langchain_openai import ChatOpenAI

aops.init(api_key="aops_...", agent="my-agent")

prompt = pull("my-chain")  # agent resolved from init()

chain = (
    ChatPromptTemplate.from_messages([
        prompt,
        HumanMessagePromptTemplate.from_template("{user_input}"),
    ])
    | ChatOpenAI(model="gpt-4o-mini")
    | StrOutputParser()
)

result = chain.invoke({"user_input": "Hello!"})

Requirements

  • Python 3.12+
  • AOps backend running (self-hosted)
  • API key issued from the AOps UI: Agent detail page → API Keys → New API Key

Examples

examples/
  openai_example.py     raw pull() + OpenAI SDK
  anthropic_example.py  raw pull() + Anthropic SDK
  langchain_example.py  aops.langchain — pull(), @chain_prompt
  live_updates.py       백그라운드 polling / 라이브 업데이트 감지

Docs

License

MIT

Project details


Download files

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

Source Distribution

aops-0.4.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

aops-0.4.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file aops-0.4.0.tar.gz.

File metadata

  • Download URL: aops-0.4.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aops-0.4.0.tar.gz
Algorithm Hash digest
SHA256 706f8cd36373849ad83ce27acadb2222f02dc5f60a697f2edf82255b9f088430
MD5 3c1681367cd12d8c95ecf8f2e7f6b8cd
BLAKE2b-256 32a430db757afaa23032c64f44ae1eb8cca71bc02f1428eacd22da3f5dec14c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for aops-0.4.0.tar.gz:

Publisher: release.yml on cow-coding/aops-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aops-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: aops-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aops-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a32cd705ba3e80a4243ba566ce99713d462e2046261dfe528a404565a094477
MD5 acec7dc740183dd671cbfee054bc6ff8
BLAKE2b-256 4b524b9192d86a4136dc6b5d800255a04d01e23802a01aa0877241eab23561c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for aops-0.4.0-py3-none-any.whl:

Publisher: release.yml on cow-coding/aops-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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