PlaygroundController class

Controller managing the state of the AI Agent Playground, chat messages, active tool loop execution, and server manager.

Inheritance
Available extensions

Constructors

PlaygroundController({LlmConfig? initialLlmConfig, List<LlmConfig>? initialLlmConfigs, List<McpServerConfig>? initialServers, List<McpLocalTool>? customLocalTools, McpPlaygroundStorageDelegate? storageDelegate, bool enableLogging = false, bool progressiveMcpDiscovery = false, String toolDeliveryStrategy = 'auto', bool injectToolCallingRules = true, String toolFilteringLlmSource = 'llm1', List<SystemPromptTemplate>? systemPromptTemplates, bool showSystemPromptTemplates = true})
Creates a new PlaygroundController instance.

Properties

activeLlmConfig → LlmConfig
no setter
activeModelPrice → ModelPriceInfo?
no setter
activeSkill → SkillDef?
no setter
activeSkillNames → Set<String>
no setter
chatMode ↔ bool
getter/setter pair
customLlmConfig ↔ LlmConfig?
getter/setter pair
dynamicSkills → List<SkillDefinition>
no setter
enabledToolNames → Set<String>
no setter
enableEpisodicMemory ↔ bool
getter/setter pair
enableLogging → bool
final
enableSubAgents ↔ bool
getter/setter pair
episodicMemoryStore → EpisodicMemoryStore
no setter
errorMessage → String?
no setter
evalController → EvalController
no setter
externalTools → List<MCPTool>
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
injectToolCallingRules → bool
no setter
isGenerating → bool
no setter
isInspectorVisible ↔ bool
Whether the Agent Inspector pane/dialog is visible.
getter/setter pair
isLoading → bool
no setter
isLoadingPrice → bool
no setter
llmConfig → LlmConfig
no setter
llmConfigs → List<LlmConfig>
no setter
loadedWorkflowId → String?
no setter
localTools → List<McpLocalTool>
no setter
maxToolCalls ↔ int
getter/setter pair
maxToolIterations ↔ int
getter/setter pair
maxTurns ↔ int
getter/setter pair
mcpClients → List<MCPClientDef>
no setter
mcpManager → MultiMCPManager
Direct access to the internal MultiMCPManager.
no setter
memoryArchive → List<EpisodicMemoryEntry>
no setter
messageContentBuilder ↔ Widget? Function(BuildContext context, ChatMessage message)?
Optional builder to customize rendering of chat bubble message contents dynamically.
getter/setter pair
messages → List<ChatMessage>
no setter
onSessionRotate ↔ VoidCallback?
Optional callback invoked when max conversation turns are reached for session rotation.
getter/setter pair
pendingParts → List<ChatContentPart>
no setter
progressiveMcpDiscovery ↔ bool
Whether to use on-demand progressive tool discovery (McpListToolsTool & McpCallToolTool) instead of sending all MCP tool schemas in the initial prompt context.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
savedSetups → List<SavedPlaygroundSetup>
no setter
selectedLlmId → String
no setter
servers → List<McpServerConfig>
no setter
showSystemPromptTemplates ↔ bool
getter/setter pair
skills → List<SkillDef>
no setter
skillsRootPath → String?
The root directory where skill ZIPs are stored (desktop/mobile only).
no setter
skillStorage → SkillStorageAdapter
The SkillStorageAdapter used for saving/loading skill ZIPs.
no setter
stopAfterToolCall ↔ bool
getter/setter pair
storage → McpPlaygroundStorageDelegate
no setter
subAgentList → List<SubAgentExecution>
no setter
subAgents → Map<String, SubAgentExecution>
no setter
systemPrompt ↔ String
getter/setter pair
systemPromptTemplates ↔ List<SystemPromptTemplate>?
getter/setter pair
toolDeliveryStrategy → String
no setter
toolFilteringLlmSource → String
no setter
turnLimit ↔ int
getter/setter pair
workflows → List<PlaygroundWorkflow>
no setter

Methods

activateSkills(List<String> names) → void
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addLocalTools(Iterable<McpLocalTool> tools) → void
Dynamically registers multiple local tools at runtime.
addMemoryEntry(EpisodicMemoryEntry entry) → void
addMessage(ChatMessage message) → void
Adds a message to the conversation history and notifies listeners.
addPendingPart(ChatContentPart part) → void
addServer(McpServerConfig server, {bool autoSelectTools = true}) → Future<void>
cancelGeneration() → void
Requests cancellation of the currently executing prompt/sub-prompt chain. Safe to call from any thread.
clearChat() → void
clearMemoryArchive() → void
clearPendingParts() → void
cloneProfile(String id, {String? newName}) → Future<LlmConfig>
Clones a profile and appends it to the profiles list.
connectServer(String id) → Future<void>
deactivateSkills(List<String> names) → void
deleteProfile(String id) → Future<void>
Deletes a profile by ID.
deleteSetup(String id) → Future<void>
deleteSkill(String id) → Future<void>
deleteWorkflow(String id) → Future<void>
dispose() → void
Discards any resources used by the object.
override
fetchActiveModelPrice() → Future<void>
Queries the live token price for the currently active model configuration.
initializeAllUndiscoveredServers() → Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
openInspector(BuildContext context) → Future<void>

Available on PlaygroundController, provided by the McpPlaygroundDialogExtensions extension

Opens the agent inspector dialog.
openSettings(BuildContext context, {int initialTab = 0, McpSettingsDialogBuilder? customBuilder}) → Future<void>

Available on PlaygroundController, provided by the McpPlaygroundDialogExtensions extension

Opens the settings dialog or sheet.
registerDynamicSkill(SkillDefinition skill) → void
registerDynamicSkills(List<SkillDefinition> skills) → void
registerLocalTool(McpLocalTool tool) → void
Dynamically registers an additional local tool at runtime.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removePendingPart(int index) → void
removeServer(String id) → Future<void>
saveProfile(LlmConfig profile) → Future<void>
Saves or creates a named LLM profile.
saveSetup(SavedPlaygroundSetup setup) → Future<void>
saveSkill(SkillDef skill) → Future<void>
saveWorkflow(PlaygroundWorkflow workflow) → Future<void>
selectLlm(String id) → Future<void>
Selects an active LLM profile by ID and persists selection.
sendMessage(String text, {List<MessageAttachment>? attachments}) → Future<void>
Sends a message and triggers the agentic tool call loop.
setActiveSkill(SkillDef? skill) → void
setInjectToolCallingRules(bool value) → Future<void>
Toggles whether tool calling instructions are appended to system prompts.
setLoadedWorkflowId(String? id) → void
setSkillStorageAdapter(SkillStorageAdapter adapter) → void
Allows injecting a custom SkillStorageAdapter (e.g., DB-backed).
setToolDeliveryStrategy(String strategy) → Future<void>
Updates global tool delivery strategy ('auto', 'progressive', 'prefilter', 'direct').
setToolFilteringLlmSource(String source) → Future<void>
Updates the secondary model used for tool prefiltering.
stopGeneration() → void
Alias for cancelGeneration.
syncMcpServers() → Future<void>
toggleDynamicSkill(String name) → void
toggleInspector() → void
Toggles visibility of the Agent Inspector pane.
toggleServer(String id, bool enabled) → Future<void>
toggleToolEnabled(String toolName, bool enabled) → void
toggleToolsEnabled(Iterable<String> toolNames, bool enabled) → void
toString() → String
A string representation of this object.
inherited
updateEnabledTools(Set<String> toolNames) → void
updateLlmConfig(LlmConfig config) → Future<void>
updateServer(McpServerConfig server) → Future<void>

Operators

operator ==(Object other) → bool
The equality operator.
inherited