Metadata-Version: 2.4
Name: baselith-core
Version: 0.30.0
Summary: A Modular Framework for Baselith-Core Orchestration featuring World Models (MCTS), Swarm, and Native MCP.
Author-email: Gippo <baselith.ai@gmail.com>
License-Expression: AGPL-3.0-only
Project-URL: Homepage, https://github.com/baselithcore/baselithcore
Project-URL: Repository, https://github.com/baselithcore/baselithcore
Project-URL: Documentation, https://baselithcore.github.io/baselithcore
Keywords: ai,agents,framework
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSE.exception
Requires-Dist: aiohttp>=3.9.4
Requires-Dist: alembic>=1.13.0
Requires-Dist: anthropic<1.0,>=0.18.0
Requires-Dist: argon2-cffi>=23.1.0
Requires-Dist: cryptography>=50.0.0
Requires-Dist: defusedxml<1.0,>=0.7.1
Requires-Dist: email-validator>=2.1.0
Requires-Dist: fastapi<0.200,>=0.140.13
Requires-Dist: fastapi-limiter<0.2.0,>=0.1.6
Requires-Dist: httpx<1.0,>=0.27.0
Requires-Dist: jsonschema>=4.23.0
Requires-Dist: langchain-text-splitters>=1.1.0
Requires-Dist: markdown-it-py<4.0,>=3.0.0
Requires-Dist: networkx>=3.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: ollama<1.0,>=0.6.0
Requires-Dist: openai<3.0,>=2.2.0
Requires-Dist: opentelemetry-api>=1.21.0
Requires-Dist: opentelemetry-exporter-otlp>=1.21.0
Requires-Dist: opentelemetry-instrumentation-fastapi>=0.42b0
Requires-Dist: opentelemetry-instrumentation-httpx>=0.42b0
Requires-Dist: opentelemetry-instrumentation-redis>=0.42b0
Requires-Dist: opentelemetry-sdk>=1.21.0
Requires-Dist: orjson<4.0,>=3.11.7
Requires-Dist: prometheus-client<1.0,>=0.20.0
Requires-Dist: psycopg[binary,pool]<4.0,>=3.2.1
Requires-Dist: pydantic-settings>=2.0.0
Requires-Dist: PyJWT<3.0,>=2.10.1
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: python-multipart>=0.0.30
Requires-Dist: PyYAML>=6.0
Requires-Dist: redis[hiredis]<6.0,>=5.0.7
Requires-Dist: rq>=1.15.0
Requires-Dist: sentry-sdk[fastapi]>=2.0.0
Requires-Dist: sse-starlette>=2.1.0
Requires-Dist: structlog>=24.1.0
Requires-Dist: uvicorn[standard]<1.0,>=0.30.0
Requires-Dist: rich>=13.7.0
Requires-Dist: rich-argparse>=1.4.0
Requires-Dist: argcomplete>=3.2.0
Provides-Extra: browser
Requires-Dist: playwright>=1.62.0; extra == "browser"
Provides-Extra: documents
Requires-Dist: pypdf>=6.16.1; extra == "documents"
Requires-Dist: python-docx<2,>=1.2.0; extra == "documents"
Requires-Dist: python-pptx<2,>=1.0.2; extra == "documents"
Requires-Dist: openpyxl==3.1.5; extra == "documents"
Requires-Dist: xlrd>=2.0.2; extra == "documents"
Provides-Extra: ocr
Requires-Dist: pdf2image>=1.17.0; extra == "ocr"
Requires-Dist: Pillow==12.3.0; extra == "ocr"
Requires-Dist: pytesseract>=0.3.13; extra == "ocr"
Provides-Extra: mineru
Requires-Dist: mineru[pipeline]<4,>=3.4.4; extra == "mineru"
Provides-Extra: web
Requires-Dist: beautifulsoup4>=4.14.2; extra == "web"
Requires-Dist: soupsieve>=2.8.4; extra == "web"
Requires-Dist: playwright>=1.62.0; extra == "web"
Provides-Extra: qdrant
Requires-Dist: qdrant-client<2.0,>=1.15.1; extra == "qdrant"
Provides-Extra: rag
Requires-Dist: sentence-transformers==5.6.0; extra == "rag"
Provides-Extra: nlp
Requires-Dist: spacy<4,>=3.8.15; extra == "nlp"
Provides-Extra: gemini
Requires-Dist: google-genai<2.0,>=1.16.0; extra == "gemini"
Provides-Extra: tokenizer
Requires-Dist: tiktoken>=0.7.0; extra == "tokenizer"
Provides-Extra: evaluation
Requires-Dist: deepeval>=2.0.0; extra == "evaluation"
Provides-Extra: sandbox
Requires-Dist: docker>=7.0.0; extra == "sandbox"
Provides-Extra: huggingface
Requires-Dist: huggingface-hub>=0.20.0; extra == "huggingface"
Requires-Dist: transformers>=5.3.0; extra == "huggingface"
Requires-Dist: accelerate>=0.25.0; extra == "huggingface"
Provides-Extra: test
Requires-Dist: qdrant-client<2.0,>=1.15.1; extra == "test"
Requires-Dist: beautifulsoup4>=4.14.2; extra == "test"
Requires-Dist: soupsieve>=2.8.4; extra == "test"
Requires-Dist: pypdf>=6.16.1; extra == "test"
Requires-Dist: pytest>=7.4.0; extra == "test"
Requires-Dist: pytest-cov>=4.1.0; extra == "test"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
Requires-Dist: pytest-timeout>=2.4.0; extra == "test"
Requires-Dist: pytest-randomly>=4.1.0; extra == "test"
Requires-Dist: hypothesis>=6.100; extra == "test"
Requires-Dist: schemathesis>=4.25; extra == "test"
Requires-Dist: pytest-xdist>=3.8.0; extra == "test"
Provides-Extra: load
Requires-Dist: locust>=2.20.0; extra == "load"
Provides-Extra: dev
Requires-Dist: qdrant-client<2.0,>=1.15.1; extra == "dev"
Requires-Dist: beautifulsoup4>=4.14.2; extra == "dev"
Requires-Dist: soupsieve>=2.8.4; extra == "dev"
Requires-Dist: pypdf>=6.16.1; extra == "dev"
Requires-Dist: pytest>=7.4.0; extra == "dev"
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: pytest-timeout>=2.4.0; extra == "dev"
Requires-Dist: pytest-randomly>=4.1.0; extra == "dev"
Requires-Dist: hypothesis>=6.100; extra == "dev"
Requires-Dist: schemathesis>=4.25; extra == "dev"
Requires-Dist: ruff==0.15.5; extra == "dev"
Requires-Dist: mypy==2.3.0; extra == "dev"
Requires-Dist: ipython>=8.0.0; extra == "dev"
Requires-Dist: pre-commit>=3.5.0; extra == "dev"
Requires-Dist: types-PyYAML; extra == "dev"
Provides-Extra: memory
Requires-Dist: supermemory>=0.1.0; extra == "memory"
Provides-Extra: pii
Requires-Dist: presidio-analyzer>=2.2.0; extra == "pii"
Requires-Dist: presidio-anonymizer>=2.2.0; extra == "pii"
Provides-Extra: bedrock
Requires-Dist: anthropic[bedrock]<1.0,>=0.18.0; extra == "bedrock"
Provides-Extra: vertex
Requires-Dist: anthropic[vertex]<1.0,>=0.18.0; extra == "vertex"
Provides-Extra: computer-use
Requires-Dist: mss>=9.0.0; extra == "computer-use"
Requires-Dist: Pillow==12.3.0; extra == "computer-use"
Requires-Dist: pyautogui>=0.9.54; extra == "computer-use"
Dynamic: license-file

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="media/full-white-og.png">
    <source media="(prefers-color-scheme: light)" srcset="media/full-black-og.png">
    <img alt="BaselithCore Logo" src="media/full-black-og.png" width="500">
  </picture>
</p>

# BaselithCore

> **Agents that survive production.** Durable execution, enforced budgets, and EU AI Act evidence — self-hosted, with no companion SaaS.

[![CI](https://github.com/baselithcore/baselithcore/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/baselithcore/baselithcore/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/baselith-core.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.org/p/baselith-core/)
[![Version 0.30.0](https://img.shields.io/badge/version-0.30.0-0b5394.svg?style=flat-square)](CHANGELOG.md)
[![Tests: 6443 passing](https://img.shields.io/badge/tests-6443%20passing-brightgreen.svg?style=flat-square)](https://github.com/baselithcore/baselithcore/actions/workflows/ci.yml)
[![Coverage 79%](https://img.shields.io/badge/coverage-79%25-brightgreen.svg?style=flat-square)](https://docs.baselithcore.xyz/advanced/testing/)
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
[![Licence: AGPL-3.0](https://img.shields.io/badge/licence-AGPL--3.0-blue.svg?style=flat-square)](LICENSE)
[![Your plugins: any licence](https://img.shields.io/badge/your%20plugins-any%20licence-brightgreen.svg?style=flat-square)](LICENSE.exception)
[![Docs](https://img.shields.io/badge/docs-baselithcore.xyz-0b5394.svg?style=flat-square)](https://docs.baselithcore.xyz)

BaselithCore is a Python orchestration engine for agentic AI. Execution state
is checkpointed as a run proceeds, so an interrupted process resumes from its
last completed step instead of replaying side effects. Every request carries a
budget that caps iterations, tool calls, tokens and USD spend, and every step
emits OpenTelemetry spans and Prometheus metrics with real cost attached. The
audit trail a regulated deployment has to produce is written while the system
runs, not reconstructed from logs afterwards.

<div align="center">

[**Quick start**](#quick-start) · [**Docs**](https://docs.baselithcore.xyz) · [**Architecture**](#architecture-at-a-glance) · [**Contributing**](CONTRIBUTING.md)

</div>

> **Writing a plugin? You keep your source.** The [plugin exception](LICENSE.exception)
> lets any plugin that uses the framework as a library ship under any licence you
> like, including a closed one. Same terms for everyone.

---

## Why BaselithCore

- **Agents that survive production.** Durable execution with checkpoint/resume, replayable tool steps, state history and fork/rewind — a `SIGKILL` mid-run recovers without repeating a single side effect.
- **Everything included, nothing rented.** Evaluation suites, LLM-as-judge, red-teaming, OpenTelemetry tracing, Prometheus metrics with real USD cost, Helm/Terraform deployment — built in and self-hosted, with no companion SaaS to subscribe to.
- **Brakes, not just horsepower.** Autonomy gating, durable human-in-the-loop approvals, per-request cost budgets, prompt-injection guardrails, sandboxed code execution — every seam fail-closed by default, plus opt-in EU AI Act / GDPR / NIS2 / DORA primitives with evidence trails.

## Sixty seconds

```bash
pip install baselith-core
```

```python
from core.agent import Agent, Crew, Task

researcher = Agent(system_prompt="You are a meticulous researcher.")
writer = Agent(system_prompt="You write crisp executive summaries.")

crew = Crew(agents=[researcher, writer], tasks=[
    Task("Research {topic} and list the key facts.", agent=researcher),
    Task("Write a summary from the research.", agent=writer),
])
report = (await crew.run(inputs={"topic": "vector databases"})).final
```

Typed, budgeted and observable from the first line — the
[quickstart](https://docs.baselithcore.xyz/getting-started/quickstart/) adds
tools, structured output and a checkpoint store.

## Architecture at a glance

```mermaid
graph TD
    subgraph SC["Sacred Core (Agnostic Engine)"]
        A["Core Orchestrator<br/>(intent · routing · adaptive loop · durable checkpoint/resume)"]
        F["Flow Handlers"]

        subgraph COG["Cognitive Layer"]
            RE["Reasoning<br/>(MCTS · Tree-of-Thoughts)"]
            WM["World Model<br/>(risk · rollback · simulation)"]
            SW["Swarm<br/>(auction protocols)"]
            PL["Planning"]
            MT["Meta · Reflection · Adversarial"]
        end

        LP["Engineered Loops<br/>(verifier · stall guard · escalation)"]
        M["Memory Hierarchy<br/>(STM → MTM → LTM)"]
        S["Storage Layer<br/>(Postgres · Qdrant/pgvector · Redis)"]
        R["Plugin Registry"]
        RES["Resilience · Observability · Guardrails"]
    end

    A --> COG
    A --> F
    A --> LP
    A --> M
    M --> S
    COG --> M

    R --> C["Custom Agent Plugins"]
    R --> D["Capability Extensions"]
    R -.->|Inject Handlers| A
    R -.->|Inject Routers| G["API Gateway"]

    A --> H["LLM Layer<br/>(Anthropic · OpenAI · Gemini · Ollama · HF)<br/>native tool-calling · typed output · cross-provider fallback"]
    F --> H

    A --> I["Interop<br/>(MCP · A2A streaming · AP2 mandates · realtime duplex)"]
    A -.->|wrapped by| RES
```

Two rules hold the shape: `core/` stays domain-agnostic, and everything
domain-specific is a plugin. The [architecture
docs](https://docs.baselithcore.xyz/architecture/overview/) go deeper.

<details>
<summary><b>What's inside</b> — the full capability list</summary>

| | |
| :-- | :-- |
| **Typed agents & declarative crews** | Single-import `Agent`, sequential/parallel/manager-led `Crew`, free-form group chat → [Agent API](https://docs.baselithcore.xyz/core-modules/agent/) |
| **Durable execution & time-travel** | Checkpoint/resume (Postgres, SQLite or in-memory), replayable tool steps, state history, fork/rewind → [Orchestration](https://docs.baselithcore.xyz/core-modules/orchestration/) |
| **Loop engineering** | Verifier-owned loops with stall detection, feed-forward lessons, escalation and resumable outcomes → [Loops](https://docs.baselithcore.xyz/core-modules/loops/) |
| **Structured event streaming** | Per-run agent events in-process or over SSE, plus async run submission with completion webhooks → [Orchestration](https://docs.baselithcore.xyz/core-modules/orchestration/) |
| **Cognitive layer** | MCTS, Tree-of-Thoughts, world model, swarm auctions & bounded handoffs → [Reasoning](https://docs.baselithcore.xyz/core-modules/reasoning/) · [Swarm](https://docs.baselithcore.xyz/core-modules/swarm/) |
| **Governance & safety** | Autonomy gating, durable human-in-the-loop, plan approval, loop & tool budgets, layered guardrails, sandboxed code → [Autonomy & Safety](https://docs.baselithcore.xyz/core-modules/orchestration/) |
| **Memory & RAG** | STM→MTM→LTM hierarchy, hybrid search, hierarchical chunking, full RAG pipeline, Qdrant or pgvector backends → [Memory](https://docs.baselithcore.xyz/core-modules/memory/) |
| **Multimodal** | Vision, native PDF and audio content blocks, duplex realtime voice with barge-in → [Realtime](https://docs.baselithcore.xyz/core-modules/realtime/) |
| **Interoperability** | Native dual-era MCP (server + client + declarative registry), A2A peer interop, AP2 signed-mandate commerce → [MCP](https://docs.baselithcore.xyz/core-modules/mcp/) · [A2A](https://docs.baselithcore.xyz/core-modules/a2a/) |
| **Self-improvement, governed** | Skill evolution, prompt compilation and evolutionary search — every change eval-gated, audited and human-approvable → [Skill Evolution](https://docs.baselithcore.xyz/core-modules/skill-evolution/) |
| **Evaluation & observability** | Trajectory eval in CI, multi-model bake-off, LLM-as-judge, red-team, OTel + Prometheus with USD cost metrics → [Evaluation](https://docs.baselithcore.xyz/core-modules/evaluation/) |
| **Regulatory toolkit** | Opt-in EU AI Act / GDPR / NIS2 / DORA primitives with evidence trails → [Regulatory Compliance](https://docs.baselithcore.xyz/advanced/regulatory-compliance/) |
| **Production deployment** | Docker, Helm, Terraform, SLO rules, typed SDKs → [Deployment](https://docs.baselithcore.xyz/advanced/deployment/) |

</details>

## <span id="quick-start"></span> Quick start

```bash
pip install baselith-core       # core engine
docker compose up -d            # Redis, PostgreSQL, Qdrant (optional)
baselith doctor                 # validate environment and configuration
```

Optional capabilities (RAG, browser automation, OCR, extra model providers,
vector backends, …) install as extras — the [installation
guide](https://docs.baselithcore.xyz/getting-started/installation/) has the
full list.

## Contributing

Contributions are welcome, and the on-ramps are deliberately marked:

- [**good first issue**](https://github.com/baselithcore/baselithcore/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) — scoped, with context and an acceptance check
- [**help wanted**](https://github.com/baselithcore/baselithcore/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) — bigger pieces that need an owner
- [**Discussions**](https://github.com/baselithcore/baselithcore/discussions) — questions, ideas, and what you built

[CONTRIBUTING.md](CONTRIBUTING.md) covers the dev setup, the quality gates your
PR has to pass, and the review turnaround you can expect.

Version 0.30.0 ships **6,443 tests** at **79% branch coverage**, gated in CI at
a 75% floor alongside strict typing, architecture-boundary and docs-consistency
checks.

## Licence

BaselithCore is licensed under the **GNU Affero General Public License v3.0 only
(AGPL-3.0-only)** — see [LICENSE](LICENSE).

[LICENSE.exception](LICENSE.exception) grants an additional permission under
AGPL section 7: a plugin that uses the framework as a library — rather than
modifying it — may be licensed under any terms you choose, including closed
ones, and section 13 never reaches it. The permission is offered to everyone on
identical terms. Two conditions come with it: your plugin must carry the notice
described in section 3(c), and patching files under `core/` makes it a modified
framework rather than a plugin, in which case AGPL-3.0-only applies in full. See
[plugin packaging](https://docs.baselithcore.xyz/plugins/packaging/) for what
the notice has to say.

---
Copyright © 2026 BaselithCore Team.
