# AI Operations Runbook

## Configuration
Set the integration through `/adm/ia-config`:
- enable integration
- API key
- model
- base URL
- timeout
- output token budget
- module-level activation flags

## Validation
Use the connection test action before enabling AI-assisted flows for the team.

## Monitoring
Use `/adm/ia-hub` to monitor:
- integration availability
- latest successful execution
- latest error
- feature usage
- recent execution trail

## Database requirement
Apply the migration below to enable audit and usage visibility:
- `sql/migrations/20260412_create_openai_logs.sql`

## Rollout guidance
- start with high-volume operational modules
- keep prompts scoped to real business context
- monitor feature-level error rate after each rollout
- expand only after validating value and stability

## Support guidance
If AI actions stop working:
1. validate integration status in `/adm/ia-hub`
2. re-test the OpenAI connection in `/adm/tickets-config`
3. verify whether the logs table is active
4. inspect the latest failed executions in the dashboard

## Engineering notes
- module services should not call external APIs directly
- shared execution must flow through `OpenAIService`
- every new AI feature should define a stable `feature` name for traceability
- UI integrations should prefer assisted actions over fully autonomous behavior
