PlaygroundController class
Controller managing the state of the AI Agent Playground, chat messages, active tool loop execution, and server manager.
- Inheritance
-
- Object
- ChangeNotifier
- PlaygroundController
- Available extensions
Constructors
-
PlaygroundController({LlmConfig? initialLlmConfig, List<
McpServerConfig> ? initialServers, List<McpLocalTool> ? customLocalTools, McpPlaygroundStorageDelegate? storageDelegate, bool enableLogging = false, bool progressiveMcpDiscovery = false, 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
- 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
- loadedWorkflowId → String?
-
no setter
-
localTools
→ List<
McpLocalTool> -
no setter
-
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
-
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
-
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
SkillStorageAdapterused 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
-
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 -
connectServer(
String id) → Future< void> -
deactivateSkills(
List< String> names) → void -
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> -
saveSetup(
SavedPlaygroundSetup setup) → Future< void> -
saveSkill(
SkillDef skill) → Future< void> -
saveWorkflow(
PlaygroundWorkflow workflow) → Future< void> -
sendMessage(
String text, {List< MessageAttachment> ? attachments}) → Future<void> - Sends a message and triggers the agentic tool call loop.
-
setActiveSkill(
SkillDef? skill) → void -
setLoadedWorkflowId(
String? id) → void -
setSkillStorageAdapter(
SkillStorageAdapter adapter) → void -
Allows injecting a custom
SkillStorageAdapter(e.g., DB-backed). -
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