FlintAi class
Main entry point for Flint's AI runtime.
A FlintAi instance owns the provider registry, tool registry, workflow registry, memory store, persistence repository, planner, executor, and tool policy used by agent runs.
Use the default constructor for local development and tests. It uses safe default tool policy settings and auto-configured in-memory storage when no repository is supplied.
Use FlintAi.production for deployed apps where tool execution should be denied unless an authenticated user, role, tool name, or capability allows it.
- Available extensions
Constructors
- FlintAi({AiProviderRegistry? providers, AiToolRegistry? tools, AiWorkflowRegistry? workflows, AiMemoryStore? memoryStore, AiRepository? repository, AiPlanner? planner, AiExecutor? executor, AiToolPolicy? toolPolicy})
- Creates a new AI runtime with sensible defaults for development.
- FlintAi.production({AiProviderRegistry? providers, AiToolRegistry? tools, AiWorkflowRegistry? workflows, AiMemoryStore? memoryStore, AiRepository? repository, AiPlanner? planner, AiExecutor? executor, AiToolPolicy? toolPolicy})
-
Creates an AI runtime configured for production-oriented defaults.
factory
Properties
- executor → AiExecutor
-
Executor used to run a plan.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- memoryStore → AiMemoryStore
-
Run and thread memory storage.
final
- planner → AiPlanner
-
Planner used to convert goals into execution steps.
final
- providers → AiProviderRegistry
-
Registered chat, image, and embedding providers.
final
- repository → AiRepository
-
Durable repository for runs, traces, threads, and artifacts.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- toolPolicy ↔ AiToolPolicy
-
Policy used to authorize tool execution.
getter/setter pair
- tools → AiToolRegistry
-
Registered executable AI tools.
final
- usesAutoMemoryStore → bool
-
Indicates whether the default auto-configured memory store is in use.
final
- workflows → AiWorkflowRegistry
-
Registered named workflows.
final
Methods
-
chat(
{required String providerId, required ChatRequest request}) → Future< ChatResult> - Sends a non-streaming chat request through the named provider.
-
loadRunEvents(
String runId) → Future< List< Map< >String, dynamic> > - Loads persisted or in-memory events for a run.
-
loadThreadMessages(
String threadId) → Future< List< Map< >String, dynamic> > - Loads persisted or in-memory messages for a thread.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerChatProvider(
ChatProvider provider) → void - Registers a chat provider implementation.
-
registerEmbeddingProvider(
EmbeddingProvider provider) → void - Registers an embedding provider implementation.
-
registerImageProvider(
ImageProvider provider) → void - Registers an image generation provider implementation.
-
registerTool(
AiTool tool) → void - Registers a tool that agents can invoke during execution.
-
registerWorkflow(
AiWorkflow workflow) → void - Registers a named workflow.
-
run(
{required AiAgent agent, required AiGoal goal, String? userId, String? tenantId, String? threadId, Object? context, Map< String, dynamic> metadata = const {}}) → Future<AiRunResult> -
Executes an agent run for the supplied
goal. -
runWorkflow(
String workflowName, {String? userId, String? tenantId, String? threadId, Map< String, dynamic> input = const {}, Object? context, Map<String, dynamic> metadata = const {}, bool isBackground = false}) → Future<AiWorkflowRunResult> - Executes a registered workflow by name.
-
saveThreadMessage(
String threadId, Map< String, dynamic> message) → Future<void> - Saves a thread message into the configured memory store.
-
streamChat(
{required String providerId, required ChatRequest request}) → Stream< ChatEvent> - Streams chat events from the named provider.
-
toString(
) → String -
A string representation of this object.
inherited
-
useAnthropicFromEnv(
{String apiKeyKey = 'ANTHROPIC_API_KEY', String endpointKey = 'ANTHROPIC_CHAT_ENDPOINT', AiHttpClient? httpClient}) → bool -
Available on FlintAi, provided by the FlintAiEnvSetup extension
Registers Anthropic whenANTHROPIC_API_KEYis set. -
useChatProvidersFromEnv(
{AiHttpClient? httpClient}) → List< String> -
Available on FlintAi, provided by the FlintAiEnvSetup extension
Registers every supported chat provider with credentials present in env. -
useGeminiFromEnv(
{String apiKeyKey = 'GEMINI_API_KEY', String bearerTokenKey = 'GEMINI_BEARER_TOKEN', String endpointKey = 'GEMINI_CHAT_ENDPOINT', AiHttpClient? httpClient}) → bool -
Available on FlintAi, provided by the FlintAiEnvSetup extension
Registers Gemini whenGEMINI_API_KEYorGEMINI_BEARER_TOKENis set. -
useOpenAiFromEnv(
{String apiKeyKey = 'OPENAI_API_KEY', String bearerTokenKey = 'OPENAI_BEARER_TOKEN', String endpointKey = 'OPENAI_CHAT_ENDPOINT', AiHttpClient? httpClient}) → bool -
Available on FlintAi, provided by the FlintAiEnvSetup extension
Registers OpenAI whenOPENAI_API_KEYorOPENAI_BEARER_TOKENis set. -
useProductionToolPolicyFromEnv(
{String allowedToolsKey = 'AI_ALLOWED_TOOLS', String allowedCapabilitiesKey = 'AI_ALLOWED_CAPABILITIES', String allowedRolesKey = 'AI_ALLOWED_ROLES', bool requireUserBinding = true, bool allowEnabledByDefault = false}) → void -
Available on FlintAi, provided by the FlintAiEnvSetup extension
Applies a production tool policy from env allow-lists.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited