dart_agent_core library
A mobile-first, local-first Dart library for building stateful, tool-using AI agents with multi-provider LLM support (OpenAI, Gemini, AWS Bedrock).
This library provides a unified interface for interacting with various LLMs, managing agent state, handling tool calls, and maintaining conversation history.
Classes
- AfterCallLLMEvent
- AfterRunHookContext
- AfterToolCallEvent
- AgentCallToolContext
- AgentController
- A flexible controller based on EventBus. It wraps an EventBus and provides helper methods to interact with it.
- AgentHook
- AgentHookContext
- AgentHookPipeline
- AgentMessageHistory
- AgentResumedEvent
- AgentRunSuccessedEvent
- AgentStartedEvent
- AgentState
- Represents the state of an AI agent, including its history, token usage, active skills, and planning metadata.
- AgentStoppedEvent
- AgentToolResult
- AudioPart
- BedrockClaudeClient
- BeforeCallLLMEvent
- BeforeRunHookContext
- BeforeRunHookResult
- BeforeToolCallEvent
- ButtonToolCallBuffer
- CallLLMParams
- ClaudeClient
- Client for the Anthropic Messages API (direct, not via AWS Bedrock).
- ContextCompressor
- DefaultLoopDetector
- DirectorySkillInjections
- DirectorySkillLoadError
- DirectorySkillLoadResult
- DirectorySkillMetadata
- DocumentPart
- EpisodicMemory
- Event
- Base class for all events in the system.
- EventBus
- A simple EventBus that supports both Publish/Subscribe and Request/Response patterns.
- EventStreamDecoder
-
AWS EventStream Decoder for Dart.
Decodes binary
application/vnd.amazon.eventstreamdata. - EventStreamMessage
- ExecutionToolResult
- FileStateStorage
- Web implementation of StateStorage.
- FunctionCall
- Represents a function call to be executed
- FunctionExecutionResult
- FunctionExecutionResultMessage
- GeminiChunkDecoder
- Decodes a stream of JSON lines (potentially multi-line) from Gemini into JSON objects.
- GeminiClient
- ImagePart
- JavaScriptBridgeContext
- JavaScriptBridgeRegistry
- JavaScriptExecutionResult
- JavaScriptRuntime
- LLMBasedContextCompressor
- LLMChunkEvent
- LLMClient
- LLMMessage
- Base class for all messages exchanged with an LLM.
- LLMRetryingEvent
- LoopDetector
- LoopDetectorResult
- ModelAudioPart
- ModelCallHookContext
- ModelCallHookResult
- ModelCallRequest
- ModelChunkHookContext
- ModelChunkHookResult
- ModelConfig
- ModelContentPart
- ModelImagePart
- ModelMessage
- A message generated by the AI model, including text output, function calls, and multi-modal content.
- ModelResponseHookContext
- ModelResponseHookResult
- ModelTextPart
- ModelUsage
- ModelVideoPart
- NodeJavaScriptRuntime
- Web stub for NodeJavaScriptRuntime.
- OnAgentCancelEvent
- OnAgentErrorEvent
- OnAgentExceptionEvent
- OpenAIChunkDecoder
- OpenAIClient
- OpenAIResponseTransformer
- PlanChangedEvent
- Planner
- PlanState
- PlanStep
- ResponsesAPIResponseTransformer
- ResponsesChunkDecoder
- ResponsesClient
- Skill
- StatefulAgent
- StatePersistenceHookContext
- StatePersistenceHookResult
- StateStorage
- StreamingControlMessage
- StreamingEvent
- StreamingMessage
- SubAgent
- SystemMessage
- SystemPromptHistoryItem
- SystemPromptPart
- TextPart
- Tool
- Defines a tool that can be executed by an agent.
- ToolCallHookContext
- ToolCallHookResult
- ToolChoice
- ToolResultHookContext
- ToolResultHookResult
- ToolsHistoryItem
- TurnCompletionHookContext
- TurnCompletionHookResult
- UserContentPart
- Base class for user content parts
- UserMessage
- A message sent by the user, which can contain multiple content parts (text, image, video, audio, document).
- VideoPart
Enums
- AgentExceptionCode
- BeforeRunHookAction
- MessageRole
- ModelCallHookAction
- ModelChunkHookAction
- ModelResponseHookAction
- PlanMode
- StatePersistenceHookAction
- StepStatus
- StreamingControlFlag
- StreamingEventType
- ToolCallHookAction
- ToolChoiceMode
- ToolParameterMode
- Tool parameter mode.
- ToolResultHookAction
- TurnCompletionHookAction
Extensions
-
ListTakeLast
on List<
T>
Properties
-
memoryTools
→ List<
Tool> -
final
-
skillOperationTools
→ List<
Tool> -
final
-
subAgentTools
→ List<
Tool> -
final
Functions
-
buildDirectorySkillInjections(
List< DirectorySkillMetadata> mentionedSkills) → Future<DirectorySkillInjections> -
buildDirectorySkillsSystemPrompt(
List< DirectorySkillMetadata> skills, {bool javaScriptExecutionEnabled = false}) → SystemPromptPart? -
buildSkillSystemPrompt(
AgentState state, List< Skill> ? skills) → SystemPromptPart? -
buildSubAgentSystemPrompt(
AgentState state, List< SubAgent> ? subAgents) → SystemPromptPart? -
collectExplicitDirectorySkillMentions(
List< LLMMessage> messages, List<DirectorySkillMetadata> skills) → List<DirectorySkillMetadata> -
loadDirectorySkillsFromRoot(
String rootDirectoryPath, {int maxDepth = 6}) → Future< DirectorySkillLoadResult>
Typedefs
-
JavaScriptBridgeHandler
= FutureOr Function(Map<
String, dynamic> payload, JavaScriptBridgeContext context)