Getting Started
Batoi AIF can be used with Composer or as a ZIP/drop-in package. Composer is preferred for application projects because it keeps dependency loading and updates predictable.
Requirements
- PHP 8.3 or newer
- cURL extension for HTTP provider transports
- Composer for package-managed installs
Composer Install
composer require batoi/aifConfirm package availability before using the Composer command. If Packagist is not available for your environment, add the public GitHub repository as a Composer VCS repository. See Installation.
Minimal Development Example
<?php
use Batoi\Aif\Gateway\AifGateway;
use Batoi\Aif\Providers\InMemoryProviderRegistry;
use Batoi\Aif\Providers\MockProvider;
use Batoi\Aif\Value\InferenceRequest;
$gateway = new AifGateway(
providers: new InMemoryProviderRegistry([
'mock' => new MockProvider(),
]),
);
$response = $gateway->infer(new InferenceRequest(
input: 'Summarize the control review notes.',
));
echo $response->output;This example uses development mode and the deterministic mock provider. Development mode is for evaluation and local tests.
Production Pattern
Production applications should use RuntimeMode::Governed. Governed mode requires a trusted ExecutionContext, a policy engine, and persistent audit logging before execution can reach a provider.
Use this boundary:
- UI collects intent, context, and user input.
- Backend resolves permissions and workspace context.
- AIF resolves an approved prompt where applicable, applies operation-aware policy and obligations, routes a capable provider, runs evaluations, and persists terminal evidence.
- UI renders the response and any review state.
Next Step
Read Architecture, then configure the Gateway and Policy boundary for governed mode.