Nighthawk
Nighthawk is a Python library that makes natural-language judgment composable with ordinary Python functions.
Use Natural blocks for interpretation, classification, and other judgments; combine actions, constraints, and verification through Python functions and existing libraries. Python owns the surrounding control flow, state, and recovery. The same typed boundaries support provider-backed LLM calls and coding-agent executions.
Installation
Prerequisites: Python 3.13+
pip install nighthawk-python pydantic-ai-slim[openai]
For other providers, see Pydantic AI providers.
Example
import nighthawk as nh
def python_average(numbers: list[float]) -> float:
return sum(numbers) / len(numbers)
step_executor = nh.AgentStepExecutor.from_configuration(configuration=nh.StepExecutorConfiguration(model="openai-responses:gpt-5.6-luna"))
with nh.run(step_executor):
@nh.natural_function
def calculate_average(numbers: list[object]) -> float:
result: float = 0.0
"""natural
Map each element of <numbers> to the number it represents,
then compute <:result> by calling <python_average> with the mapped list.
"""
return result
print(calculate_average([1, "2", "three", "cuatro"])) # 2.5
Natural interprets the mixed representations, python_average performs the deterministic calculation, and the output binding validates result as a float before Python resumes.
Type validation constrains the result's shape; it does not prove the interpretation is correct.
See the Quickstart for setup details, credentials, and troubleshooting.
Embedding in an application
Hosts can admit whole function calls, select models without losing scoped controls, and observe block outcomes and model usage. See Runtime configuration for usage and execution boundaries for the guarantees. The runtime configuration guide includes executable host-integration examples that run without credentials.
Documentation
- Quickstart -- Install and run a Natural function.
- Natural blocks -- Design prompts, bindings, and Python helpers.
- Patterns and Verification -- Compose, test, and debug workflows.
- Specification and API reference -- Runtime contracts and public interfaces.
- For coding agents -- A compact operational guide.
- Philosophy and Design drivers -- Principles, application needs, and Core responsibility.
Development & Contributing
See CONTRIBUTING.md for setup, development commands, and contribution guidelines.
Inspired by Nightjar.
Metadata
Release files for nighthawk-python 0.16.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 | |
|---|---|---|---|---|
| nighthawk_python-0.16.0.tar.gz | 628.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nighthawk_python-0.16.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 777.8 kB
Release files / nighthawk_python-0.16.0.tar.gz
| Download URL | nighthawk_python-0.16.0.tar.gz |
|---|---|
| Size | 628.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7eefd1574d960a476fbb1ef8bcba6b71d1f6ed917072187c3f839084a3c667f
|
|
BLAKE2b-256 checksum How to use checksums |
0be500a12da230df7b4a7060460410d0e916e580875fc35394f1065d65e9cade
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 18, 2026.
Transparency logRelease files / nighthawk_python-0.16.0-py3-none-any.whl
| Download URL | nighthawk_python-0.16.0-py3-none-any.whl |
|---|---|
| Size | 149.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
509d4f9bd5d96b162a4f282692f3fa27012205af53fc8e5e1c84286b65460309
|
|
BLAKE2b-256 checksum How to use checksums |
aade213084804ad7c6180e00256f3c8c91246026015fcc8504a536f254aa126d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 18, 2026.
Transparency logSecurity for nighthawk-python 0.16.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 nighthawk_python-0.16.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 18, 2026.
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.