Skip to main content
Pre-release

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.0a2 is the first published release — an architectural proof that Agnara installs and runs as a real Python distribution. 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.0a2

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 / Failure outcomes with stable failure codes;
  • structured execution telemetry hooks.

What it does not include

The HTTP/ASGI, OpenAPI, MCP and CLI adapters exist in the Agnara repository but were not published to PyPI in 0.1.0a2, so they cannot be installed with pip yet. Events, A2A and the telemetry bridge are likewise repository-only.

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.

Links

License

Apache License 2.0.

Release files for agnara 0.1.0a2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agnara 0.1.0a2
File Size Uploaded
agnara-0.1.0a2.tar.gz 34.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agnara 0.1.0a2
File Interpreter ABI Platform
agnara-0.1.0a2-py3-none-any.whl Python 3 none any Details

Total release size: 83.3 kB

Release files / agnara-0.1.0a2.tar.gz

Download URL agnara-0.1.0a2.tar.gz
Size 34.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cb73359cd7f136151cf3e896589c8daff24b6c9df368293ec734e503a544a699
BLAKE2b-256 checksum
How to use checksums
8a865d0ab7646f4a773724cc09315b9ead37fc0b01470e75775b6e2a89dbbad4
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 Sep 5, 2026.

Transparency log

Release files / agnara-0.1.0a2-py3-none-any.whl

Download URL agnara-0.1.0a2-py3-none-any.whl
Size 48.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89de4fe7a80d778581a321a3941a4627ea8d3019a744ffd0ad7e42b7749d3627
BLAKE2b-256 checksum
How to use checksums
047d9a0d693abe5323879c7692eccf976a3c49588867344cdafa12fc448a9c33
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 Sep 5, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page