This release is a pre-release and may not be stable for production use.
agnara
Capability-native Python for the agentic era.
Agnara is a Python 3.14-native capability framework for services meant to be consumed by humans, applications and AI agents without making HTTP the centre of the architecture. A capability is declared once, with its effects, risk and confirmation requirements, and later exposed through whichever protocol the caller needs.
This distribution is agnara, the capability-first, transport-neutral
execution kernel: the capability model, registry, execution context,
dependency graph, policies, execution planning and canonical errors. It
depends on nothing but the standard library.
Status: alpha
0.1.0a3 is the integration alpha, following the first published version
0.1.0a2. It adds protocol-neutral introspection, discovery filtering and
stronger telemetry contracts. Publication of this version is pending until
the release workflow completes. It is not
production-ready, the public API may change without a deprecation cycle, and
it makes no claim of protocol conformance, benchmark leadership or security
guarantees.
Install
pip install agnara==0.1.0a3
Requires CPython 3.14 or newer.
Quick start
import asyncio
from agnara import Agnara, Risk, StandardEffect
from agnara.core.di import DIContainer, DIRegistry
from agnara.execution import (
ExecutionContext,
ExecutionPlan,
Invocation,
invoke_result,
)
app = Agnara("billing")
@app.capability(
description="Refund a captured payment.",
scopes=("billing:write",),
effects=(StandardEffect.FINANCIAL_WRITE,),
risk=Risk.HIGH,
)
def refund(payment_id: str, amount_cents: int) -> str:
return f"refunded {amount_cents} cents for {payment_id}"
async def main() -> None:
capabilities = app.compile()
dependencies = DIRegistry()
plan = ExecutionPlan.compile(capabilities["billing.refund"], dependencies)
outcome = await invoke_result(
plan,
ExecutionContext(
Invocation(
capability_id=plan.definition.id,
payload={"payment_id": "pay_123", "amount_cents": 2500},
metadata={},
),
DIContainer(dependencies),
),
)
print(outcome)
asyncio.run(main())
The declared function is returned unchanged, so it stays directly callable and directly testable. Registration is a side effect on the application, not a transformation of the function.
What this release includes
- capability declaration and a deterministic, freezable registry;
- stable capability identity, plus effect, risk, idempotency and confirmation metadata;
- a schema port with a standard-library adapter and compiled per-parameter input validation;
- dependency injection with compile-time graph validation and scoped resolution;
- execution plans, direct invocation and optional monotonic deadlines;
- protocol-neutral policies, principals and scope evaluation;
- canonical
Success/Failureoutcomes with stable failure codes; - protocol-neutral introspection snapshots and explicit discovery visibility;
- structured execution telemetry hooks with per-invocation identity.
What it does not include
The HTTP/ASGI, OpenAPI, MCP and CLI adapters exist in the Agnara repository but
are not published to PyPI by the 0.1.0a3 workflow. Build them from the
repository when needed. The OpenTelemetry bridge is also repository-only;
events and A2A remain placeholders.
Frozen value semantics
Core value types such as CapabilityId and CapabilityDefinition are
immutable and slotted. Assigning or deleting either a declared field or an
unknown attribute raises dataclasses.FrozenInstanceError; a typo never
attaches new state and does not leak CPython's internal slots error.
Confirmation boundary
Capabilities declared with confirmation="required" need an
application-provided ConfirmationVerifier when their ExecutionPlan is
compiled. Each invocation may carry an explicit opaque ConfirmationEvidence
on ExecutionContext; values in generic invocation metadata are not approval.
The verifier receives the exact capability id, invocation, and principal and
owns authenticity, input canonicalization, expiry, and replay protection.
Missing evidence terminates execution with an interaction request. Rejected
evidence terminates it as forbidden. Both outcomes occur before dependency
construction or handler effects, and invoke_result() maps them to stable
protocol-neutral failure codes.
Telemetry hooks
The core port is agnara.execution.TelemetryHook, with synchronous
on_invocation_start(InvocationStartEvent) and
on_invocation_terminal(InvocationTerminalEvent) callbacks. Register observers
with ExecutionPlan.compile(definition, registry, hooks=[observer]); inheriting
from the protocol is optional. Events expose capability, invocation and tracking identity;
terminal events also contain monotonic duration and execution outcome, without
handler inputs, returned payloads or exception objects.
Both plan construction paths copy the hook collection to a tuple. Missing or
non-callable callbacks, coroutine functions and generator functions fail at
startup with DefinitionError. This validation is included in 0.1.0a3. Valid callbacks accept one event, return None synchronously
and must not block. Their ordinary exceptions are ignored during execution.
Observers own synchronization of their mutable state and must keep their
callbacks stable after compilation. Tracking IDs are caller-provided and may
repeat; they are not unique span identifiers and should contain no secrets.
Exporter startup, flushing and shutdown belong to adapters, not the core
runtime. The separate agnara-telemetry package provides metrics and tracing
hooks over an application-supplied meter and tracer. It is not published to PyPI.
Migration from 0.1.0a2: code constructing InvocationStartEvent or
InvocationTerminalEvent must supply the new required invocation_id. Use the
same identity for matching start/terminal events; tracking_id is not unique.
Hooks that only read events are unaffected. Plans without hooks skip event
construction entirely.
Links
- Source, architecture and decision records: https://github.com/Blandskron/agnara
- Changelog: https://github.com/Blandskron/agnara/blob/main/CHANGELOG.md
- Architecture: https://github.com/Blandskron/agnara/blob/main/ARCHITECTURE.md
- Longer example: https://github.com/Blandskron/agnara/blob/main/examples/quickstart.py
License
Apache License 2.0.
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 agnara-0.1.0a3.tar.gz.
File metadata
- Download URL: agnara-0.1.0a3.tar.gz
- Upload date:
- Size: 46.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a6a6aaddec8b459f827b164c56a957f745e7ed78f8497db405d37b9f2e514be
|
|
| MD5 |
084a1efca508cda084b14420bded92ff
|
|
| BLAKE2b-256 |
e2b0cd3a66e057a939f1caa71fe79bbf3f988bf079bd5fe82a7ae566cdbe0213
|
Provenance
The following attestation bundles were made for agnara-0.1.0a3.tar.gz:
Publisher:
release.yml on Blandskron/agnara
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agnara-0.1.0a3.tar.gz -
Subject digest:
1a6a6aaddec8b459f827b164c56a957f745e7ed78f8497db405d37b9f2e514be - Sigstore transparency entry: 2742339056
- Sigstore integration time:
-
Permalink:
Blandskron/agnara@390eec5f5f3f4bf40800d3682c20bb3ab8c43273 -
Branch / Tag:
refs/tags/v0.1.0a3 - Owner: https://github.com/Blandskron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@390eec5f5f3f4bf40800d3682c20bb3ab8c43273 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agnara-0.1.0a3-py3-none-any.whl.
File metadata
- Download URL: agnara-0.1.0a3-py3-none-any.whl
- Upload date:
- Size: 63.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b8b493208ba4265ac98c33026d2667c44dc584d743facff379f88dd9051b40c
|
|
| MD5 |
2907ac05beb26986cb7b6ddcfb9a72ab
|
|
| BLAKE2b-256 |
98ca632db992e4e1e9e69ad4a08eb0f20bfb1988a0963aacf838465335444059
|
Provenance
The following attestation bundles were made for agnara-0.1.0a3-py3-none-any.whl:
Publisher:
release.yml on Blandskron/agnara
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agnara-0.1.0a3-py3-none-any.whl -
Subject digest:
2b8b493208ba4265ac98c33026d2667c44dc584d743facff379f88dd9051b40c - Sigstore transparency entry: 2742339063
- Sigstore integration time:
-
Permalink:
Blandskron/agnara@390eec5f5f3f4bf40800d3682c20bb3ab8c43273 -
Branch / Tag:
refs/tags/v0.1.0a3 - Owner: https://github.com/Blandskron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@390eec5f5f3f4bf40800d3682c20bb3ab8c43273 -
Trigger Event:
push
-
Statement type: