Metadata-Version: 2.4
Name: abintegro
Version: 0.1.0
Summary: The ABIntegro runner SDK: connectors, tasks, policies and embedded AI for deterministic business automation.
Author: AB Software LTD
License-Expression: Apache-2.0
Keywords: automation,integration,workflow,connectors,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastapi>=0.141
Requires-Dist: google-auth>=2.53
Requires-Dist: google-cloud-bigquery>=3.40
Requires-Dist: google-cloud-firestore>=2.19
Requires-Dist: google-cloud-secret-manager>=2.20
Requires-Dist: google-genai<3,>=2.7
Requires-Dist: httpx>=0.28
Requires-Dist: mcp<3,>=2.2
Requires-Dist: pydantic>=2.12
Requires-Dist: PyYAML>=6.0
Requires-Dist: tzdata>=2024.1; sys_platform == "win32"
Requires-Dist: uvicorn>=0.53
Provides-Extra: dev
Requires-Dist: pytest>=8.3; extra == "dev"
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
Requires-Dist: ruff>=0.7; extra == "dev"
Dynamic: license-file

# abintegro

The runner SDK of ABIntegro: deterministic business
automation, built with AI and secured by code.

A runner is a small repository of **connectors** (typed clients for the systems a business uses)
and **tasks** (plain async Python that reads from one system and writes to another). This
package is everything else: the task model, policies and guardrails enforced outside the task's
code, credentials the task never sees, proposals for a person to approve, state, a durable
queue, an append-only audit log, embedded AI calls with a fixed output shape, and the HTTP
service a runner deploys as.

```
pip install abintegro
```

Python 3.13 or later.

## A task

```python
from abintegro import ctx, parameter, permit, task
from connectors import school, zoom
from connectors.zoom.client import UserCreate


@task(id="enrollment_to_zoom", title="Zoom Licences for New Enrolments")
async def enrollment_to_zoom() -> None:
    """Give every new student a licensed Zoom account."""
    for e in await school.enrollments.since(ctx.state.get("cursor")):
        spec = UserCreate(email=e.email, licences=[parameter("zoom_licence")])
        if permit("users.create_with_licences"):
            await zoom.users.create_with_licences(spec)
        else:
            ctx.suggest("zoom.users.create_with_licences", spec, key=str(e.id))
        ctx.state["cursor"] = e.created_at
```

- **No credentials in code.** A connector call is authenticated by the SDK from the tenant's
  secret; the task holds a client, never a key.
- **Writes are permitted or proposed.** `permit` asks the policy the business set; anything not
  permitted becomes a suggestion in the Inbox, with a before/after preview, for one person to
  accept or reject.
- **Deterministic and convergent.** One connector call is one business action that is safe to
  repeat; re-running a task repairs a partial failure. There are no steps to resume.
- **Guardrails outside the code.** Write, operation and token caps, execution windows,
  allowed domains and accounts, and "never delete" are checked by the SDK on every call, whatever the task does.
- **Every action is audited.** Reads, writes, proposals, decisions and AI calls are recorded in
  an append-only log.

`ctx.ai`, `ctx.decide`, `ctx.report`, `ctx.metric` and `ctx.lookup` add embedded AI with a fixed
output schema, yes/no and multiple-choice decisions, reports, dashboard figures and shared lookup
tables. The `abintegro_ai` package beside it holds the AI providers (Vertex AI, Gemini,
Anthropic, OpenAI and Langdock) behind one interface.

## The command line

Run from a runner repository, next to its `connectors/` and `tasks/`:

```
abintegro tasks                  # what is registered, and its trigger
abintegro run <task_id>          # execute one task now
abintegro tick                   # one drain: schedules, webhook events, the queue
abintegro suggestions            # proposed writes waiting on a person
abintegro accept <suggestion_id> # or reject
abintegro manifest build         # derive each task's declared operations
abintegro serve                  # the runner's HTTP service
```

A runner reads `ABINTEGRO_TENANT` and `ABINTEGRO_GCP_PROJECT` (or `GOOGLE_CLOUD_PROJECT`) to know
which tenant it is; it has no default. `--fixtures replay` runs every connector against its
recorded fixtures, with no network.

## Licence

Apache-2.0. A runner built on this SDK, its connectors and its tasks belong to whoever wrote them
and carry no copyleft obligation.
