Inspectable Python agent runtime with strict tool contracts, QAOA traces, and durable memory ports.
Project description
NAQSHA
Inspectable agent runtime for Python. NAQSHA gives you a production-shaped Core Runtime with validated NAP Actions, append-only QAOA Traces, enforced Tool Policy, explicit Approval Gates, and durable Memory Port adapters—not a thin wrapper around a chat API.
PyPI distribution, Python import package, and CLI entry point are all spelled naqsha.
Why NAQSHA
| You need | What you get |
|---|---|
| Truth that survives prompting | A QAOA Trace (Query · Action · Observation · Answer) is the canonical record, not an API chat log. |
| Safety beyond "please behave" | Tool Policy and Approval Gates are runtime-enforced; side effects route through tiers and human checkpoints. |
| Untrusted tool output | Observation Sanitizer runs before traces, prompts, or memory see tool payloads. |
| Regression without flakiness | Trace replay with recorded observations by call id, plus schema-versioned eval fixtures. |
| Improvement without hot-patching prod | The Reflection Loop writes isolated Reflection Patches for human review only—nothing auto-merges. |
Read the glossary in CONTEXT.md for exact vocabulary when filing issues or designing extensions.
Documentation
Full guides (install, architecture, profiles, embedding, replay, reflection) ship in-repo and inside the source distribution:
| Resource | Contents |
|---|---|
| User guide hub | Start here: getting started → architecture → CLI & profiles → Python API |
| Example Run Profiles | Remote model adapters, paths, api_key_env (never inline secrets) |
| Architectural decisions | Locked-in choices backing the terminology above |
On GitHub without a checkout: Documentation tree.
Install
python -m pip install naqsha
naqsha --version # same as: python -m naqsha --version
Developers (tests + Ruff) from a clone:
uv sync --extra dev
uv run --extra dev pytest
uv run --extra dev ruff check .
Credential names (not values) belong in api_key_env inside profiles. Copy .env.example to .env locally if your workflow uses dotenv loaders—never commit real keys.
Five-minute CLI tour
Bundled local-fake needs no project layout and performs deterministic runs offline:
naqsha run --profile local-fake --human "ping"
For a real workbench project under .naqsha/:
mkdir demo && cd demo
naqsha init
naqsha run --profile workbench --human "hello"
# Inspect the latest trace
naqsha replay --profile workbench --latest --human
# Regression: snapshot then verify (use run_id from JSON stdout or the stderr replay hint after `run`)
naqsha eval save --profile workbench <run_id> smoke
naqsha eval check --profile workbench <run_id> --name smoke
# Reflection workspace (human review required; see docs/user-guide/04-library-traces-eval-and-reflection.md)
naqsha reflect --profile workbench <run_id>
naqsha run prints structured JSON on stdout by default (--human prints the answer only). Inspect effective policy before turning on approvals:
naqsha profile show --profile workbench
naqsha tools list --profile workbench
Concept map
flowchart LR
subgraph ux [Agent-facing]
CLI[naqsha CLI]
WB[AgentWorkbench]
end
CR[Core Runtime]
NAP[NAP Actions]
T[Starter Tool Set]
M[Memory Port]
Trace[QAOA Trace Store]
CLI --> WB
WB --> CR
CLI --> CR
CR --> NAP
CR --> T
CR --> M
CR --> Trace
Library quick start
from naqsha import AgentWorkbench, build_runtime, load_run_profile
# High-level façade
wb = AgentWorkbench.from_profile_spec("workbench")
result = wb.run("hello")
# Direct Core Runtime wiring
runtime = build_runtime(load_run_profile("local-fake"))
runtime.run("ping")
Exports and semantics: Library guide.
CLI reference (short)
| Command | Role |
|---|---|
naqsha init |
Create .naqsha/ directories and default workbench profile |
naqsha run QUERY |
Execute a turn loop; --approve-prompt, --human, profile overrides |
naqsha replay [RUN_ID] |
Summarize a trace; --latest; --re-execute for regression replay |
naqsha trace inspect |
Same summaries as replay without re-execution |
naqsha profile show / inspect-policy |
Resolved Run Profile + Tool Policy JSON |
naqsha tools list |
Allowed tools + risk metadata |
naqsha eval save / eval check |
.naqsha/evals/ fixtures |
naqsha reflect / improve |
Reflection Patch workspace (review-only) |
Default --profile is local-fake; after naqsha init use workbench.
Repository layout hints
| Path | Meaning |
|---|---|
src/naqsha/ |
Core Runtime, wiring, adapters, CLI |
docs/user-guide/ |
Human-oriented documentation |
examples/profiles/ |
Copy‑paste Run Profile starters |
sandbox/ |
Optional manual / paid‑API experiments—not required to use the library |
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file naqsha-0.1.0.tar.gz.
File metadata
- Download URL: naqsha-0.1.0.tar.gz
- Upload date:
- Size: 63.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
968646d454b28aacae43b3b3a343c3c7be4fad894059398824aa4b3e9113f885
|
|
| MD5 |
60d7ca050b467d4934b3c6fad2a88df2
|
|
| BLAKE2b-256 |
bc6ab48db01b7e8b79ee7007dabab7fb543ebfe7b4a4e27f3eafa22a8327dcdc
|
Provenance
The following attestation bundles were made for naqsha-0.1.0.tar.gz:
Publisher:
publish.yml on KM-Alee/naqsha
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
naqsha-0.1.0.tar.gz -
Subject digest:
968646d454b28aacae43b3b3a343c3c7be4fad894059398824aa4b3e9113f885 - Sigstore transparency entry: 1429109531
- Sigstore integration time:
-
Permalink:
KM-Alee/naqsha@0867b4cfaac6571bec2824708db6f9a857f5b96f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/KM-Alee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0867b4cfaac6571bec2824708db6f9a857f5b96f -
Trigger Event:
push
-
Statement type:
File details
Details for the file naqsha-0.1.0-py3-none-any.whl.
File metadata
- Download URL: naqsha-0.1.0-py3-none-any.whl
- Upload date:
- Size: 69.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3b063f68a405ced060d4a15d04b4464b6dcd975c5a034458e47cfbec4d905a7
|
|
| MD5 |
e3866f234a1b4110b21447031c08ca19
|
|
| BLAKE2b-256 |
097233786bbad74c1fe773da41ce7f1b327ffda94948910644462a60c8c2387c
|
Provenance
The following attestation bundles were made for naqsha-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on KM-Alee/naqsha
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
naqsha-0.1.0-py3-none-any.whl -
Subject digest:
b3b063f68a405ced060d4a15d04b4464b6dcd975c5a034458e47cfbec4d905a7 - Sigstore transparency entry: 1429109536
- Sigstore integration time:
-
Permalink:
KM-Alee/naqsha@0867b4cfaac6571bec2824708db6f9a857f5b96f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/KM-Alee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0867b4cfaac6571bec2824708db6f9a857f5b96f -
Trigger Event:
push
-
Statement type: