Development
This page explains how to set up the ARF API for local development.
Requirements
- Python 3.10+ (match your environment)
- A virtual environment
- The project's Python dependencies (see
requirements.txt). Note:agentic-reliability-frameworkis installed from a Git URL inrequirements.txt.
Quick start
Clone the repository:
git clone https://github.com/petter2025us/arf-api.git cd arf-api
Create and activate a virtualenv, then install dependencies:
python -m venv .venv source .venv/bin/activate # or ..venv\Scripts\activate on Windows pip install -r requirements.txt
Configure environment variables (optional):
- The project uses pydantic-settings with
env_file = ".env"(seeapp/core/config.py). Create a.envfile to set values locally.
Relevant environment variables used by the code:
- ARF_HMC_MODEL (default:
models/hmc_model.json) — path to HMC model JSON used by RiskEngine. - ARF_USE_HYPERPRIORS (default:
false) — set totrueto enable hyperprior behavior. - API_KEY (optional) — will populate
settings.api_keybut note that routes currently do not enforce authentication. - DATABASE_URL (optional) — configuration option in settings; tests use a local SQLite DB by default.
- The project uses pydantic-settings with
Run the app with Uvicorn for development:
uvicorn app.main:app --reload --port 8000
- The application mounts routes under the
/api/v1prefix and exposes a health endpoint at/health.
- The application mounts routes under the
Running tests
Tests use an on-disk SQLite test database (
sqlite:///./test.db) created by the test fixtures (tests/conftest.py).To run tests:
pytest
The test fixtures override the dependency that provides DB sessions so tests run against the test database.
Notes on the RiskEngine
- The app initializes a
RiskEngineinstance at startup (inapp.main) using environment variables noted above. The engine instance is stored inapp.state.risk_engineand is used by the governance endpoints.
Further development
- If you add persistent intent storage or authentication, update tests and dependency overrides accordingly.