Prompty Python SDK
Python client for interacting with the Prompty API to fetch real-time prompts for AI agents.
Installation
pip install prompty-sdk
Or install from source:
cd python-sdk
pip install -e .
Usage
from prompty import PromptyClient
# Initialize the client
client = PromptyClient(
base_url='https://your-prompty-instance.com',
project_id='your-project-id',
api_key='pk_your_api_key_here'
)
# Get the active prompt for an agent
prompt = client.get_prompt('customer-support-agent')
print(prompt)
# Output: "You are a helpful customer support assistant..."
# Get detailed information about the prompt
details = client.get_prompt_details('customer-support-agent')
print(details['prompt_text'])
print(details['prompt_id'])
print(details['updated_at'])
API Reference
PromptyClient
Initialize a Prompty client.
Parameters:
base_url(str): The base URL of your Prompty instanceproject_id(str): Your project IDapi_key(str): Your API key
get_prompt(agent_name)
Get the active prompt text for an agent.
Parameters:
agent_name(str): The name of the agent
Returns:
str: The prompt text
Raises:
ValueError: If the API key is invalid or agent not foundRuntimeError: If there's a server error
get_prompt_details(agent_name)
Get detailed information about the active prompt.
Parameters:
agent_name(str): The name of the agent
Returns:
dict: Dictionary containing:prompt_text(str): The prompt textprompt_id(str): The prompt IDupdated_at(str): When the prompt was created/updatedagent_name(str): The agent name
Raises:
ValueError: If the API key is invalid or agent not foundRuntimeError: If there's a server error
Example: Using with OpenAI
from prompty import PromptyClient
import openai
# Initialize Prompty client
prompty = PromptyClient(
base_url='https://your-prompty-instance.com',
project_id='your-project-id',
api_key='pk_your_api_key_here'
)
# Get the prompt from Prompty
system_prompt = prompty.get_prompt('customer-support-agent')
# Use it with OpenAI
response = openai.ChatCompletion.create(
model="gpt-4",
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": "How do I reset my password?"}
]
)
print(response.choices[0].message.content)
Error Handling
The SDK raises the following exceptions:
ValueError: When the API key is invalid or the requested agent/prompt is not foundRuntimeError: When there's a server error or network issue
try:
prompt = client.get_prompt('my-agent')
except ValueError as e:
print(f"Invalid request: {e}")
except RuntimeError as e:
print(f"Server error: {e}")
License
MIT
Metadata
Release files for kaenova-prompty 20251102.15.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kaenova_prompty-20251102.15.9.tar.gz | 3.4 kB | Without provenance | Details for kaenova_prompty-20251102.15.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kaenova_prompty-20251102.15.9-py3-none-any.whl | Python 3 | none | any | Details for kaenova_prompty-20251102.15.9-py3-none-any.whl |
Total release size: 7.3 kB
Release files / kaenova_prompty-20251102.15.9.tar.gz
| Download URL | kaenova_prompty-20251102.15.9.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
46ab3cfa780bd191857de3410f978b0a237b26d59fc39c6a16a226c80fa47744
|
|
BLAKE2b-256 checksum How to use checksums |
2b8bb780296d6faaa6e429ce0ed1f56874645b97aac1e2341281a5dfe93a4591
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / kaenova_prompty-20251102.15.9-py3-none-any.whl
| Download URL | kaenova_prompty-20251102.15.9-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8c8b35b238101fa6b24fa749cb382f3ed853fd62c6ab6320477551929d110f0
|
|
BLAKE2b-256 checksum How to use checksums |
7f99fb554bd5155804a2250b0876a9842dba4401d19cf5817cfcfa114c8e9ec2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for kaenova-prompty 20251102.15.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.