promptly
A lightweight, developer-friendly library for LLM prompt management, observability/tracing, and optimization. Currently with support for Python.
Features
- Prompt Templates: Jinja2-based templating system for dynamic prompts
- Multi-Provider Support: OpenAI, Anthropic, Google AI (Gemini), and extensible client architecture
- Built-in Tracing: Comprehensive observability for prompt execution
- Genetic Optimization: LLM-powered genetic algorithms for automated prompt improvement
- Async Support: Full async/await support for high-performance applications
- CLI Interface: Command-line tools for prompt management
- Type Safety: Full type hints and Pydantic models
Installation
# Install UV if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install promptly
uv pip install promptly
# With development dependencies
uv pip install promptly[dev]
# With CLI tools
uv pip install promptly[cli]
# With UI components
uv pip install promptly[ui]
Quick Start
import asyncio
from promptly import PromptRunner, OpenAIClient, PromptTemplate
async def main():
# Initialize client
client = OpenAIClient(api_key="your-api-key")
# Create a prompt template
template = PromptTemplate(
name="greeting",
template="Hello {{ name }}, how are you today?",
variables=["name"]
)
# Create runner with tracing
runner = PromptRunner(client)
# Execute prompt
response = await runner.run(
template=template,
variables={"name": "Alice"},
model="gpt-3.5-turbo"
)
print(response.content)
asyncio.run(main())
Prompt Optimization
Promptly includes an advanced genetic algorithm optimizer that uses LLMs to automatically improve your prompts through iterative evaluation and mutation. The optimizer can work with test cases for accuracy-based optimization or without test cases for general quality improvement.
Quick Example:
# Optimize with test cases
promptly optimize \
--base-prompt "Answer this question: {{question}}" \
--test-cases my_tests.json \
--population-size 10 \
--generations 5
# Quality-based optimization (no test cases needed)
promptly optimize \
--base-prompt "Write a {{genre}} story about {{character}}" \
--population-size 8 \
--generations 4
For complete documentation on optimization features, configuration options, and examples, see OPTIMIZER_README.md.
CLI Usage
# Run a simple prompt
promptly run "What is the capital of France?" --model="gpt-3.5-turbo"
# Run with tracing
promptly run "Explain quantum computing" --trace
# View traces
promptly trace
Development
For developers who want to contribute to or extend promptly:
- Developer Quick Start.md - Complete development guide
License
MIT License - see LICENSE file for details.
Metadata
Release files for promptly-llm 0.2.0
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 |
|---|---|---|---|---|
| promptly_llm-0.2.0.tar.gz | 34.8 kB | With provenance | Details for promptly_llm-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| promptly_llm-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for promptly_llm-0.2.0-py3-none-any.whl |
Total release size: 69.3 kB
Release files / promptly_llm-0.2.0.tar.gz
| Download URL | promptly_llm-0.2.0.tar.gz |
|---|---|
| Size | 34.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60d97845dccb382a995df45c162fb1553a502abaa9921186921ad5a6c8a1ce9e
|
|
BLAKE2b-256 checksum How to use checksums |
4e330d27cd6bffdc234b2329c096da2b7bef07e0286de01b20adc66e85c236b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 24, 2025.
Transparency logRelease files / promptly_llm-0.2.0-py3-none-any.whl
| Download URL | promptly_llm-0.2.0-py3-none-any.whl |
|---|---|
| Size | 34.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
716c6cf8ea23b5072a110f20bae3d2ef77def51e2252b1591f35abb4a158f261
|
|
BLAKE2b-256 checksum How to use checksums |
33478a22a7d585fbd9fdbda00d061170bc4e4a9e5b33d24c8d3f7b872636a8c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 24, 2025.
Transparency logSecurity for promptly-llm 0.2.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for promptly_llm-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 24, 2025.
Transparency logA 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.