Skip to main content

Anviksha Runtime Engine (ARE)

Anviksha Runtime Engine is an adaptive AI execution runtime. Applications describe intent; the runtime plans, selects capabilities, executes the plan, records state, applies policies, and returns a structured response — all without developers manually orchestrating models, tools, or workflows.

Philosophy: Define the destination. The runtime decides the journey.


Quick Start

from anviksha import Runtime, RuntimeConfig

# Offline mode — no LLM required
runtime = Runtime(config=RuntimeConfig(register_llm=False))

# Math → calculator (deterministic)
response = runtime.execute("2 + 3 * 4")
print(response.output)        # 14.0

# Search → retrieval (BM25)
response = runtime.execute("search for python runtime")
print(response.output)        # ranked results

# Python evaluation (safe AST)
response = runtime.execute("evaluate sum(range(100))")
print(response.output)        # 4950

# Async
import asyncio
response = asyncio.run(runtime.aexecute("2 ** 10"))
print(response.output)        # 1024

# Inspect execution
print(response.status)        # succeeded
print(response.diagnostics)   # planner decisions
print(response.metadata)      # timeline, events, cost

Architecture

Application
    │
    ▼
┌─────────────────────────────────────┐
│         Runtime (SDK)               │
│  execute / aexecute / astream       │
└─────────────────────────────────────┘
    │
    ▼
┌─────────────────────────────────────┐
│         Planner                     │
│  classifies intent, selects caps    │
└─────────────────────────────────────┘
    │
    ▼
┌─────────────────────────────────────┐
│      Policy Engine                  │
│  validates plan & response          │
└─────────────────────────────────────┘
    │
    ▼
┌─────────────────────────────────────┐
│      Execution Engine               │
│  parallel step execution + retry    │
└─────────────────────────────────────┘
    │                           │
    ▼                           ▼
┌──────────┐           ┌──────────────┐
│ Capability│◄─────────│ State Manager│
│ Registry  │  events  │ + SQLite     │
└──────────┘           └──────────────┘

10 RFCs implemented: Runtime Architecture, Execution Lifecycle, Planner, Capability Registry, Execution Engine, Policy Engine, State Manager, Observability, Plugin SDK, Public Python SDK.


Features

Feature Status
Intent classification (9 types) ✅
Safe AST-based calculator ✅
Text retrieval (BM25) ✅
Session memory (key-value) ✅
Safe Python evaluation ✅
HTTP fetch capability ✅
Sandboxed filesystem ✅
HTTP LLM capability (OpenAI-compatible) ✅
Parallel step execution ✅
Retry with exponential backoff ✅
Plan validation (dependencies, capability existence) ✅
Minimum confidence policy ✅
Immutable state timeline ✅
SQLite persistent state ✅
Structured observability events ✅
OpenTelemetry export (optional) ✅
Plugin auto-discovery (entry points) ✅
No silent fallbacks — every error is actionable ✅

Configuration

Variable Default Description
ANVIKSHA_LLM_API_BASE — OpenAI-compatible API base URL
ANVIKSHA_LLM_API_KEY — API key
ANVIKSHA_LLM_MODEL — Model name
ANVIKSHA_MAX_RETRIES 3 Max capability retry attempts
ANVIKSHA_RETRY_BASE_DELAY_S 1.0 Initial retry backoff
ANVIKSHA_RETRY_MAX_DELAY_S 30.0 Maximum retry delay
ANVIKSHA_STATE_DB_PATH — SQLite path for persistence
OTEL_EXPORTER_OTLP_ENDPOINT — OpenTelemetry endpoint

Performance

Benchmark                     Ops/sec
─────────────────────────────────────
Calculator throughput          4,727/s
Python evaluation             26,068/s
Memory operations            749,597/s
Retrieval (1000 docs)            155/s
p50 latency                     0.13ms

Testing

96 tests (49 original + 47 new Phase 2) — unit, integration, concurrency, property-based.

pip install -e ".[dev]"
pytest tests/ -v --cov

Project Structure

src/anviksha/
├── __init__.py
├── config.py                  # Env-based RuntimeSettings
├── exceptions.py              # Exception hierarchy
├── types.py                   # Immutable data models
├── capabilities/
│   ├── base.py                # Capability protocol & metadata
│   ├── registry.py            # Filtering/sorting registry
│   ├── builtins.py            # AST calculator
│   ├── llm.py                 # HTTP LLM capability
│   ├── retrieval.py           # BM25 text retrieval
│   ├── memory.py              # In-memory key-value store
│   ├── python_exec.py         # Safe Python evaluation
│   ├── http_client.py         # HTTP fetch capability
│   └── filesystem.py          # Sandboxed file I/O
├── execution/engine.py        # Parallel execution + retry
├── observability/events.py    # Structured event sink
├── planner/default.py         # Rule-based intent classifier
├── plugins/sdk.py             # Plugin protocol & metadata
├── plugins/discovery.py       # Entry-point auto-discovery
├── policy/engine.py           # Policy engine + min confidence
├── sdk/runtime.py             # Public Runtime API
└── state/manager.py           # Immutable state timeline
    state/persistence.py       # SQLite persistent state

License

MIT

Metadata

Release files for anviksha 1.1.0

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

Source distribution (sdist)

Source distribution for anviksha 1.1.0
File Size Uploaded Provenance Actions
anviksha-1.1.0.tar.gz 60.0 kB Without provenance Details for anviksha-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for anviksha 1.1.0
File Interpreter ABI Platform Actions
anviksha-1.1.0-py3-none-any.whl Python 3 none any Details for anviksha-1.1.0-py3-none-any.whl

Total release size: 89.4 kB

Release files / anviksha-1.1.0.tar.gz

Download URL anviksha-1.1.0.tar.gz
Size 60.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9aa4d9652661fe84f505f9d1dd9dd2d92df68e7eae8a114b3f9c1d14e6cc013d
BLAKE2b-256 checksum
How to use checksums
6697389b9210cc7e1f978c8946f915c7dd124335dc740cb25ea2aa9b995d7ce2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.12.1.2 readme-renderer/44.0 requests/2.32.4 requests-toolbelt/1.0.0 urllib3/2.2.1 tqdm/4.67.1 importlib-metadata/8.6.1 keyring/25.6.0 rfc3986/1.5.0 colorama/0.4.6 CPython/3.12.4

Release files / anviksha-1.1.0-py3-none-any.whl

Download URL anviksha-1.1.0-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcdc14be2a2f0396ea8086785719c41d13b62b72c729ab493804d7b05b3a58fe
BLAKE2b-256 checksum
How to use checksums
e36034f8e9fcb6d6ce8b8d85b1a2088d0c9e8d661853a328bd9f8e7458c799fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.12.1.2 readme-renderer/44.0 requests/2.32.4 requests-toolbelt/1.0.0 urllib3/2.2.1 tqdm/4.67.1 importlib-metadata/8.6.1 keyring/25.6.0 rfc3986/1.5.0 colorama/0.4.6 CPython/3.12.4

Security for anviksha 1.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

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