Skip to main content

Papaya AI agent trace capture SDK for Python apps.

Project description

Papaya AI Python SDK

Python tracing SDK for production AI agents. This package mirrors the native Papaya trace envelope used by @papaya-ai/tracing and adds a LangChain/LangGraph callback handler for framework-level trace trees.

Quick Start

LangChain / LangGraph

import os

from papaya_ai import Papaya
from papaya_ai.integrations.langchain import PapayaCallbackHandler

papaya = Papaya.init(api_key=os.environ["PAPAYA_API_KEY"])
callback = PapayaCallbackHandler(papaya, workflow_key="support_agent")

result = agent.invoke(
    {"messages": [{"role": "user", "content": "Help this customer"}]},
    config={"callbacks": [callback]},
)

papaya.flush()

The LangChain dependency is optional:

pip install "papaya-ai[langchain]"

Provider SDK Wrappers

Use provider wrappers when your app calls SDK clients directly instead of going through LangChain callbacks.

import os

from papaya_ai import Papaya

papaya = Papaya.init(api_key=os.environ["PAPAYA_API_KEY"])
openai = papaya.openai(OpenAI())

try:
    with papaya.run({"workflowKey": "support_agent", "sessionId": session_id}):
        result = openai.chat.completions.create(
            model="gpt-4.1-mini",
            messages=[{"role": "user", "content": user_message}],
        )
finally:
    papaya.flush()

The same wrapper shape is available as papaya.openai(...), papaya.anthropic(...), papaya.claude(...), papaya.gemini(...), and papaya.bedrock(...).

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

papaya_ai-0.1.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

papaya_ai-0.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file papaya_ai-0.1.0.tar.gz.

File metadata

  • Download URL: papaya_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for papaya_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f5c0295401a76bf15f6230959eb6b185faba837eeae4e3f2ce1f4766271896bd
MD5 11844b32699ee2da53a28bb5d7c1a090
BLAKE2b-256 567f3c9c3d1732b5c12647c7d0f7139fcdc8af16a14256df3f9c6251a5517556

See more details on using hashes here.

Provenance

The following attestation bundles were made for papaya_ai-0.1.0.tar.gz:

Publisher: npm-publish.yml on Nile-AI-Inc/papaya-ai

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

File details

Details for the file papaya_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: papaya_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for papaya_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7008bd5241d1e2032ac41eec2efde77488537524c5f91fe509d77755ba03c405
MD5 fa6bac9fe2f7dab82a78571844915340
BLAKE2b-256 a237f59dbe994b27376dd476fdad384d027ad9c863ae0f5e9b3115b0aa40bda3

See more details on using hashes here.

Provenance

The following attestation bundles were made for papaya_ai-0.1.0-py3-none-any.whl:

Publisher: npm-publish.yml on Nile-AI-Inc/papaya-ai

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