marifai-harness 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- marifai_harness-0.3.0/.github/workflows/ci.yml +39 -0
- marifai_harness-0.3.0/.github/workflows/publish.yml +72 -0
- marifai_harness-0.3.0/.gitignore +35 -0
- marifai_harness-0.3.0/CHANGELOG.md +77 -0
- marifai_harness-0.3.0/LICENSE +21 -0
- marifai_harness-0.3.0/PKG-INFO +194 -0
- marifai_harness-0.3.0/README.md +147 -0
- marifai_harness-0.3.0/docs/architecture.md +21 -0
- marifai_harness-0.3.0/docs/contracts.md +94 -0
- marifai_harness-0.3.0/docs/handoff.md +75 -0
- marifai_harness-0.3.0/docs/learning-training.md +84 -0
- marifai_harness-0.3.0/docs/memory.md +98 -0
- marifai_harness-0.3.0/docs/native-reasoning.md +13 -0
- marifai_harness-0.3.0/docs/observability.md +22 -0
- marifai_harness-0.3.0/docs/providers.md +50 -0
- marifai_harness-0.3.0/docs/release.md +106 -0
- marifai_harness-0.3.0/docs/releases/0.3.0-provider-acceptance.md +32 -0
- marifai_harness-0.3.0/docs/validation.md +67 -0
- marifai_harness-0.3.0/examples/acceptance/anthropic.toml +38 -0
- marifai_harness-0.3.0/examples/acceptance/gemini.toml +38 -0
- marifai_harness-0.3.0/examples/acceptance/matrix.json +34 -0
- marifai_harness-0.3.0/examples/acceptance/ollama.toml +40 -0
- marifai_harness-0.3.0/examples/acceptance/openai.toml +38 -0
- marifai_harness-0.3.0/examples/acceptance/openrouter.toml +39 -0
- marifai_harness-0.3.0/examples/acceptance/together.toml +38 -0
- marifai_harness-0.3.0/examples/acceptance/xai.toml +41 -0
- marifai_harness-0.3.0/examples/agent_loop.py +10 -0
- marifai_harness-0.3.0/examples/coding_task.py +28 -0
- marifai_harness-0.3.0/examples/embedded_graph.py +38 -0
- marifai_harness-0.3.0/examples/marifai.toml +39 -0
- marifai_harness-0.3.0/examples/rag_memory.py +28 -0
- marifai_harness-0.3.0/examples/train_candidate.py +16 -0
- marifai_harness-0.3.0/pyproject.toml +63 -0
- marifai_harness-0.3.0/scripts/acceptance.py +246 -0
- marifai_harness-0.3.0/scripts/acceptance_matrix.py +172 -0
- marifai_harness-0.3.0/scripts/compare_providers.py +102 -0
- marifai_harness-0.3.0/scripts/evaluate.py +259 -0
- marifai_harness-0.3.0/scripts/linux_package_acceptance.py +44 -0
- marifai_harness-0.3.0/scripts/package_evidence.py +82 -0
- marifai_harness-0.3.0/scripts/package_smoke.py +105 -0
- marifai_harness-0.3.0/scripts/publication_gate.py +177 -0
- marifai_harness-0.3.0/src/marifai/__init__.py +16 -0
- marifai_harness-0.3.0/src/marifai/cli.py +252 -0
- marifai_harness-0.3.0/src/marifai/command.py +10 -0
- marifai_harness-0.3.0/src/marifai/contracts.py +81 -0
- marifai_harness-0.3.0/src/marifai/errors.py +79 -0
- marifai_harness-0.3.0/src/marifai/execution/__init__.py +1 -0
- marifai_harness-0.3.0/src/marifai/execution/budget.py +242 -0
- marifai_harness-0.3.0/src/marifai/execution/context.py +72 -0
- marifai_harness-0.3.0/src/marifai/execution/effort.py +9 -0
- marifai_harness-0.3.0/src/marifai/execution/harness.py +270 -0
- marifai_harness-0.3.0/src/marifai/execution/native.py +113 -0
- marifai_harness-0.3.0/src/marifai/execution/runtime.py +212 -0
- marifai_harness-0.3.0/src/marifai/execution/tools.py +253 -0
- marifai_harness-0.3.0/src/marifai/foundation/__init__.py +1 -0
- marifai_harness-0.3.0/src/marifai/foundation/auth.py +90 -0
- marifai_harness-0.3.0/src/marifai/foundation/bootstrap.py +79 -0
- marifai_harness-0.3.0/src/marifai/foundation/config.py +162 -0
- marifai_harness-0.3.0/src/marifai/foundation/events.py +22 -0
- marifai_harness-0.3.0/src/marifai/foundation/logging.py +116 -0
- marifai_harness-0.3.0/src/marifai/foundation/policy.py +118 -0
- marifai_harness-0.3.0/src/marifai/learning/__init__.py +2 -0
- marifai_harness-0.3.0/src/marifai/learning/service.py +289 -0
- marifai_harness-0.3.0/src/marifai/memory/__init__.py +2 -0
- marifai_harness-0.3.0/src/marifai/memory/contracts.py +21 -0
- marifai_harness-0.3.0/src/marifai/memory/embedding.py +86 -0
- marifai_harness-0.3.0/src/marifai/memory/metering.py +149 -0
- marifai_harness-0.3.0/src/marifai/memory/sqlite.py +176 -0
- marifai_harness-0.3.0/src/marifai/memory/tools.py +76 -0
- marifai_harness-0.3.0/src/marifai/memory/types.py +37 -0
- marifai_harness-0.3.0/src/marifai/models/__init__.py +1 -0
- marifai_harness-0.3.0/src/marifai/models/models.py +177 -0
- marifai_harness-0.3.0/src/marifai/models/native_providers.py +368 -0
- marifai_harness-0.3.0/src/marifai/models/providers.py +267 -0
- marifai_harness-0.3.0/src/marifai/models/reasoning.py +17 -0
- marifai_harness-0.3.0/src/marifai/models/router.py +88 -0
- marifai_harness-0.3.0/src/marifai/orchestration/__init__.py +1 -0
- marifai_harness-0.3.0/src/marifai/orchestration/orchestrator.py +348 -0
- marifai_harness-0.3.0/src/marifai/orchestration/preflight.py +110 -0
- marifai_harness-0.3.0/src/marifai/orchestration/workspaces.py +122 -0
- marifai_harness-0.3.0/src/marifai/planning.py +97 -0
- marifai_harness-0.3.0/src/marifai/py.typed +1 -0
- marifai_harness-0.3.0/src/marifai/sdk.py +497 -0
- marifai_harness-0.3.0/src/marifai/training/__init__.py +5 -0
- marifai_harness-0.3.0/src/marifai/training/backends.py +99 -0
- marifai_harness-0.3.0/src/marifai/training/contracts.py +60 -0
- marifai_harness-0.3.0/src/marifai/training/service.py +260 -0
- marifai_harness-0.3.0/src/marifai/training/worker.py +103 -0
- marifai_harness-0.3.0/src/marifai/types.py +287 -0
- marifai_harness-0.3.0/tests/conftest.py +45 -0
- marifai_harness-0.3.0/tests/fixtures/coding-v1.json +18 -0
- marifai_harness-0.3.0/tests/fixtures/coding-v2.json +18 -0
- marifai_harness-0.3.0/tests/helpers/crash_runner.py +44 -0
- marifai_harness-0.3.0/tests/test_acceptance_campaign.py +248 -0
- marifai_harness-0.3.0/tests/test_archon.py +128 -0
- marifai_harness-0.3.0/tests/test_archon_memory.py +57 -0
- marifai_harness-0.3.0/tests/test_bootstrap.py +41 -0
- marifai_harness-0.3.0/tests/test_catalog_metadata.py +108 -0
- marifai_harness-0.3.0/tests/test_cli_recovery.py +157 -0
- marifai_harness-0.3.0/tests/test_crash_process.py +44 -0
- marifai_harness-0.3.0/tests/test_embedding_budget.py +222 -0
- marifai_harness-0.3.0/tests/test_funding_recovery.py +147 -0
- marifai_harness-0.3.0/tests/test_kernel.py +136 -0
- marifai_harness-0.3.0/tests/test_learning.py +70 -0
- marifai_harness-0.3.0/tests/test_learning_acceptance.py +112 -0
- marifai_harness-0.3.0/tests/test_live.py +45 -0
- marifai_harness-0.3.0/tests/test_local_config_auth.py +46 -0
- marifai_harness-0.3.0/tests/test_memory.py +140 -0
- marifai_harness-0.3.0/tests/test_native_providers.py +103 -0
- marifai_harness-0.3.0/tests/test_native_reasoning.py +231 -0
- marifai_harness-0.3.0/tests/test_plan_funding.py +134 -0
- marifai_harness-0.3.0/tests/test_planning.py +96 -0
- marifai_harness-0.3.0/tests/test_provider_acceptance.py +243 -0
- marifai_harness-0.3.0/tests/test_providers.py +88 -0
- marifai_harness-0.3.0/tests/test_publication_gate.py +349 -0
- marifai_harness-0.3.0/tests/test_recovery.py +122 -0
- marifai_harness-0.3.0/tests/test_release_metadata.py +51 -0
- marifai_harness-0.3.0/tests/test_resume_constraints.py +57 -0
- marifai_harness-0.3.0/tests/test_runtime_scope.py +22 -0
- marifai_harness-0.3.0/tests/test_safe_tools.py +52 -0
- marifai_harness-0.3.0/tests/test_traces.py +100 -0
- marifai_harness-0.3.0/tests/test_training.py +140 -0
- marifai_harness-0.3.0/tests/test_training_recovery.py +73 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# .github/workflows/ci.yml
|
|
2
|
+
name: Python SDK and SQLite acceptance
|
|
3
|
+
on: [push, pull_request, workflow_dispatch]
|
|
4
|
+
permissions:
|
|
5
|
+
contents: read
|
|
6
|
+
jobs:
|
|
7
|
+
local:
|
|
8
|
+
strategy:
|
|
9
|
+
fail-fast: false
|
|
10
|
+
matrix:
|
|
11
|
+
os: [windows-latest, ubuntu-latest, macos-latest]
|
|
12
|
+
python: ['3.12', '3.13', '3.14']
|
|
13
|
+
runs-on: ${{ matrix.os }}
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: ${{ matrix.python }}
|
|
19
|
+
- run: python -m pip install -e ".[dev]"
|
|
20
|
+
- run: python -m ruff check src tests scripts examples
|
|
21
|
+
- run: python -m pytest -q --junitxml=dist/evidence/tests.xml
|
|
22
|
+
- run: python -m build
|
|
23
|
+
- shell: pwsh
|
|
24
|
+
run: |
|
|
25
|
+
# Installed package acceptance in an independent environment.
|
|
26
|
+
python -m venv .package-consumer
|
|
27
|
+
$python = if ($IsWindows) { '.package-consumer/Scripts/python.exe' } else { '.package-consumer/bin/python' }
|
|
28
|
+
& $python -m pip install (Get-Item dist/*.whl).FullName
|
|
29
|
+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
30
|
+
& $python scripts/package_smoke.py .cache/consumer | Tee-Object -FilePath dist/evidence/consumer.json
|
|
31
|
+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
32
|
+
& $python -m marifai.cli --help
|
|
33
|
+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
34
|
+
& $python tests/test_cli_recovery.py | Tee-Object -FilePath dist/evidence/cli-recovery.json
|
|
35
|
+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
36
|
+
- uses: actions/upload-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: package-${{ matrix.os }}-${{ matrix.python }}
|
|
39
|
+
path: dist/*
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# .github/workflows/publish.yml
|
|
2
|
+
name: Approved PyPI publication
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
publish:
|
|
7
|
+
description: Publish after ownership, license and release evidence review
|
|
8
|
+
type: boolean
|
|
9
|
+
default: false
|
|
10
|
+
approval_json:
|
|
11
|
+
description: Maintainer approval JSON for this version (required only when publishing)
|
|
12
|
+
type: string
|
|
13
|
+
default: ''
|
|
14
|
+
evidence_json:
|
|
15
|
+
description: Exact artifact evidence with seven-provider acceptance or an explicit owner waiver
|
|
16
|
+
type: string
|
|
17
|
+
default: ''
|
|
18
|
+
validated_build_run:
|
|
19
|
+
description: Successful build-only run containing the exact tested release-distributions artifact
|
|
20
|
+
type: string
|
|
21
|
+
default: ''
|
|
22
|
+
permissions:
|
|
23
|
+
contents: read
|
|
24
|
+
jobs:
|
|
25
|
+
build:
|
|
26
|
+
if: ${{ !inputs.publish }}
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
- uses: actions/setup-python@v5
|
|
31
|
+
with:
|
|
32
|
+
python-version: '3.12'
|
|
33
|
+
- run: python -m pip install build twine
|
|
34
|
+
- run: python -m build
|
|
35
|
+
- run: python -m twine check dist/*
|
|
36
|
+
- uses: actions/upload-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: release-distributions
|
|
39
|
+
path: dist/*
|
|
40
|
+
publish:
|
|
41
|
+
if: inputs.publish
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
environment: pypi
|
|
44
|
+
permissions:
|
|
45
|
+
contents: read
|
|
46
|
+
actions: read
|
|
47
|
+
id-token: write
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/checkout@v4
|
|
50
|
+
- uses: actions/setup-python@v5
|
|
51
|
+
with:
|
|
52
|
+
python-version: '3.12'
|
|
53
|
+
- name: Require an existing successful build of this commit
|
|
54
|
+
env:
|
|
55
|
+
GH_TOKEN: ${{ github.token }}
|
|
56
|
+
VALIDATED_BUILD_RUN: ${{ inputs.validated_build_run }}
|
|
57
|
+
RELEASE_COMMIT: ${{ github.sha }}
|
|
58
|
+
run: |
|
|
59
|
+
# .github/workflows/publish.yml
|
|
60
|
+
python scripts/publication_gate.py --validate-build-run "$VALIDATED_BUILD_RUN" --expected-commit "$RELEASE_COMMIT"
|
|
61
|
+
- uses: actions/download-artifact@v4
|
|
62
|
+
with:
|
|
63
|
+
name: release-distributions
|
|
64
|
+
path: dist/
|
|
65
|
+
run-id: ${{ inputs.validated_build_run }}
|
|
66
|
+
github-token: ${{ github.token }}
|
|
67
|
+
- name: Require release-owner metadata and verified artifacts
|
|
68
|
+
env:
|
|
69
|
+
RELEASE_APPROVAL_JSON: ${{ inputs.approval_json }}
|
|
70
|
+
RELEASE_EVIDENCE_JSON: ${{ inputs.evidence_json }}
|
|
71
|
+
run: python scripts/publication_gate.py --approval-json "$RELEASE_APPROVAL_JSON" --evidence-json "$RELEASE_EVIDENCE_JSON"
|
|
72
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# .gitignore
|
|
2
|
+
.venv/
|
|
3
|
+
.cache/
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.pyc
|
|
6
|
+
.pytest_cache/
|
|
7
|
+
.ruff_cache/
|
|
8
|
+
.marifai/
|
|
9
|
+
dist/
|
|
10
|
+
*.egg-info/
|
|
11
|
+
.env
|
|
12
|
+
.env.*
|
|
13
|
+
!.env.example
|
|
14
|
+
/marifai.toml
|
|
15
|
+
/release-approval.json
|
|
16
|
+
*.sqlite3
|
|
17
|
+
*.sqlite3-wal
|
|
18
|
+
*.sqlite3-shm
|
|
19
|
+
|
|
20
|
+
# Retained locally from the earlier distributed scope; excluded from this SDK repository.
|
|
21
|
+
/src/marifai/cloud/
|
|
22
|
+
/compose.integration.yml
|
|
23
|
+
/.dockerignore
|
|
24
|
+
/docs/integration.md
|
|
25
|
+
/docs/openapi.json
|
|
26
|
+
/scripts/integration_*
|
|
27
|
+
/scripts/export_openapi.py
|
|
28
|
+
/scripts/release_evidence.py
|
|
29
|
+
/examples/control_plane.py
|
|
30
|
+
/examples/remote_worker.py
|
|
31
|
+
/tests/test_cloud*
|
|
32
|
+
/tests/test_distributed*
|
|
33
|
+
/tests/test_postgres*
|
|
34
|
+
/tests/integration/
|
|
35
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.3.0 — PyPI-only scope update
|
|
4
|
+
|
|
5
|
+
- Declare MIT licensing with Sultani Investments author/maintainer metadata and include the license
|
|
6
|
+
in both release distributions.
|
|
7
|
+
- Add installed-wheel acceptance for the seven explicitly configured services in
|
|
8
|
+
`examples/acceptance/matrix.json`, retaining the legacy two-provider command.
|
|
9
|
+
- Persist campaign reservations across interruptions and retries, with a $5 total inference cap,
|
|
10
|
+
$4 first-attempt allowance, $1 retry allowance and retained uncertain charges.
|
|
11
|
+
- Bind provider evidence to the artifact, configuration, fixture and evaluator; require all seven
|
|
12
|
+
services and exact artifact/license checks before the guarded publication workflow can upload.
|
|
13
|
+
- Add the version-2 coding fixture's exact output and first-line path-comment checks, preserving
|
|
14
|
+
frozen verification and restricted candidate write scope.
|
|
15
|
+
- Freeze coding acceptance checkers from their fixture manifest and restrict candidate writes
|
|
16
|
+
to declared implementation paths, so editing a workspace checker cannot manufacture a pass.
|
|
17
|
+
- Make provider acceptance fail closed on unverified work, stale reports, failed child processes
|
|
18
|
+
and missing required evidence; bind reports to each invocation and exact fixture.
|
|
19
|
+
- Complete the explicit maintainer-approval input for release CI, preserve publish-job checkout
|
|
20
|
+
permissions, and reject malformed, stale or incomplete publication approvals.
|
|
21
|
+
- Wire SDK/training observability to a separate append-only SQLite trace store or injected sink,
|
|
22
|
+
with redaction, cursor replay, duplicate suppression and delivery-failure isolation.
|
|
23
|
+
- New runtime databases omit legacy tenancy/remote-job tables; existing tables are preserved.
|
|
24
|
+
- Native Anthropic/Gemini reasoning controls and opaque continuation state, preserved through
|
|
25
|
+
approval/restart with deployment-bound retries and excluded from traces and training datasets.
|
|
26
|
+
- Installed CLI kill/resume acceptance on Windows and Linux preserves confirmed tool work and uncertain charges.
|
|
27
|
+
- Meter configured remote/paid embeddings with durable application caps, funded run-tool envelopes,
|
|
28
|
+
pricing provenance, privacy/provider-scope enforcement, ambiguous-charge retention and explicit reconciliation.
|
|
29
|
+
|
|
30
|
+
- First-party SQLite documents, stable chunks, FTS5/cosine retrieval, source references and policy-gated memory tools.
|
|
31
|
+
- Configured local embeddings, memory context assembly, CLI ingest/search and a runnable RAG example.
|
|
32
|
+
- Native Anthropic/Gemini protocols, normalized invoke/stream, optional provider extras and configurable auth headers.
|
|
33
|
+
- Exact test-command allowlists, bounded HTTP reads, artifact tools and typed policy limits.
|
|
34
|
+
- YAML configuration and a local credential vault with optional encryption at rest.
|
|
35
|
+
- Funded Harness assembly, configurable Archon roles, an effort-based review path and explicit pause/resume.
|
|
36
|
+
- CLI included in the base package; cloud adapters excluded from distributions and cloud service jobs removed from CI.
|
|
37
|
+
- Historical implementation entries below describe earlier scope and do not expand the current PyPI product.
|
|
38
|
+
|
|
39
|
+
## 0.3.0 — embeddable SDK
|
|
40
|
+
|
|
41
|
+
- General task graphs and registered agents run without Git; coding remains an explicit strategy.
|
|
42
|
+
- Persistent catalog refresh, metadata provenance/freshness, pinned proxy deployments and passive observations.
|
|
43
|
+
- Prepared plans, complete-envelope funding, one affordable alternative, exact shortfalls, refunds and recovery.
|
|
44
|
+
- Optional authorized dataset exports, grouped splits, logistic shadow routing and evidence-bound activation.
|
|
45
|
+
- Optional native LoRA and Hugging Face Jobs training with durable intents, cancellation and candidate artifacts.
|
|
46
|
+
- Base installation excludes CLI/training dependencies. CLI uses the same catalog and planning APIs.
|
|
47
|
+
- Additive SQLite/PostgreSQL record migration; older persisted coding runs retain their strategy.
|
|
48
|
+
- Confirmed model responses survive interruption before checkpoint handoff without duplicate calls.
|
|
49
|
+
- Resume rechecks funding, retains uncertain charges and completed work, and resumes missing verification.
|
|
50
|
+
- `Run.resume` and `Marifai.resume` accept optional narrower policies and lower limits under the
|
|
51
|
+
executor lease. Immediate cancellation before driver startup is durable and releases the lease.
|
|
52
|
+
- Context/output limits now default to unknown. Routing requires explicit or discovered bounds.
|
|
53
|
+
Existing configurations that relied on implicit limits must declare the actual deployment limits.
|
|
54
|
+
- Unmeasured health/reliability/latency remain unknown; failed observations survive restart and
|
|
55
|
+
explicit configuration takes precedence over passive metadata.
|
|
56
|
+
- Coordinator phase names are reserved graph IDs; duplicate criterion/phase identities are rejected.
|
|
57
|
+
- Routing evaluation requires equal task requirements, authority and limits in held-out pairs;
|
|
58
|
+
dataset readers enforce disjoint groups and complete tool-call/result sequences.
|
|
59
|
+
- Training backend contract version 2 adds identity-checked reconciliation. Ambiguous cancellation
|
|
60
|
+
remains blocked; completed hosted artifacts reference a private repository's immutable revision.
|
|
61
|
+
- Release artifacts and CI publication workflow are prepared; publication requires ownership, licensing and approval.
|
|
62
|
+
|
|
63
|
+
## 0.2.0 — initial implementation
|
|
64
|
+
|
|
65
|
+
- Added async Python SDK and CLI, OpenAI-compatible/Ollama streaming adapters, deterministic routing,
|
|
66
|
+
four autonomy modes, custom/native tools, atomic resource reservations, durable SQLite runs,
|
|
67
|
+
approval/recovery/cancellation, and artifact lineage.
|
|
68
|
+
- Added bounded Archon coding graphs, separate Git worktrees, deterministic verification,
|
|
69
|
+
independent review, correction, and patch delivery preserving the source checkout.
|
|
70
|
+
- Added optional PostgreSQL runtime, authenticated REST/SSE control plane, worker fencing,
|
|
71
|
+
tenant budgets, worker affinity and S3-compatible artifact uploads.
|
|
72
|
+
- Added credential-free first-run configuration with `init` and `doctor`, plus disposable
|
|
73
|
+
PostgreSQL/S3 services and a remote-worker acceptance test over actual HTTP connections.
|
|
74
|
+
- Added deterministic acceptance tests, explicit live integration gates, cross-platform CI,
|
|
75
|
+
examples and package build configuration. This version number does not imply production
|
|
76
|
+
acceptance of integrations whose live gates have not run.
|
|
77
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sultani Investments
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: marifai-harness
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Embeddable agent execution, orchestration, subagents and funded resource governance
|
|
5
|
+
Project-URL: Repository, https://github.com/sultani-investments/marifai-harness-sdk
|
|
6
|
+
Author: Sultani Investments
|
|
7
|
+
Maintainer: Sultani Investments
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Python: >=3.12
|
|
11
|
+
Requires-Dist: httpx<1,>=0.28
|
|
12
|
+
Requires-Dist: jsonschema<5,>=4.23
|
|
13
|
+
Requires-Dist: pydantic<3,>=2.10
|
|
14
|
+
Requires-Dist: typer<1,>=0.15
|
|
15
|
+
Provides-Extra: anthropic
|
|
16
|
+
Provides-Extra: cli
|
|
17
|
+
Requires-Dist: typer<1,>=0.15; extra == 'cli'
|
|
18
|
+
Provides-Extra: credentials
|
|
19
|
+
Requires-Dist: cryptography>=44; extra == 'credentials'
|
|
20
|
+
Requires-Dist: keyring>=25; extra == 'credentials'
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
23
|
+
Requires-Dist: cryptography>=44; extra == 'dev'
|
|
24
|
+
Requires-Dist: pytest-asyncio>=0.25; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
26
|
+
Requires-Dist: pyyaml<7,>=6; extra == 'dev'
|
|
27
|
+
Requires-Dist: ruff>=0.9; extra == 'dev'
|
|
28
|
+
Provides-Extra: gemini
|
|
29
|
+
Provides-Extra: learning
|
|
30
|
+
Requires-Dist: scikit-learn>=1.6; extra == 'learning'
|
|
31
|
+
Provides-Extra: ollama
|
|
32
|
+
Provides-Extra: openai
|
|
33
|
+
Provides-Extra: openrouter
|
|
34
|
+
Provides-Extra: togetherai
|
|
35
|
+
Provides-Extra: training-hosted
|
|
36
|
+
Requires-Dist: huggingface-hub<2,>=1.33; extra == 'training-hosted'
|
|
37
|
+
Provides-Extra: training-local
|
|
38
|
+
Requires-Dist: datasets<6,>=5; extra == 'training-local'
|
|
39
|
+
Requires-Dist: peft<1,>=0.21; extra == 'training-local'
|
|
40
|
+
Requires-Dist: torch<3,>=2.14; extra == 'training-local'
|
|
41
|
+
Requires-Dist: transformers<6,>=5.17; extra == 'training-local'
|
|
42
|
+
Requires-Dist: trl<2,>=1.14; extra == 'training-local'
|
|
43
|
+
Provides-Extra: xai
|
|
44
|
+
Provides-Extra: yaml
|
|
45
|
+
Requires-Dist: pyyaml<7,>=6; extra == 'yaml'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# Marifai Harness
|
|
49
|
+
|
|
50
|
+
A Python SDK for embedding durable agents, orchestration and bounded subagents in other applications.
|
|
51
|
+
Distribution: `marifai-harness`. Public import: `marifai`. Python 3.12 or newer.
|
|
52
|
+
|
|
53
|
+
The consuming application owns its interface, business logic, hosting and deployment. The harness
|
|
54
|
+
and Archon share provider contracts, policy, a durable SQLite runtime, resource accounting, registered tools,
|
|
55
|
+
and first-party SQLite RAG memory. This distribution has no frontend, hosted control plane or organization tenancy.
|
|
56
|
+
General graphs run without Git. The explicit coding strategy adds snapshots, writer worktrees,
|
|
57
|
+
patch integration and deterministic checks. The core needs no server, Docker or cloud account.
|
|
58
|
+
|
|
59
|
+
Built-in tools provide scoped file I/O, allow-listed HTTP reads, artifacts, and memory. Commands require
|
|
60
|
+
an exact argument-list entry in `Policy.test_commands`; arbitrary shell execution is not available.
|
|
61
|
+
Approved test programs and custom Python tools still run with the application's host privileges.
|
|
62
|
+
|
|
63
|
+
## Install and configure
|
|
64
|
+
|
|
65
|
+
The PyPI distribution is `marifai-harness`; 0.3.0 artifacts are prepared locally but have not been
|
|
66
|
+
published. Install the wheel with `python -m pip install dist/marifai_harness-0.3.0-py3-none-any.whl`
|
|
67
|
+
or use `python -m pip install .` from this checkout. After publication, applications can use
|
|
68
|
+
`python -m pip install marifai-harness`. For development use `python -m pip install -e ".[dev]"`.
|
|
69
|
+
|
|
70
|
+
The CLI is a developer utility included in the base package. Run
|
|
71
|
+
`marifai init` to create `marifai.toml` without credentials or an implicit provider. Run
|
|
72
|
+
`marifai doctor` to inspect configuration readiness. The CLI automatically reads `marifai.toml`
|
|
73
|
+
from its current directory, or an explicit `--config` path. Existing configuration is never overwritten.
|
|
74
|
+
To write a selected deployment directly, `init` accepts `--kind`, `--base-url`, `--model`,
|
|
75
|
+
`--credential-env`, repeated `--capability` flags, prices, and a run USD cap. Secrets remain in the
|
|
76
|
+
referenced environment variable. `doctor --connect` performs model discovery, never inference.
|
|
77
|
+
If the scaffold already exists, edit it or use `init --output another-config.toml` with the selected settings.
|
|
78
|
+
Copy `examples/marifai.toml` to your own configuration and explicitly select your endpoints,
|
|
79
|
+
deployments, capabilities, and prices. Credentials use `env:VARIABLE`, `vault:NAME`, or `keyring:NAME` references.
|
|
80
|
+
No endpoint, model, cloud service, or local inference process is enabled automatically.
|
|
81
|
+
|
|
82
|
+
Run `marifai --help`, then `marifai models --config your-config.toml` to inspect your catalog.
|
|
83
|
+
`marifai run "Explain this repository" --config your-config.toml` starts a single agent.
|
|
84
|
+
Add `--archon --strategy coding` for the coding coordinator and `--test '["python","-m","pytest"]'` for explicit
|
|
85
|
+
deterministic acceptance. `--usd 1.00` sets a run monetary cap; paid deployments require one.
|
|
86
|
+
|
|
87
|
+
Autonomy values are `approve_writes`, `scoped`, `broad`, and `autonomous`. The default is `scoped`.
|
|
88
|
+
An autonomy setting never creates missing grants. Configure broader grants through the SDK policy.
|
|
89
|
+
|
|
90
|
+
Use `marifai inspect RUN_ID`, `marifai approve RUN_ID APPROVAL_ID`, and `marifai resume RUN_ID`
|
|
91
|
+
for paused runs. `marifai cancel RUN_ID` requests cancellation. CLI processes wait for execution;
|
|
92
|
+
interrupting them leaves durable checkpoints for subsequent inspection and recovery.
|
|
93
|
+
|
|
94
|
+
## Python SDK
|
|
95
|
+
|
|
96
|
+
See `examples/embedded_graph.py` for custom tools and non-Git subagents, `examples/agent_loop.py`
|
|
97
|
+
for an application-owned loop, and `examples/coding_task.py` for explicit coding execution.
|
|
98
|
+
The supported application surface is `Marifai` plus `Agent`, `Archon`, `Task`, `Tool`, `Policy`, and `Run`.
|
|
99
|
+
Supporting graph/configuration/contract types are documented in `docs/contracts.md`; internal modules
|
|
100
|
+
are not a public compatibility promise. Existing root aliases for graph/plan types remain available
|
|
101
|
+
for migration. Extension protocols have their own version number.
|
|
102
|
+
|
|
103
|
+
`Run.wait()` returns an explicit completed/partial/blocked/failed/cancelled result. A completed
|
|
104
|
+
unconstrained response is not proof of correctness: `verified` is true only when declared checks
|
|
105
|
+
pass. Required semantic criteria stay unverified until an external acceptance mechanism exists.
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
# examples/prepare_usage.py (illustrative caller fragment)
|
|
109
|
+
from marifai import Agent, Marifai, PlanNode, Policy, Task, TaskGraph
|
|
110
|
+
from marifai.foundation.config import Config
|
|
111
|
+
|
|
112
|
+
async def execute(config_path, workspace):
|
|
113
|
+
async with Marifai(Config.load(config_path)) as client:
|
|
114
|
+
task = Task(instructions="Summarize the supplied material")
|
|
115
|
+
graph = TaskGraph(tasks=[PlanNode(id="summary", instructions=task.instructions,
|
|
116
|
+
agent="summarizer", model_calls=2, tool_calls=0)])
|
|
117
|
+
run = await client.archon.prepare(task, graph=graph,
|
|
118
|
+
agents={"summarizer": Agent(name="summarizer", tools=[])},
|
|
119
|
+
policy=Policy(workspace=workspace))
|
|
120
|
+
report = run.plan()
|
|
121
|
+
if report and report.status == "funded":
|
|
122
|
+
await run.resume()
|
|
123
|
+
return await run.wait()
|
|
124
|
+
return report
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Prepare persists the task graph and complete resource envelope before dispatching implementation
|
|
128
|
+
agents. Planning inference, if needed, uses the same ledger. Deployment details, capability evidence,
|
|
129
|
+
pricing source/version, review/retry/correction allowances and precise shortfalls remain inspectable
|
|
130
|
+
after restart. An unaffordable preferred plan gets exactly one least-cost eligible alternative.
|
|
131
|
+
Neither checks nor authority are weakened. Time predictions are estimates; deadlines remain enforced.
|
|
132
|
+
|
|
133
|
+
`await client.refresh_catalog()` refreshes explicitly configured endpoints and persists observations.
|
|
134
|
+
It never enables newly discovered models. Inspect `client.catalog.snapshot`, `.history()` and
|
|
135
|
+
`.observations()`. Discovered capabilities/prices expire after 24 hours by default; configuration
|
|
136
|
+
overrides need price provenance. Generic OpenAI-compatible, Ollama and explicitly selected OpenRouter
|
|
137
|
+
metadata profiles are supported. OpenRouter financial admission requires a pinned upstream.
|
|
138
|
+
|
|
139
|
+
Native Anthropic and Gemini, OpenAI-compatible profiles and Ollama use the same Harness.
|
|
140
|
+
See [provider configuration](docs/providers.md). The base import starts no process and contacts no
|
|
141
|
+
provider. Applications supply endpoints, models, credentials and limits explicitly.
|
|
142
|
+
|
|
143
|
+
## Built-in memory
|
|
144
|
+
|
|
145
|
+
Use `await client.memory.upsert_document(id, text, source=...)` and `await client.memory.search(query)`
|
|
146
|
+
for durable SQLite retrieval. Keyword search needs no embeddings endpoint. A configured
|
|
147
|
+
OpenAI-compatible embedder enables hybrid FTS/vector retrieval, with explicit pricing and caps for
|
|
148
|
+
remote or paid endpoints. Set `Task(memory_query="...")` to
|
|
149
|
+
retrieve through policy and the tool budget before inference. Agent memory writes require an explicit
|
|
150
|
+
grant and the selected approval rules. See [memory usage](docs/memory.md) and [the runnable example](examples/rag_memory.py).
|
|
151
|
+
|
|
152
|
+
The CLI exposes `marifai memory upsert notes.txt --id notes`, `marifai memory search "query"`, and
|
|
153
|
+
`marifai run "Summarize" --memory-query "query"`. It uses the same SDK and configured SQLite store.
|
|
154
|
+
|
|
155
|
+
## State, cost, and privacy
|
|
156
|
+
|
|
157
|
+
Local state defaults to `.marifai/`: SQLite runtime and memory, immutable artifacts, and managed coding
|
|
158
|
+
worktrees. Preserve that directory to resume runs and inspect delivered patches. Runtime checkpoints
|
|
159
|
+
necessarily contain task instructions, conversation, tool arguments/results, and generated code.
|
|
160
|
+
Protect it like the source repository. Event traces omit model content unless `retain_content=true`;
|
|
161
|
+
credentials are redacted from diagnostic events. There is no automatic training-data upload.
|
|
162
|
+
|
|
163
|
+
Resource reservations share a parent run ledger across agents. Unknown/ambiguous provider charges
|
|
164
|
+
remain reserved. Provider-reported cost is used when available; usage multiplied by configured
|
|
165
|
+
prices remains labeled an estimate. Unpriced remote deployments and unpriced deployments under
|
|
166
|
+
a strict monetary cap cannot be routed. Local unpriced work still consumes call/token/time limits.
|
|
167
|
+
|
|
168
|
+
Elapsed wall time includes approval waits and downtime. A run that has exhausted its configured
|
|
169
|
+
wall-time cap cannot resume work; create a new run with a deliberately chosen limit.
|
|
170
|
+
|
|
171
|
+
Git worktree metadata is shared with the source repository. Baseline snapshots use temporary
|
|
172
|
+
indexes and detached commits; the original index, branch and working files are preserved. Only
|
|
173
|
+
explicitly selected untracked files enter the baseline. Completed worktrees remain available for
|
|
174
|
+
review; there is no automatic cleanup or publishing.
|
|
175
|
+
|
|
176
|
+
## Verification
|
|
177
|
+
|
|
178
|
+
Run `python -m pytest` and `python -m build`. Tests use deterministic scripted providers and mock
|
|
179
|
+
HTTP streams; live-provider checks are separate, opt-in tests. Windows and Linux-container suites
|
|
180
|
+
have local evidence; the CI matrix defines additional platform checks. See `docs/validation.md` for current evidence
|
|
181
|
+
and limits, and `docs/architecture.md` for runtime boundaries.
|
|
182
|
+
Cloud adapters are excluded from the wheel and source distribution. No cloud services are needed
|
|
183
|
+
to run the package or its local acceptance checks.
|
|
184
|
+
|
|
185
|
+
## 0.3.0 provider acceptance
|
|
186
|
+
|
|
187
|
+
The maintainer explicitly waived live-provider acceptance for this release. Package, license,
|
|
188
|
+
installed SDK smoke, and Windows/macOS/Linux checks remain required. Seven-service live acceptance
|
|
189
|
+
has not passed: an earlier wheel passed Anthropic; OpenAI, Ollama, xAI, and Together did not complete
|
|
190
|
+
all acceptance gates, and Gemini/OpenRouter credentials were unavailable. One Together operation
|
|
191
|
+
retains an unresolved usage reservation. These historical results do not establish live acceptance
|
|
192
|
+
of the published wheel or compatibility with every model. See the
|
|
193
|
+
[complete provider acceptance disclosure](https://github.com/sultani-investments/marifai-harness-sdk/blob/main/docs/releases/0.3.0-provider-acceptance.md).
|
|
194
|
+
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Marifai Harness
|
|
2
|
+
|
|
3
|
+
A Python SDK for embedding durable agents, orchestration and bounded subagents in other applications.
|
|
4
|
+
Distribution: `marifai-harness`. Public import: `marifai`. Python 3.12 or newer.
|
|
5
|
+
|
|
6
|
+
The consuming application owns its interface, business logic, hosting and deployment. The harness
|
|
7
|
+
and Archon share provider contracts, policy, a durable SQLite runtime, resource accounting, registered tools,
|
|
8
|
+
and first-party SQLite RAG memory. This distribution has no frontend, hosted control plane or organization tenancy.
|
|
9
|
+
General graphs run without Git. The explicit coding strategy adds snapshots, writer worktrees,
|
|
10
|
+
patch integration and deterministic checks. The core needs no server, Docker or cloud account.
|
|
11
|
+
|
|
12
|
+
Built-in tools provide scoped file I/O, allow-listed HTTP reads, artifacts, and memory. Commands require
|
|
13
|
+
an exact argument-list entry in `Policy.test_commands`; arbitrary shell execution is not available.
|
|
14
|
+
Approved test programs and custom Python tools still run with the application's host privileges.
|
|
15
|
+
|
|
16
|
+
## Install and configure
|
|
17
|
+
|
|
18
|
+
The PyPI distribution is `marifai-harness`; 0.3.0 artifacts are prepared locally but have not been
|
|
19
|
+
published. Install the wheel with `python -m pip install dist/marifai_harness-0.3.0-py3-none-any.whl`
|
|
20
|
+
or use `python -m pip install .` from this checkout. After publication, applications can use
|
|
21
|
+
`python -m pip install marifai-harness`. For development use `python -m pip install -e ".[dev]"`.
|
|
22
|
+
|
|
23
|
+
The CLI is a developer utility included in the base package. Run
|
|
24
|
+
`marifai init` to create `marifai.toml` without credentials or an implicit provider. Run
|
|
25
|
+
`marifai doctor` to inspect configuration readiness. The CLI automatically reads `marifai.toml`
|
|
26
|
+
from its current directory, or an explicit `--config` path. Existing configuration is never overwritten.
|
|
27
|
+
To write a selected deployment directly, `init` accepts `--kind`, `--base-url`, `--model`,
|
|
28
|
+
`--credential-env`, repeated `--capability` flags, prices, and a run USD cap. Secrets remain in the
|
|
29
|
+
referenced environment variable. `doctor --connect` performs model discovery, never inference.
|
|
30
|
+
If the scaffold already exists, edit it or use `init --output another-config.toml` with the selected settings.
|
|
31
|
+
Copy `examples/marifai.toml` to your own configuration and explicitly select your endpoints,
|
|
32
|
+
deployments, capabilities, and prices. Credentials use `env:VARIABLE`, `vault:NAME`, or `keyring:NAME` references.
|
|
33
|
+
No endpoint, model, cloud service, or local inference process is enabled automatically.
|
|
34
|
+
|
|
35
|
+
Run `marifai --help`, then `marifai models --config your-config.toml` to inspect your catalog.
|
|
36
|
+
`marifai run "Explain this repository" --config your-config.toml` starts a single agent.
|
|
37
|
+
Add `--archon --strategy coding` for the coding coordinator and `--test '["python","-m","pytest"]'` for explicit
|
|
38
|
+
deterministic acceptance. `--usd 1.00` sets a run monetary cap; paid deployments require one.
|
|
39
|
+
|
|
40
|
+
Autonomy values are `approve_writes`, `scoped`, `broad`, and `autonomous`. The default is `scoped`.
|
|
41
|
+
An autonomy setting never creates missing grants. Configure broader grants through the SDK policy.
|
|
42
|
+
|
|
43
|
+
Use `marifai inspect RUN_ID`, `marifai approve RUN_ID APPROVAL_ID`, and `marifai resume RUN_ID`
|
|
44
|
+
for paused runs. `marifai cancel RUN_ID` requests cancellation. CLI processes wait for execution;
|
|
45
|
+
interrupting them leaves durable checkpoints for subsequent inspection and recovery.
|
|
46
|
+
|
|
47
|
+
## Python SDK
|
|
48
|
+
|
|
49
|
+
See `examples/embedded_graph.py` for custom tools and non-Git subagents, `examples/agent_loop.py`
|
|
50
|
+
for an application-owned loop, and `examples/coding_task.py` for explicit coding execution.
|
|
51
|
+
The supported application surface is `Marifai` plus `Agent`, `Archon`, `Task`, `Tool`, `Policy`, and `Run`.
|
|
52
|
+
Supporting graph/configuration/contract types are documented in `docs/contracts.md`; internal modules
|
|
53
|
+
are not a public compatibility promise. Existing root aliases for graph/plan types remain available
|
|
54
|
+
for migration. Extension protocols have their own version number.
|
|
55
|
+
|
|
56
|
+
`Run.wait()` returns an explicit completed/partial/blocked/failed/cancelled result. A completed
|
|
57
|
+
unconstrained response is not proof of correctness: `verified` is true only when declared checks
|
|
58
|
+
pass. Required semantic criteria stay unverified until an external acceptance mechanism exists.
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
# examples/prepare_usage.py (illustrative caller fragment)
|
|
62
|
+
from marifai import Agent, Marifai, PlanNode, Policy, Task, TaskGraph
|
|
63
|
+
from marifai.foundation.config import Config
|
|
64
|
+
|
|
65
|
+
async def execute(config_path, workspace):
|
|
66
|
+
async with Marifai(Config.load(config_path)) as client:
|
|
67
|
+
task = Task(instructions="Summarize the supplied material")
|
|
68
|
+
graph = TaskGraph(tasks=[PlanNode(id="summary", instructions=task.instructions,
|
|
69
|
+
agent="summarizer", model_calls=2, tool_calls=0)])
|
|
70
|
+
run = await client.archon.prepare(task, graph=graph,
|
|
71
|
+
agents={"summarizer": Agent(name="summarizer", tools=[])},
|
|
72
|
+
policy=Policy(workspace=workspace))
|
|
73
|
+
report = run.plan()
|
|
74
|
+
if report and report.status == "funded":
|
|
75
|
+
await run.resume()
|
|
76
|
+
return await run.wait()
|
|
77
|
+
return report
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Prepare persists the task graph and complete resource envelope before dispatching implementation
|
|
81
|
+
agents. Planning inference, if needed, uses the same ledger. Deployment details, capability evidence,
|
|
82
|
+
pricing source/version, review/retry/correction allowances and precise shortfalls remain inspectable
|
|
83
|
+
after restart. An unaffordable preferred plan gets exactly one least-cost eligible alternative.
|
|
84
|
+
Neither checks nor authority are weakened. Time predictions are estimates; deadlines remain enforced.
|
|
85
|
+
|
|
86
|
+
`await client.refresh_catalog()` refreshes explicitly configured endpoints and persists observations.
|
|
87
|
+
It never enables newly discovered models. Inspect `client.catalog.snapshot`, `.history()` and
|
|
88
|
+
`.observations()`. Discovered capabilities/prices expire after 24 hours by default; configuration
|
|
89
|
+
overrides need price provenance. Generic OpenAI-compatible, Ollama and explicitly selected OpenRouter
|
|
90
|
+
metadata profiles are supported. OpenRouter financial admission requires a pinned upstream.
|
|
91
|
+
|
|
92
|
+
Native Anthropic and Gemini, OpenAI-compatible profiles and Ollama use the same Harness.
|
|
93
|
+
See [provider configuration](docs/providers.md). The base import starts no process and contacts no
|
|
94
|
+
provider. Applications supply endpoints, models, credentials and limits explicitly.
|
|
95
|
+
|
|
96
|
+
## Built-in memory
|
|
97
|
+
|
|
98
|
+
Use `await client.memory.upsert_document(id, text, source=...)` and `await client.memory.search(query)`
|
|
99
|
+
for durable SQLite retrieval. Keyword search needs no embeddings endpoint. A configured
|
|
100
|
+
OpenAI-compatible embedder enables hybrid FTS/vector retrieval, with explicit pricing and caps for
|
|
101
|
+
remote or paid endpoints. Set `Task(memory_query="...")` to
|
|
102
|
+
retrieve through policy and the tool budget before inference. Agent memory writes require an explicit
|
|
103
|
+
grant and the selected approval rules. See [memory usage](docs/memory.md) and [the runnable example](examples/rag_memory.py).
|
|
104
|
+
|
|
105
|
+
The CLI exposes `marifai memory upsert notes.txt --id notes`, `marifai memory search "query"`, and
|
|
106
|
+
`marifai run "Summarize" --memory-query "query"`. It uses the same SDK and configured SQLite store.
|
|
107
|
+
|
|
108
|
+
## State, cost, and privacy
|
|
109
|
+
|
|
110
|
+
Local state defaults to `.marifai/`: SQLite runtime and memory, immutable artifacts, and managed coding
|
|
111
|
+
worktrees. Preserve that directory to resume runs and inspect delivered patches. Runtime checkpoints
|
|
112
|
+
necessarily contain task instructions, conversation, tool arguments/results, and generated code.
|
|
113
|
+
Protect it like the source repository. Event traces omit model content unless `retain_content=true`;
|
|
114
|
+
credentials are redacted from diagnostic events. There is no automatic training-data upload.
|
|
115
|
+
|
|
116
|
+
Resource reservations share a parent run ledger across agents. Unknown/ambiguous provider charges
|
|
117
|
+
remain reserved. Provider-reported cost is used when available; usage multiplied by configured
|
|
118
|
+
prices remains labeled an estimate. Unpriced remote deployments and unpriced deployments under
|
|
119
|
+
a strict monetary cap cannot be routed. Local unpriced work still consumes call/token/time limits.
|
|
120
|
+
|
|
121
|
+
Elapsed wall time includes approval waits and downtime. A run that has exhausted its configured
|
|
122
|
+
wall-time cap cannot resume work; create a new run with a deliberately chosen limit.
|
|
123
|
+
|
|
124
|
+
Git worktree metadata is shared with the source repository. Baseline snapshots use temporary
|
|
125
|
+
indexes and detached commits; the original index, branch and working files are preserved. Only
|
|
126
|
+
explicitly selected untracked files enter the baseline. Completed worktrees remain available for
|
|
127
|
+
review; there is no automatic cleanup or publishing.
|
|
128
|
+
|
|
129
|
+
## Verification
|
|
130
|
+
|
|
131
|
+
Run `python -m pytest` and `python -m build`. Tests use deterministic scripted providers and mock
|
|
132
|
+
HTTP streams; live-provider checks are separate, opt-in tests. Windows and Linux-container suites
|
|
133
|
+
have local evidence; the CI matrix defines additional platform checks. See `docs/validation.md` for current evidence
|
|
134
|
+
and limits, and `docs/architecture.md` for runtime boundaries.
|
|
135
|
+
Cloud adapters are excluded from the wheel and source distribution. No cloud services are needed
|
|
136
|
+
to run the package or its local acceptance checks.
|
|
137
|
+
|
|
138
|
+
## 0.3.0 provider acceptance
|
|
139
|
+
|
|
140
|
+
The maintainer explicitly waived live-provider acceptance for this release. Package, license,
|
|
141
|
+
installed SDK smoke, and Windows/macOS/Linux checks remain required. Seven-service live acceptance
|
|
142
|
+
has not passed: an earlier wheel passed Anthropic; OpenAI, Ollama, xAI, and Together did not complete
|
|
143
|
+
all acceptance gates, and Gemini/OpenRouter credentials were unavailable. One Together operation
|
|
144
|
+
retains an unresolved usage reservation. These historical results do not establish live acceptance
|
|
145
|
+
of the published wheel or compatibility with every model. See the
|
|
146
|
+
[complete provider acceptance disclosure](https://github.com/sultani-investments/marifai-harness-sdk/blob/main/docs/releases/0.3.0-provider-acceptance.md).
|
|
147
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Runtime boundaries
|
|
2
|
+
|
|
3
|
+
Marifai Harness is an embeddable Python SDK. Applications own the interface, business logic and deployment. The shipped runtime uses SQLite; no server, GUI, tenancy layer or cloud account is required.
|
|
4
|
+
|
|
5
|
+
The execution path is application -> SDK -> optional Archon -> task -> Harness -> router -> context/reasoning -> provider -> policy/tools -> result. Archon schedules Harness calls and never invokes a provider. Harness executes one task and never decomposes it. Critical transitions use explicit calls and database transactions. Events only report transitions.
|
|
6
|
+
|
|
7
|
+
SQLite stores runs, tasks, attempts, sessions, calls, tool intents/results, approvals, checkpoints, reservations and ordered events. State and corresponding events are written together. Executor leases prevent competing drivers. A confirmed model response is reusable after interruption. An ambiguous external side effect requires reconciliation. Pause preserves remaining plan funding; cancellation releases unused allocations and retains unresolved charges.
|
|
8
|
+
|
|
9
|
+
Trace output is a separate append-only diagnostic projection, with credential redaction and opt-in payload capture. Runtime checkpoints necessarily retain conversation and tool data for recovery; turning off trace payload capture does not remove durable state.
|
|
10
|
+
|
|
11
|
+
Routing applies hard capability, locality, provider, context and budget constraints before deterministic Nano/Core/Apex ranking. Catalog snapshots retain unknown fields, timestamps, price provenance and failed-refresh evidence. Discovery never enables a deployment. Strict financial admission rejects unknown or unbounded prices.
|
|
12
|
+
|
|
13
|
+
Archon validates a topologically ordered graph of at most eight nodes and uses at most two concurrent workers. Applications register agents by role/name. Planner, reviewer, corrector and assembler roles may be supplied in that registry. Assembly is tool-free and executes through Harness, followed by deterministic final checks. The default includes review and one correction cycle. Setting orchestration.review='effort' permits a simple executor path while Pro/Deep retain independent review. Optional passes cannot remove required criteria.
|
|
14
|
+
|
|
15
|
+
Preflight persists the graph, selected deployments, capability/price evidence, consumed work and bounded phase envelopes before dispatch. Atomic funding transfers into individual reservations without double counting. One least-cost eligible alternative is evaluated if the preferred plan does not fit. Resume retains completed work and revalidates remaining funding against current metadata and narrowed authority.
|
|
16
|
+
|
|
17
|
+
General graphs require no Git repository. The explicitly selected coding strategy uses isolated writer worktrees, a baseline snapshot and one integration workspace. Original edits and selected untracked files are preserved. Applying patches to the original checkout, committing, pushing and publishing are separate application decisions.
|
|
18
|
+
|
|
19
|
+
Built-ins provide workspace file I/O, exact allow-listed test commands, bounded HTTP GET against declared origins, artifacts and policy-gated memory tools. There is no unrestricted shell. Trusted test programs and application-supplied Python tools still use their host account's privileges.
|
|
20
|
+
|
|
21
|
+
First-party memory stores documents, deterministic chunks, vectors, episodic/semantic records, metadata and run/task links in SQLite. Retrieval combines FTS5 and optional cosine ranks. Context includes bounded untrusted excerpts and exact source hashes. Retrieved content cannot authorize writes or change policy.
|