Skip to main content

Briefcase Server

The Briefcase Server is an Actix-web HTTP API that exposes the Rust core's functionality over REST.

Configuration

Environment VariableDefaultDescription
BRIEFCASE_HOST0.0.0.0Bind address (production: api.briefcasebrain.com via Route 53)
BRIEFCASE_PORT8080Listen port
BRIEFCASE_DATABASE_URLbriefcase.dbSQLite database path
BRIEFCASE_MAX_CONNECTIONS10Connection pool size
BRIEFCASE_REQUEST_TIMEOUT30Request timeout (seconds)

Endpoints

Health

MethodPathDescription
GET/healthHealth check
GET/infoServer version and status

Decisions

MethodPathDescription
POST/api/v1/decisionsCreate a decision snapshot
GET/api/v1/decisions/{id}Retrieve a decision
GET/api/v1/decisionsList decisions (with filters)
DELETE/api/v1/decisions/{id}Delete a decision

Create Decision Request:

{
"function_name": "evaluate_claim",
"module_name": "claims",
"inputs": [{"value": "claim_data", "type": "json"}],
"outputs": [{"value": "approved", "type": "string", "confidence": 0.95}],
"model_params": {"name": "gpt-4", "version": "0613", "provider": "openai"},
"execution_time_ms": 1250,
"tags": {"environment": "production"}
}

Replay

MethodPathDescription
POST/api/v1/replay/{id}Replay a single decision
POST/api/v1/replay/batchBatch replay with concurrency
POST/api/v1/replay/{id}/validateValidate against policy rules
POST/api/v1/replay/statsGet replay statistics

Replay modes: strict, tolerant, validation_only

Diff

MethodPathDescription
POST/api/v1/diffCompare two decision snapshots

Running the Server

# From source
cargo run -p briefcase-server

# With custom config
BRIEFCASE_PORT=9090 BRIEFCASE_DATABASE_URL=prod.db cargo run -p briefcase-server

Deployment

The server is containerized and can be deployed to managed container platforms (for example ECS, Kubernetes, or equivalent orchestrators).

  • Recommended production posture:
    • run behind HTTPS via API gateway or load balancer
    • expose /health for readiness/liveness checks
    • configure storage and timeouts via environment variables

You can build and run the container locally:

docker build -t briefcase-server .
docker run --rm -p 8080:8080 briefcase-server
curl http://localhost:8080/health