No results
1
Service-Lifecycle
Virgil edited this page 2026-02-19 18:36:58 +00:00
Table of Contents
Service Lifecycle
Core Integration
go-agentic implements the Core framework service pattern:
type Service struct {
*framework.ServiceRuntime[Config]
}
Startup
The service registers with Core's DI container and is instantiated during application startup. It:
- Loads configuration from YAML/environment
- Initialises allowance tracking
- Sets up the AI provider HTTP client
- Registers available completion models
Configuration
type Config struct {
Provider string // AI provider (anthropic, openai, etc.)
Model string // Default model
APIKey string // Provider API key
MaxTokens int // Default max tokens
Temperature float64 // Default temperature
}
Configuration sources (in priority order):
- Environment variables
- YAML config file
- Built-in defaults
Client Operations
client.go provides the HTTP client for AI provider APIs:
- Configurable base URL and authentication
- Request/response serialisation
- Timeout and error handling
- Context cancellation support
Completion Flow
User request
↓
Context builder (context.go) — assembles project context
↓
Allowance check (allowance.go) — verify quota
↓
Completion request (completion.go) — call AI provider
↓
Response handling — parse and return