prap
A lightweight agent harness.
pip install prap
import asyncio
from prap import run
def model(messages):
if messages[-1]["role"] == "tool":
return {"content": "The answer is " + messages[-1]["content"]}
return {
"tool_calls": [
{"id": "sum-1", "name": "add", "arguments": {"a": 2, "b": 3}}
]
}
transcript = asyncio.run(run(
model,
[{"role": "user", "content": "What is 2 + 3?"}],
{"add": lambda args: args["a"] + args["b"]},
))
print(transcript[-1]["content"])
Supply your own model callback or API adapter. Callbacks may be synchronous or
asynchronous. The model receives a copy of the transcript and returns an object
with a string content (default "") and an optional tool_calls list. Each call
has a nonempty string id, a registered name, and an arguments object. Each
tool receives that object as one positional argument and returns a JSON value.
Calls in a batch run sequentially after the entire batch is validated. A response
without tool calls ends the run. max_turns defaults to 8 and limits model calls;
tools requested on the last turn still run. An unfinished run raises
TurnLimitError. Callback exceptions propagate without retries. Messages and
results must be JSON serializable; non-finite numbers are rejected.
Requires Python 3.10 or newer. No runtime dependencies.
Licensed under Apache-2.0.
Metadata
Release files for prap 0.0.1
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 |
|---|---|---|---|---|
| prap-0.0.1.tar.gz | 6.5 kB | Without provenance | Details for prap-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| prap-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for prap-0.0.1-py3-none-any.whl |
Total release size: 13.8 kB
Release files / prap-0.0.1.tar.gz
| Download URL | prap-0.0.1.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d4a2425fa29be56e93938ceb9eb7b01800f24c3f66138ba1bd1cedfd9cae9cc
|
|
BLAKE2b-256 checksum How to use checksums |
dd465724f0530bcef875aef0b931839f681b8e2fc4bb7d1e1867a05a2ef0a547
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Release files / prap-0.0.1-py3-none-any.whl
| Download URL | prap-0.0.1-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67f8429d3bfbfa4da4c191b01147a5d3d7ad81e5f265b3dcd2da691632b9c6cf
|
|
BLAKE2b-256 checksum How to use checksums |
f1fe79c55e1a85fd0c5f350685f707eb3739fa9ff5a30c4c6b4d09a6f4b3aa74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Security for prap 0.0.1
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.