Skip to main content

A Python library where Python controls flow and LLMs or coding agents reason within constrained Natural blocks.

Project description

PyPI PyPI Stats license issue resolution

Nighthawk

nighthawk-logo

Nighthawk is a Python library where Python controls flow and LLMs or coding agents reason within constrained Natural blocks.

  • Hard control (Python code): strict procedure, verification, and deterministic flow.
  • Soft reasoning (an LLM or coding agent): semantic interpretation inside small embedded "Natural blocks".

The same mechanism handles lightweight LLM judgments ("classify this sentiment") and autonomous agent executions ("refactor this module and write tests"). See Philosophy for the full design rationale.

This repository is a compact reimplementation of the core ideas of Nightjar.

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):
    return sum(numbers) / len(numbers)

step_executor = nh.AgentStepExecutor.from_configuration(
    configuration=nh.StepExecutorConfiguration(model="openai-responses:gpt-5.4-nano")
)

with nh.run(step_executor):

    @nh.natural_function
    def calculate_average(numbers):
        """natural
        Map each element of <numbers> to the number it represents,
        then compute <:result> by calling <python_average> with the mapped list.
        """
        return result

    calculate_average([1, "2", "three", "cuatro"])  # 2.5

See the Quickstart for setup details, credentials, and troubleshooting.

Documentation

Development & Contributing

See CONTRIBUTING.md for setup, development commands, and contribution guidelines.

References

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

nighthawk_python-0.11.0.tar.gz (338.2 kB view details)

Uploaded Source

Built Distribution

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

nighthawk_python-0.11.0-py3-none-any.whl (104.3 kB view details)

Uploaded Python 3

File details

Details for the file nighthawk_python-0.11.0.tar.gz.

File metadata

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

File hashes

Hashes for nighthawk_python-0.11.0.tar.gz
Algorithm Hash digest
SHA256 34555bf188e11c94d191e3c727be200b19cbd47252ed2cfef77fc053753dccc2
MD5 186c742f874c4b02645371de8588be06
BLAKE2b-256 b6ff5fac45fa3ade330a00124da98f8216b7dab69d3913a6d2b52b1d081510b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for nighthawk_python-0.11.0.tar.gz:

Publisher: publish.yml on kurusugawa-computer/nighthawk-python

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

File details

Details for the file nighthawk_python-0.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nighthawk_python-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89a87d14c5995d3bca2d67f57ae9e16aa270bc755d5de827ff55e85fdeedbcc5
MD5 ade51de24910a2e489de96d8c929ae54
BLAKE2b-256 21a69156066e6e74493d255ced42e2d120959f8a919d47ff10e33d9cc29d7575

See more details on using hashes here.

Provenance

The following attestation bundles were made for nighthawk_python-0.11.0-py3-none-any.whl:

Publisher: publish.yml on kurusugawa-computer/nighthawk-python

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