Skip to content

explore

panel_flowdash.explore

The Explore view: questions about a dashboard's data as a feed, with each answer's outputs shown live.

With an agent attached, the Explore view asks its own agent runner, apart from the assistant in the drawer, and the feed holds the requests asked in the Explore view only: the runs of this session and, from the dashboard file, the turns of earlier ones (their run ids start with EXPLORE_RUN_PREFIX). Without one, every turn of the dashboard is shown, as a record of how it was made.

Each turn becomes a run of the feed's own panel-agents RunState, shown by an AgentChat in its document layout. A run asked in this session is the runner's run itself, forwarded event by event, so the feed shows its steps, answer and approvals as they stream. Any other turn is projected from the dashboard file: the question, what the turn changed, and no model calls.

Each node a turn created is an inline artifact of that run whose value refers to the node, never its data, so the card always shows the node's current output and never disagrees with its tile: a view's card shows the view its tile shows, which can only be on screen once, so the Explore view and the editor's workspace are never shown together. Nodes made before the first recorded turn are listed, collapsed, in a leading cell.

The answers of the runs asked in this session are not on the dashboard: they are nodes of the session's exploration of it (see :mod:panel_flowdash.agent.exploration), and each card shows one live from there, with "Add to dashboard" copying it onto the dashboard, or "Add to report" onto a report, at the report's end. In a chat, a dashboard of kind "chat", "Add toโ€ฆ" asks which dashboard or report to copy it onto instead, and "Make a dashboard or report" makes a new one from the answers picked (see :mod:panel_flowdash.ui.chat_dashboards). A chat stores its answers, so the runs of earlier sessions show their questions with their answers rebuilt live.

ADD_LABELS = {DASHBOARD_KIND: 'Add to dashboard', REPORT_KIND: 'Add to report', CHAT_KIND: 'Add toโ€ฆ'} module-attribute

CARD_HEIGHT = 320 module-attribute

CHAT_KIND = 'chat' module-attribute

DASHBOARD_KIND = 'dashboard' module-attribute

EARLIER_AGENT = 'Dashboard' module-attribute

EARLIER_KIND = 'outputs' module-attribute

EARLIER_TITLE = 'Before the recorded requests' module-attribute

EXPLORE_RUN_PREFIX = 'explore-' module-attribute

FEED_LOAD_BUFFER = 100000 module-attribute

HISTORY_TITLE = 'Earlier requests and edits' module-attribute

MENTION_PATTERN = '@(?P<label>"(?:[^"\\\\]|\\\\.)*"|[^\\s"]\\S*)(?:\\s*\\((?P<node>[^()\\s]+)\\))?' module-attribute

NARROW_BREAKPOINT = 600 module-attribute

NODE_KINDS = {'source': 'data', 'transform': 'data', 'view': 'view', 'widget': 'control', 'other': 'output'} module-attribute

OPEN_LABELS = {DASHBOARD_KIND: 'Open dashboard', REPORT_KIND: 'Open report'} module-attribute

RAIL_WIDTH = 80 module-attribute

READING_WIDTH = 820 module-attribute

REPORT_KIND = 'report' module-attribute

RESTRICTED_TITLE = 'Restricted output' module-attribute

_ANSWER_ICONS = {'view': 'insights', 'data': 'table_chart', 'control': 'tune', 'output': 'article'} module-attribute

_ARTIFACT_EVENTS = (ev.ArtifactPublished, ev.ArtifactApplied, ev.ArtifactVersionsDropped) module-attribute

_COALESCE_MS = 50 module-attribute

_DOCKED_FRAME = {'sx': {'boxShadow': 'none', 'borderRadius': 0}, 'margin': 0} module-attribute

_EARLIER_RUN = 'dashboard-earlier' module-attribute

_PAGE_FRAME = {'sx': {'boxShadow': 'none', 'borderRadius': 0, 'bgcolor': 'transparent'}, 'margin': 0} module-attribute

_SLOT_CSS = '\n.slot {\n border: 2px dashed var(--mui-palette-primary-main); border-radius: 12px; padding: 14px 18px;\n color: var(--mui-palette-text-secondary); font-size: 0.8125rem;\n}\n.slot .what { color: var(--mui-palette-primary-main); font-weight: 500; font-size: 0.875rem; }\n' module-attribute

_UNSET = object() module-attribute

__all__ = ['EARLIER_KIND', 'EXPLORE_RUN_PREFIX', 'NODE_KINDS', 'ExploreFeed', 'is_explore_run'] module-attribute

logger = logging.getLogger(__name__) module-attribute

AddTarget dataclass

Somewhere an answer can be added: a new or existing dashboard or report.

asset_id instance-attribute

detail = '' class-attribute instance-attribute

icon property

kind instance-attribute

last_used = False class-attribute instance-attribute

new property

title instance-attribute

AddTargetDialog

Bases: _ChatDialog

Asks where a chat's answer goes: a new dashboard or report, or a recent one, the last pick first.

answer property

The answer being added, as its run and node.

target = pmui.Select(label='Add to', groups={'New': {'New dashboard': NEW_DASHBOARD}}, value=NEW_DASHBOARD, sizing_mode='stretch_width', css_classes=['fd-add-target']) instance-attribute

offer(run, node, question=None)

Open the dialog for adding the answer node of run run, asked as question.

AnswerCard

Bases: Viewer

One answer as a card: title, caption, tabs, and its actions.

The callables come from the feed: data returns the rows the answer was built from, or None; placed says where the answer is, e.g. "On Fleet Overview"; primary names the target the main button adds to directly, or None to make it open the menu; targets lists the menu's; add adds the answer to a target; refine hands the card to the composer. Without add or refine their buttons are left out.

add_button = pmui.Button(label='Add toโ€ฆ', icon='add', variant='contained', size='small', margin=0, sx=_MAIN_SX, css_classes=['answer-card-add']) instance-attribute

add_caret = pmui.Button(label='', icon='arrow_drop_down', variant='contained', size='small', margin=0, description='Other dashboards and reports', sx=_CARET_SX, css_classes=['answer-card-add-more']) instance-attribute

builds_on_button = None instance-attribute

copy_button = pmui.Button(icon='content_copy', label='', variant='text', color='default', sx=_ICON_ONLY_SX, description='Copy the data', size='small', margin=0, visible=self._frame is not None and not compact, css_classes=['answer-card-copy', 'answer-card-desktop']) instance-attribute

download = pmui.FileDownload(callback=self._csv, filename=f'{filename}.csv', label='', icon='download', variant='text', color='default', size='small', description='Download the data as CSV', margin=0, visible=self._frame is not None and not compact, sx=_ICON_ONLY_SX, css_classes=['answer-card-download', 'answer-card-desktop']) instance-attribute

key = key instance-attribute

kind = kind instance-attribute

menu = AddToMenu(self._pick) instance-attribute

more = pmui.MenuButton(icon='more_vert', label='', variant='text', size='small', color='default', description='More', margin=0, sx=_ICON_ONLY_SX, css_classes=['answer-card-more']) instance-attribute

placed_chip = pmui.Chip(label='', icon='check', size='small', color='success', variant='outlined', visible=False, margin=(0, 0, 0, 8), css_classes=['answer-card-placed']) instance-attribute

refine_button = pmui.Button(label='' if compact else 'Refine', description='Refine', icon='edit_note', variant='text', size='small', margin=0, visible=refine is not None, sx=_ICON_ONLY_SX if compact else _ICON_SX, css_classes=['answer-card-refine']) instance-attribute

tab = param.Selector(default='chart', objects=list(TABS), doc='The tab shown.') class-attribute instance-attribute

tab_buttons = pmui.RadioButtonGroup(options={TABS[k][0]: k for k in tabs}, value=kind, size='small', margin=0, visible=len(tabs) > 1 and not compact, sx=_TABS_SX, css_classes=['answer-card-tabs', 'answer-card-desktop']) instance-attribute

tabs = tabs instance-attribute

title = param.String(doc="The card's title, in words.") class-attribute instance-attribute

open_menu()

Open the menu of everywhere the answer can go: a popup, or a bottom sheet on a phone.

refresh()

Say again where the answer is and what the main button adds to.

show_tab(name)

Show the tab name: "chart", "number", "data" or "sql".

"chart" and "number" both mean the answer itself. A tab the card does not have is ignored.

update_data()

Read the rows again, e.g. after the answer's node ran anew.

AnswerChat

Bases: AgentChat

An AgentChat whose runs say what they did in a :class:WhatIDid block each.

It overrides AgentChat internals, which is why panel-agents is capped below 0.2. _regroup is panel-agents' own with WhatIDid in place of its step row; once panel-agents' step_group factory (panel-extensions/panel-agents#69) is released, step_group=WhatIDid replaces the copy, with WhatIDid.update hiding its members' messages.

column_width = param.Integer(default=None, allow_None=True, doc='The width of the reading column the messages and the composer are centred in.') class-attribute instance-attribute

footer_lead = param.List(default=[], doc="Shown first in the composer's footer, before the model picker, e.g. the chat's scope chip.") class-attribute instance-attribute

on_notice_action = param.Callable(default=None, allow_None=True, doc="\n Called with a notice's :class:`~panel_flowdash.agent.step_text.NoticeAction`,\n the run id and, for a menu, the item picked, for actions the chat does\n not carry out itself.") class-attribute instance-attribute

on_show_sql = param.Callable(default=None, allow_None=True, doc="\n Called with a run id and the tool call that ran SQL to show the SQL on\n the run's card. None leaves the link out.") class-attribute instance-attribute

on_trace = param.Callable(default=None, allow_None=True, doc='Called with a run id to open its trace. None leaves Open the trace out.') class-attribute instance-attribute

queue_note = pmui.Typography('', disable_math=True, variant='caption', visible=False, margin=(0, 0, 4, 0), sx={'color': 'text.secondary', 'textAlign': 'center', 'display': 'block'}, sizing_mode='stretch_width', css_classes=['fd-queued-question']) instance-attribute

queued = param.String(default=None, allow_None=True, doc='The question typed while an answer was being made, asked once it is done.') class-attribute instance-attribute

scope_notice = param.Boolean(default=False, doc="\n Whether the latest answer raised a notice pointing at the chat's scope\n (``ChatNotice.highlight_scope``), until the next question is asked.") class-attribute instance-attribute

waiting_placeholder = param.String(default='Type your next question; it waits until this answer is done', doc="The composer's placeholder while an answer is being made.") class-attribute instance-attribute

can_trace(run_id)

notice_action(action, run_id, picked=None)

Carry out a notice's action, or hand it to on_notice_action.

open_trace(run_id)

submit(text) async

AssetTurn dataclass

One request to an agent, or one batch of a person's edits, that changed a dashboard.

Attributes:

Name Type Description
id str

Unique within the dashboard and never reused, so the nodes' origin and the edit history can refer to it.

actor str | None

"agent" or "user". A planned turn may leave it out.

at str | None

When the turn's first edit was made, as ISO 8601 UTC, e.g. "2026-11-17T20:14:03Z".

run str | None

The panel-agents run id of the agent's request.

question str | None

What the person asked the agent. Recorded by default; exports can leave it out, see :func:~panel_flowdash.editor.export_model.

summary str | None

What the turn changed, a few words per change.

status str | None

None for a turn that ran, "pending" for a planned one that has not.

actor = None class-attribute instance-attribute

at = None class-attribute instance-attribute

id instance-attribute

question = None class-attribute instance-attribute

run = None class-attribute instance-attribute

status = None class-attribute instance-attribute

summary = None class-attribute instance-attribute

from_dict(data) classmethod

Read a turn written by :meth:to_dict, ignoring keys it does not know.

Raises:

Type Description
TurnError

If a field has the wrong type or value, or one that is required is missing.

to_dict()

Return the turn as JSON data, leaving out fields that are not set.

ChatBar

Bases: Viewer

The bar above a chat: its title, answer count and time, Make a dashboard and a menu.

back = pmui.IconButton(icon='arrow_back', description='Back to chats', size='small', margin=(0, 4, 0, 0), stylesheets=[_ON_PHONE_ONLY], css_classes=['fd-chat-back']) instance-attribute

editable = param.Boolean(default=True, doc='Whether the title may be changed.') class-attribute instance-attribute

field = pmui.TextInput(visible=False, size='small', margin=0, sizing_mode='stretch_width', max_width=520, css_classes=['fd-chat-title-field']) instance-attribute

heading = pmui.Typography('', variant='subtitle1', disable_math=True, margin=0, sx={'fontWeight': 500, 'fontSize': '1.05rem', 'whiteSpace': 'nowrap', 'overflow': 'hidden', 'textOverflow': 'ellipsis'}, align='center', min_width=0, styles={'flex': '0 1 auto', 'min-width': '0'}, css_classes=['fd-chat-title']) instance-attribute

make = make instance-attribute

menu = pmui.MenuButton(label='', icon='more_vert', variant='text', color='default', size='small', margin=(0, 0, 0, 8), sx=_OVERFLOW_SX, description='More chat actions', css_classes=['fd-chat-menu']) instance-attribute

meta = param.String(default='', doc='How many answers it has and when it was last asked.') class-attribute instance-attribute

note = pmui.Typography('', variant='caption', margin=(0, 8), align='center', sx={'color': 'text.secondary', 'whiteSpace': 'nowrap'}, stylesheets=[_OFF_PHONE], css_classes=['fd-chat-meta']) instance-attribute

rename = pmui.IconButton(icon='edit', description='Rename the chat', size='small', margin=(0, 4), sx={'color': 'text.secondary', '& .MuiSvgIcon-root, & .material-icons': {'fontSize': 16}}, stylesheets=[_OFF_PHONE], css_classes=['fd-chat-rename']) instance-attribute

title = param.String(default='', doc="The chat's title.") class-attribute instance-attribute

start_rename()

Swap the title for a field to type the new one in; Enter keeps it.

ChatOutline

Bases: Viewer

The chat's answers, listed to the right of the reading column, with the one in view marked.

active = param.Integer(default=None, allow_None=True, doc='The index of the answer in view.') class-attribute instance-attribute

items = param.List(default=[], doc='Dicts with a ``label``, an ``icon`` and a ``key``.') class-attribute instance-attribute

list = pmui.MenuList(items=[], dense=True, margin=0, sizing_mode='stretch_width') instance-attribute

ExploreFeed

Bases: Viewer

The Explore view of a :class:~panel_flowdash.editor.FlowDash editor.

Without an agent it shows every turn, projected. :meth:attach connects the Explore view's runner: the feed then shows the requests asked in the Explore view, its runs in full as they happen, and gets a composer for people who may edit the dashboard.

actions = ActionRegistry() instance-attribute

add_target = AddTargetDialog(lambda: self.explorations, self._open_copy, on_done=self._after_copy) instance-attribute

chat property

The chat showing the feed, built for the person's rights and the attached agent.

chat_class = _FeedChat class-attribute instance-attribute

column_labels = param.Callable(default=None, doc="\n Called with a column name to label it in words on a card's Data tab,\n returning None to keep the default, e.g. from a table's descriptions.") class-attribute instance-attribute

docked = param.Boolean(default=False, doc="\n Whether the feed is docked in Ask beside the dashboard or the report,\n which show the dashboard's views. A view is on screen only once, so\n the card of a dashboard node then says where its view is instead.") class-attribute instance-attribute

editor = param.Parameter(doc='The FlowDash editor whose dashboard the feed shows.') class-attribute instance-attribute

explorations = None instance-attribute

maker = MakeDashboardDialog(lambda: self.explorations, self._open_copy, on_done=self._after_copy) instance-attribute

model_actions property

The entries below the models in the composer's model menu, for another composer such as Ask's.

model_id property

The model the chat asks with, if it has a composer.

open_sql = param.Callable(default=None, doc="\n Called with an answer's query and the node that runs it to open the\n query in the host's SQL editor. Without it the card's SQL tab offers\n Copy SQL only.") class-attribute instance-attribute

outline = ChatOutline(on_pick=self._show_answer) instance-attribute

page_actions = {} instance-attribute

page_size = param.Integer(default=20, bounds=(1, None), doc='\n How many of the latest entries the feed shows at first, and how many\n older ones each "Show earlier requests" adds. Bounding the feed keeps\n switching to Explore quick on a dashboard with a long history.') class-attribute instance-attribute

runner = None instance-attribute

scope_chip = ScopeChip(on_change=self._set_scope) instance-attribute

shown = param.Boolean(default=False, doc="\n Whether the feed is on screen. While hidden it only records the\n agent's events, and catches up when shown.") class-attribute instance-attribute

snackbar = Snackbar() instance-attribute

state = RunState(flush_interval=0) instance-attribute

answer_card(run_id, node)

Return the card shown for the answer node of run run_id, e.g. to show its SQL tab.

attach(runner, chat_params=None, model_chat=None, foreign=None, explorations=None, add=None, show=None, handover=None, open_dashboard=None, copied=None)

Ask the Explore view's agent runner (a panel-agents AgentRunner) and show its runs.

chat_params are passed to the composer's chat, e.g. the models a person may pick from, and model_chat is another chat, such as the drawer's, whose picked model the composer shares. foreign tells whether a run id is another runner's, which the feed then never counts as asked in Explore, whatever the id looks like.

explorations is the session's :class:~panel_flowdash.agent.exploration.ExplorationOps, where the runner builds its answers; their cards show the exploration's nodes. add is awaited with a run and one of its answer nodes to add the answer to the dashboard, returning the node's name there, and show shows a dashboard node, e.g. an answer once added. handover is called with a node added from a card in view mode, which switched to edit mode, the surface it was added from and the revision of the canvas before, if it had no unsaved changes then, to show the node and hand it to the assistant; without it show shows it.

In a chat, open_dashboard opens a dashboard by id, one an answer was copied onto, and copied is called after each copy, e.g. to list a new dashboard.

make_dashboard()

Open the dialog making a dashboard from the chat's answers.

model_options()

Return the models offered, the model picked now and how the pick is remembered.

These are what the feed's composer offers, for another composer asking the same runner, such as the Ask landing's.

project()

Return the feed's runs as events, oldest first, and its cards by artifact id.

With an Explore agent attached the feed holds the Explore view's own requests only; without one it is the record of every turn.

refine(run_id, node)

Put the answer's card in the composer as a mention, so the next question builds on it.

refresh()

Update what the cards say about their nodes: changed later, on the dashboard.

show_earlier()

Add the next page of older entries above those shown.

The entries shown stay as they are and the older ones go in before them, so the feed keeps the reader at the same entry.

show_waiting(waiting)

Say that the question asked waits for waiting, e.g. "the assistant's edit", or stop saying it.

sync()

Bring the feed up to date with the dashboard's turns and the agent's runs.

New runs and cards are appended, a turn's change list that grew is updated in place, and a card whose node changed kind gets a new version. Only when what was shown no longer holds, e.g. after an undo removed turns or nodes, is the feed rebuilt.

FlowDash

Bases: Viewer

A dataflow wiring canvas and dashboard layout editor over a set of components.

The editor pairs a ReactFlow canvas, where components are placed and their typed ports wired together, with a tile grid that lays the same components out as a dashboard. Everything to do with routing, pages and identity lives in :class:~panel_flowdash.app.FlowDashApp instead, so this can be embedded anywhere.

Parameters:

Name Type Description Default
components

The components to offer. Accepts a decorated function, a Viewer subclass, a mapping of explicit component ids, a project directory to scan, or a list mixing any of those. See :func:~panel_flowdash.component_library.normalize_components.

None
settings_class

A subclass of :class:~panel_flowdash.settings.DashboardSettings adding dashboard-wide parameters of your own, persisted with each dashboard.

required

Examples:

>>> editor = FlowDash(components=[ticker_select, price_chart])
>>> src = editor.add_component("Components/ticker_select")
>>> dst = editor.add_component("Components/price_chart")
>>> editor.connect(src, "ticker", dst, "ticker")
True

agent_state = param.ClassSelector(class_=RunState, default=None, allow_None=True, doc='\n The panel-agents ``RunState`` holding the agent\'s runs, which\n "How was this made?" shows. None uses the edit history\'s, which an\n assistant shares when history is on.') class-attribute instance-attribute

ask = param.Boolean(default=False, doc="\n Whether Ask is open. In view mode it docks the Explore view's feed\n left of the dashboard or the report, resizable by its right edge;\n on a phone, which has no room for it, Ask is the Explore view\n itself. In edit mode it is the host's assistant, see `assistant`.\n Edit mode starts with Ask as view mode left it, and view mode gets\n back the Ask it had as edit mode ends, whatever happened to the\n assistant meanwhile; `set_ask_aside` closes it for something taking\n its place in view mode without changing what view mode gets back.") class-attribute instance-attribute

ask_docked property

Whether Ask is docked left of the dashboard or the report: open, in view mode, on a wide screen.

assistant = param.Boolean(default=False, doc="\n Whether a host docks an assistant beside the editor that Ask opens in\n edit mode, as FlowDashApp does with its agent's drawer. Without one,\n Ask is offered in view mode only.") class-attribute instance-attribute

authorize_admin = param.Callable(default=None, doc='\n Called with a keyword ``fresh`` to decide whether this session\n administers the project. Node actions registered as ``admin_only``\n (see :mod:`panel_flowdash.node_actions`) are offered while it says so\n with ``fresh=False``, which should be cheap as menus ask it on every\n edit, and run only if it says so with ``fresh=True``, which should\n check again, e.g. with the project file read afresh. `FlowDashApp`\n supplies one. None makes no one an admin.') class-attribute instance-attribute

authorize_component = param.Callable(default=None, doc="\n Called with a component's `RegistryEntry` to decide whether this\n session may use it. Components it refuses are left out of the palette\n and `add_component` raises `PermissionError` for them; a loaded\n dashboard shows them as locked placeholders that are never created\n and are saved back unchanged. `FlowDashApp`\n supplies one that evaluates each component's ``allow_*``/``deny_*``\n rules and ``authorize`` callback against the signed-in user. None\n allows every component.") class-attribute instance-attribute

authorize_dashboard = param.Callable(default=None, doc='\n Called with the stored `AssetModel` and the access it needs,\n ``"view"`` or ``"edit"``, to decide whether this session may still\n read or overwrite it. `save` asks for ``"edit"`` against the\n dashboard\'s current sharing rules, so edit rights revoked from another\n session take effect without reloading; reloading and discarding\n changes ask for ``"view"``. `FlowDashApp` supplies one that checks the\n signed-in user. None allows both.') class-attribute instance-attribute

authorize_rename = param.Callable(default=None, doc="\n Called with the stored `AssetModel` to decide whether this session\n may rename it, as an administrator of the dashboard. `set_title` asks\n before renaming and `save` before storing a new title. `FlowDashApp`\n supplies one that checks the signed-in user. None lets only the\n dashboard's owner, the editor's `user`, rename it.") class-attribute instance-attribute

breakpoints = param.List(default=[768, 1200], doc='Responsive breakpoints for the tile grid.') class-attribute instance-attribute

can_redo property

Whether :meth:redo has an undone edit to redo.

can_undo property

Whether :meth:undo has an edit to undo.

code_drafts = param.Boolean(default=False, doc='\n Whether the code panel holds edits that have not been run. Managed by\n the editor; like ``dirty``, watch it to prompt before discarding work.') class-attribute instance-attribute

code_panel property

The :class:~panel_flowdash.ui.code_panel.CodePanel docked under the canvas, made on first use.

code_panel_node = param.String(default=None, allow_None=True, constant=True, doc='The id of the node the code panel under the canvas shows, or None while it is closed.') class-attribute instance-attribute

code_panel_open property

Whether the code panel shows a node, under the canvas or in the sidecar's Spec tab.

component_specs property

Specs for the available components, keyed by component id.

components = param.Parameter(default=None, doc='\n The components to offer in the editor. A decorated function, a Viewer\n subclass, a mapping of explicit component ids, a project directory, or a\n list mixing any of those. Read at construction time.') class-attribute instance-attribute

context = copy_context(self.context) class-attribute instance-attribute

controls_bar = param.Boolean(default=True, doc='\n Whether to show the views of components registered with\n ``sidebar=True`` beside the tiles (see `controls_position`), while\n the dashboard is viewed or laid out. Turn it off to render the\n `sidebar` views in a layout of your own instead. In full screen the\n editor shows them either way, since nothing around it is visible, so\n leave them out of your layout while `fullscreen` is on.') class-attribute instance-attribute

controls_position = param.Selector(default='top', objects=['top', 'left'], doc='\n Default of the ``controls_position`` dashboard setting for dashboards\n that do not store one: where the views of components registered with\n ``sidebar=True`` go. "top" puts them in one slim row above the tiles,\n which suits the few filters most dashboards have; "left" stacks them\n in a collapsible panel left of the tiles, which suits many controls.') class-attribute instance-attribute

dashboard = param.ClassSelector(class_=AssetModel, default=None, doc='\n The dashboard currently loaded. Updated by `load`, `load_model`,\n `new_dashboard` and `save`. May be passed at construction as either a\n AssetModel or, when a store is configured, a dashboard id or title.') class-attribute instance-attribute

dirty = param.Boolean(default=False, doc='\n Whether the canvas has unsaved changes. Managed by the editor; watch it\n to prompt before discarding work.') class-attribute instance-attribute

edit_history property

The versions of the open dashboard, one per edit; see :mod:panel_flowdash.history.

Its state is the panel-agents RunState they are published in, to show them in an ArtifactView or share with an AgentRunner.

editable = param.Boolean(default=True, doc='\n Whether the dashboard can be edited. When False the side panel is hidden\n and the tile grid is shown locked, giving a pure view of the dashboard.') class-attribute instance-attribute

edited = param.Event(doc='Triggered after each edit is recorded in its turn.') class-attribute instance-attribute

explore = param.Boolean(default=False, doc="\n Whether the Explore view is shown in place of the workspace: the same\n as ``surface == 'explore'``. Setting it to False returns to the\n workspace. Ask (`ask`) docks the same feed beside it instead.") class-attribute instance-attribute

explore_feed property

The :class:~panel_flowdash.explore.ExploreFeed the Explore view shows, made on first use.

feed_shown property

Whether the Explore view's feed is on screen, docked in Ask or as the Explore view.

filters property

The dashboard's global filters as a copy, the views they exclude by instance id.

See :mod:panel_flowdash.global_filters.

fullscreen = param.Boolean(default=False, doc="\n Whether the dashboard is presented on its own: the tiles and the\n controls bar fill the screen, without the dashboard bar or the page\n around the editor, and a small overlay shows the title, the health and\n an exit button while the pointer moves. Turning it on from a click\n also puts the editor into the browser's full screen; otherwise, e.g.\n when set at load time, the editor covers the browser window. Leaving\n the browser's full screen turns it off. Only available in view mode:\n switching to edit mode turns it off.") class-attribute instance-attribute

graph property

The live dataflow graph wiring the placed components together.

groups property

The groups on the canvas by id, as copies, nodes by instance id.

See :mod:panel_flowdash.groups.

header_layout = param.Selector(default='compact', objects=['compact', 'full'], doc='\n Default of the ``header_layout`` dashboard setting for dashboards that\n do not store one: how the dashboard bar is laid out. "compact" keeps\n it to one line, which a FlowDashApp with the default navigation folds\n into its top bar; "full" gives it a row of its own with a large title\n over the description, the health chip and when the dashboard was last\n refreshed.') class-attribute instance-attribute

history = param.Boolean(default=True, doc="\n Whether every edit becomes a version of the dashboard's edit history,\n which `undo` and `redo` move through and the store keeps across\n sessions (see `history_limit`). Read at each edit.") class-attribute instance-attribute

history_coalesce = param.Number(default=BURST_SECONDS, bounds=(0, None), doc="\n Seconds without an edit that end a batch of the person's edits in\n the edit history, so a burst of edits, such as a drag, typing into\n a config field or a few quick changes, is one version. An edit of the\n agent, a save, undo and redo end a batch too, and each request to the\n agent is one version. Zero records each of the person's edits on its own.") class-attribute instance-attribute

history_limit = param.Integer(default=500, bounds=(1, None), allow_None=True, doc="\n The most versions a dashboard's stored history keeps; older ones are\n dropped. None keeps them all.") class-attribute instance-attribute

history_max_bytes = param.Integer(default=HISTORY_MAX_BYTES, bounds=(0, None), allow_None=True, doc="\n About how many bytes of dashboard YAML a dashboard's stored history\n keeps; the oldest versions are dropped past it, the latest is always\n kept. None keeps versions however large they are.") class-attribute instance-attribute

history_max_days = param.Number(default=90, bounds=(0, None), allow_None=True, doc="\n How many days the store keeps a version of a dashboard's history.\n None keeps versions however old they are.") class-attribute instance-attribute

import_unknown_components = param.Boolean(default=True, doc='\n Whether importing a file may add or change items whose component this\n editor does not offer. They are imported as they are, shown as\n unavailable and saved back unchanged, so a dashboard keeps them until\n the component is offered again. Set it to False when users are\n restricted by giving each a smaller set of components rather than\n through `authorize_component`: a component one user lacks may be one\n another has, so such an item is then treated like a restricted one,\n keeping its stored config and wiring or being left out of the import.\n `authorize_component` is the better mechanism, since it also shows a\n known but denied component as restricted rather than unavailable.') class-attribute instance-attribute

include_builtin_components = param.Boolean(default=True, doc='Include Select, MultiChoice and Slider in the component palette.') class-attribute instance-attribute

include_page_dialog = param.Boolean(default=True, doc="\n Whether the editor lays out the session's page dialog, the one\n `open_dialog` and `confirm` use. Set it to False when the surrounding\n page already places `page_dialog()` itself, as `FlowDashApp` does; the\n dialog must appear in only one layout. Read when the workspace is built,\n so it needs a served session to take effect.") class-attribute instance-attribute

inspect_outputs = param.Boolean(default=False, doc="\n Whether each tile in the dashboard grid gets an Inspect action that\n opens a side sheet with the current value of every output the\n component publishes. The action is shown in the dashboard view and in\n preview, not while arranging tiles. It reveals outputs the tile itself\n may not display, so while the editor is ``read_only`` (in a\n ``FlowDashApp``, for anyone who may not edit the dashboard) it is only\n shown if the dashboard's ``viewers_can_inspect`` setting allows it. A\n component can add its own explanation per output by defining\n ``__flowdash_inspect__(self, port)``.") class-attribute instance-attribute

is_chat property

Whether the loaded asset is a chat, which shows its own bar in place of the dashboard bar.

is_report property

Whether the loaded asset is a standalone report, which has no tile grid.

layout property

The current tile layout, whether or not the grid is on screen.

One entry per tile, keyed by the tile's instance_id.

mode = param.Selector(default='wiring', objects=['wiring', 'dashboard', 'split'], doc="\n Which workspace is shown: 'wiring' for the ReactFlow canvas, 'dashboard'\n for the tile grid and 'split' for both side by side, with the canvas\n on the left. Only meaningful while `editable`.") class-attribute instance-attribute

node_previews = param.Boolean(default=False, doc='\n Default of the ``node_previews`` dashboard setting for dashboards that\n do not store one: whether each card on the wiring canvas previews its\n current value below its ports, e.g. the first rows of a table or a\n sparkline of a series, rather than summarizing it in one line.') class-attribute instance-attribute

notifications = param.Boolean(default=True, doc='\n Whether to surface user-facing messages as Panel notifications. When\n disabled (or when no notification area exists) messages are logged.') class-attribute instance-attribute

parameters property

The parameters of the open dashboard by name, as copies, nodes by instance id.

Parameters on nodes the user may not use are left out. See :mod:panel_flowdash.parameters.

popup_hover_delay = param.Integer(default=500, bounds=(0, None), doc='Delay in milliseconds before a hover value preview opens.') class-attribute instance-attribute

popup_trigger = param.ObjectSelector(default='click', objects=['click', 'hover', 'none'], doc='\n Whether live port values open on click, hover, or not automatically.\n On hover the popups cover the nodes the pointer passes over, so they\n open on click by default.') class-attribute instance-attribute

preview = param.Boolean(default=False, doc="\n Lock the tile grid as an end user sees it without leaving edit mode.\n Only meaningful while `editable` and in 'dashboard' mode. The\n dashboard bar offers no control for it, since view mode is the preview.") class-attribute instance-attribute

project = param.ClassSelector(class_=Project, default=None, allow_None=True, doc='\n The project file the app reads, which node actions get to save a\n section of it with ``Project.set``. `FlowDashApp` supplies its own.') class-attribute instance-attribute

propagate_failures = param.Boolean(default=False, doc='\n Carry a failing output or edge transform downstream instead of leaving\n the connected inputs on their last value. An input declared in\n `handles_failures` receives the failure as a `param.ReactiveError`; the\n tile of a component with any other failed input is covered by a message\n naming the failure, and its outputs pass the failure on. Read at\n construction time.') class-attribute instance-attribute

provenance = param.Boolean(default=True, doc='\n Whether a node an agent\'s request created offers "How was this\n made?", in its tile\'s More menu and in the inspector, opening a side\n sheet with that request: its question, model calls, tool calls and\n the versions it published, from the run the node\'s origin turn\n names. People who may not edit the dashboard see the request\'s\n shape without its content.') class-attribute instance-attribute

provenance_labels = param.Boolean(default=False, doc='\n Whether the views of nodes that report their provenance (see\n :mod:`panel_flowdash.node_actions`), e.g. "Metric: capacity" or "Ad\n hoc", show it as a chip in view mode too. While the dashboard is\n edited the chip is always shown, and so is a warning (a provenance\n whose level is "warning", e.g. that a row limit cut the numbers).') class-attribute instance-attribute

read_only = param.Boolean(default=False, doc='\n Whether saving is forbidden. The canvas can still be rearranged but\n `save` refuses. Set this from your own authorization logic.') class-attribute instance-attribute

refresh = param.Event(doc='\n Triggered every ``settings.refresh_period`` seconds while a dashboard is\n shown, and whenever the user clicks the refresh button. Components that\n show live data subscribe to it, see `current_dashboard`.') class-attribute instance-attribute

refuse_placement = param.Callable(default=None, doc='\n Called with a component id to ask whether this session may add new\n instances of it: None if it may, else why not, e.g. ``"turned off by\n an admin"``. A refused component is left out of the palette, the\n command palette and the agent\'s components, and `add_component`\n raises `PermissionError` for it. Unlike `authorize_component`, it\n leaves the instances a dashboard already places alone, and they keep\n working; editors are told once when a dashboard they edit has some.\n `FlowDashApp` supplies one from the project file\'s ``components``\n section.') class-attribute instance-attribute

report property

The dashboard's report as a copy, nodes by instance id, or None if it has none.

Blocks referring to nodes, groups or turns the dashboard no longer has are left out. A dashboard without a report reads as the one :func:~panel_flowdash.report.report_blocks derives from its layout. See :mod:panel_flowdash.report.

report_view property

The :class:~panel_flowdash.ui.report_view.ReportView the Report view shows, made on first use.

retitled = param.Event(doc="Triggered when the open dashboard's title changes in the editor, e.g. by set_title or undo.") class-attribute instance-attribute

run_pending = param.Callable(default=None, allow_None=True, doc="\n Called with the id of a pending turn when an editor runs its question\n from the report, e.g. to ask the assistant, which then answers it\n through :meth:`answer_pending`. None, the default without an agent,\n leaves the report's Run buttons disabled.") class-attribute instance-attribute

running_pending = param.List(default=[], item_type=str, doc='\n The ids of the pending turns whose question is being run, from the\n click on Run until the request answering it ends. Their Run buttons\n show that they are running and cannot be pressed again.') class-attribute instance-attribute

saved = param.Event(doc='Triggered after a dashboard is successfully saved.') class-attribute instance-attribute

settings = param.ClassSelector(class_=DashboardSettings, constant=True, doc="\n The dashboard-wide settings, an instance of `settings_class`. Filled\n from the loaded dashboard and written back on save. Edited in edit mode\n through the dashboard bar's Settings form.") class-attribute instance-attribute

settings_class = param.ClassSelector(class_=DashboardSettings, default=DashboardSettings, is_instance=False, doc='\n The class of `settings`. Subclass `DashboardSettings` to add your own\n dashboard-wide parameters. Read at construction time.') class-attribute instance-attribute

show_in_editor = param.Callable(default=None, allow_None=True, doc="\n Called with a tile's instance id when someone viewing the dashboard\n asks to see that component in the editor, from the tile's More menu or\n its failure message. The action is offered in view mode while this is\n set and `read_only` is False; the caller decides what showing a\n component in the editor means, e.g. switching to edit mode.") class-attribute instance-attribute

sidebar = Children(default=[], doc='\n Views of placed components that declare `sidebar=True`, which are kept\n out of the tile grid. Managed by the editor; render these wherever your\n layout wants them.') class-attribute instance-attribute

store = param.ClassSelector(class_=BaseAssetStore, default=None, doc='\n Dashboard persistence backend. Accepts a store instance or a path to a\n SQLite file. When None the editor is ephemeral and `save` merely returns\n the model for the caller to persist.') class-attribute instance-attribute

surface = param.Selector(default='workspace', objects=list(SURFACES), doc="\n What the editor shows, in view and in edit mode: 'workspace' for the\n canvas or the tile grid (as `mode` and `editable` say), 'explore' for\n the Explore view, the dashboard's turns as a feed with the outputs\n each made (see :mod:`panel_flowdash.explore`), or 'report' for the\n Report view, the dashboard read as a document (see\n :mod:`panel_flowdash.report`). The views of the tiles move between\n them, so only one is ever on screen.") class-attribute instance-attribute

tile_cards = param.Boolean(default=True, doc='\n Default of the ``tile_cards`` dashboard setting for dashboards that do\n not store one: whether tiles are drawn as framed cards. Each dashboard\n can change it in its settings.') class-attribute instance-attribute

tile_titles = param.Boolean(default=False, doc="\n Default of the ``tile_titles`` dashboard setting for dashboards that do\n not store one: whether a tile's card shows its title.") class-attribute instance-attribute

toolbar = param.Boolean(default=True, doc='\n Whether to render the dashboard bar above the workspace. In view mode\n it holds the title, Refresh and the View/Edit control; in edit mode\n the Dataflow/Layout tabs and the Settings, Discard, Save and Done\n actions. The component palette is shown regardless.') class-attribute instance-attribute

toolbar_extra = Children(default=[], doc="\n Additional items placed in the dashboard bar's actions, before the\n View/Edit control in view mode and after Settings in edit mode.") class-attribute instance-attribute

turns property

The turns of the open dashboard, oldest first, as copies.

A turn is one request to the agent, or one batch of the person's edits made between requests; each node records the turn that created it as its origin. The editor opens a turn at the first edit that needs one: an edit made in an agent's tool call joins the turn of that agent run, any other edit the person's open turn. See :mod:panel_flowdash.turns.

user = param.String(default='local', doc='Principal recorded as the owner of dashboards created here.') class-attribute instance-attribute

value_repr = param.Callable(default=None, allow_None=True, doc='Optional callable converting a live port value to a Panel viewable or displayable value.') class-attribute instance-attribute

add_component(component_id, config=None, position=None, instance_id=None, *, arrange=False)

Place a component on the canvas and return its instance id.

Parameters:

Name Type Description Default
component_id str

Id of a registered component.

required
config dict | None

Design-time configuration overrides for this instance.

None
position dict | tuple | None

Canvas position as {"x": ..., "y": ...} or (x, y). Defaults to a free spot near the top-left of the visible canvas.

None
instance_id str | None

Id for the new instance, which is also its node's name in the dashboard YAML, as a node a YAML file names gets it. It must be a valid node name without __, at most MAX_NAME_LENGTH (64) characters, that no node on the canvas has. Defaults to a generated <component>_<6 hex> id.

None
arrange bool

Without a position, place the node by its dataflow, beside the nodes it is connected to, and move it again as it is connected until someone moves it by hand, and lay its tile out with the tiles of its kind (see :mod:panel_flowdash.auto_layout). The agent's add_node does this.

False

Returns:

Type Description
str

The new instance's id, for use with connect and remove_component.

Raises:

Type Description
KeyError

If component_id is not a registered component.

ValueError

If instance_id is not a valid node name or is taken.

PermissionError

If authorize_component or refuse_placement refuses it.

answer_pending(turn_id, run_id=None)

Make the pending turn turn_id the turn of the agent request run_id's next edits.

The request's edits so far stay in its own turn. Its next edit runs the pending turn: the turn records the request, and the nodes the request creates get it as their origin, so the question's block in the report shows them as its answer. Without an edit the turn stays pending. The turn is returned.

Raises:

Type Description
ValueError

If no pending turn has the id turn_id.

arrange_canvas()

Lay out every node on the canvas by its dataflow, as one edit.

Sources go on the left and views on the right, in columns by their depth in the dataflow, ordered to reduce crossing edges. Positions set by hand are replaced too; that is what the request is for.

arrange_layout(order=None, style='grid', sizes=None)

Lay out every visible tile by its kind, as one edit.

Controls go first, then KPIs, both at their default width, charts in two columns, tables at full width and the tiles of data sources and transforms last; text tiles stay in front of the tile they preceded. Hidden tiles stay hidden. Layouts made for narrower breakpoint bands are dropped, so those bands follow the arranged layout again.

Parameters:

Name Type Description Default
order Sequence[str] | None

Instance ids of tiles to put first, in this order within their kind; the other tiles follow in their current order.

None
style str

"grid" lays the tiles out by kind as above, "stack" puts them one to a row at full width in their order.

'grid'
sizes Mapping[str, Mapping[str, float]] | None

The width and height of tiles sized on purpose, by instance id, which they keep; the other tiles of their rows make room for them.

None

ask_in_report(question, index=None)

Add a question to the report, not run yet, before the block at index (last for None).

The question becomes a pending turn and a turn block showing it, in one undoable edit, and its id is returned. A dashboard without a report of its own gets the derived one first.

Raises:

Type Description
ValueError

If question is empty or index is not a place in the report.

bind_parameters(values, *, timeout=None)

Write values into their parameters' fields, as one edit, after checking them.

Each value is read as its parameter's type, so text such as "10" for a number parameter is accepted. Before anything changes, the contract of each parameter's component checks the value against what the parameter recorded, the node's config takes the value, and the component's config check (register(check_config=...)) passes the result. Values that change nothing record no edit. Returns the warnings of the contracts.

Raises:

Type Description
ParameterError

If a name is not a parameter the user can see, a value is not of its type or not one the field takes, or a config check refuses it; nothing is changed.

ContractError

If a contract refuses a value; nothing is changed. Its problems name the nodes that would fail.

check_parameters(values)

Return what the contracts find wrong with binding values, without binding them.

Includes warnings, see :class:~panel_flowdash.parameters.ContractProblem.

Raises:

Type Description
ParameterError

If a name is not a parameter or a value is not of its type.

clear()

Remove every component and edge from the canvas.

close_code_panel()

Close the code panel, holding a draft it shows until the field is opened again.

collapse_group(group_id, collapsed=True)

Draw a group as one node with its ports, or expand it again, as one edit.

Expanding pushes the nodes to its right and below aside by the room the expanded group needs, and collapsing moves back the nodes it pushed that have not been moved since.

connect(source_id, source_port, target_id, target_port, transform=None, *, adjust_target=False)

Wire an output port to an input port.

Parameters:

Name Type Description Default
transform list[dict[str, Any]] | None

Steps applied to the values carried along the edge, see :meth:set_edge_transform.

None
adjust_target bool

Let the target component adjust its config to the new edge through its on_connect method (see :class:~panel_flowdash.Upstream), in the same edit. Off for edges that restore an earlier state, such as a load or an undo.

False

Returns:

Type Description
bool or str

True on success, or a message explaining the rejection (unknown port, type mismatch, cycle, an input that is already connected, or an invalid transform). An input fed by a component this session may not use counts as connected.

customize_report()

Make the report derived from the dashboard its own, to be edited, and return whether it did.

The derived blocks are written into the report as one undoable edit; the title stays the dashboard's until it is changed. A dashboard that already has a report keeps it.

declare_parameter(name, node, field, type='value', description=None)

Declare a parameter on a config field of a node, or redeclare one, and return it.

The parameter's expects is computed by the contract of the node's component, if it has one (register(contract=...)).

Parameters:

Name Type Description Default
name str

The parameter's name.

required
node str

The instance id of the node.

required
field str

The config field, or a dotted path into one, e.g. spec.tables.orders.

required
type str

One of :data:~panel_flowdash.parameters.PARAMETER_TYPES.

'value'
description str | None

What the parameter is, for whoever binds it.

None

Raises:

Type Description
ParameterError

If the name, field or type is malformed, the node does not exist, is one the user may not use, or the field is not one of its component's config fields, or the name is taken by a parameter the user may not see.

delete_group(group_id)

Remove a group and its nodes from the dashboard; returns the removed instance ids.

disconnect(source_id, source_port, target_id, target_port)

Remove the edge between two ports.

disconnect_input(instance_id, port)

Remove every edge into the input port of instance_id, as one edit.

dispose()

Tear down the editor, disposing every placed component.

Empties the dataflow graph, the canvas and the tile grid, then calls the dispose hook of each component that was placed, once. The editor is left empty and consistent, so it can still be used afterwards.

An editor created inside a server session disposes its components automatically when that session ends. In a notebook, under pyodide or for an editor created outside a session, call this yourself.

drop_code_drafts()

Forget the edits the code panel holds without running them, e.g. when leaving the dashboard.

edit_spec(instance_id, field=None)

Open the spec of the node instance_id in the code panel, showing the canvas if needed.

Where the browser keeps the panel in the sidecar, or the window is too narrow for it under the canvas, the sidecar's Spec tab shows it in the tab already open. Returns False to viewers.

end_agent_turns(run_id=None)

End the turns of the agent's requests, so the next request's edits start a new turn.

The dashboard tools call it when a request ends, whether it finished, failed or was cancelled. Each request's edits then become one version of the edit history. With run_id only that request's turn ends, so another agent's request running at the same time keeps its own.

end_ask_aside()

Let view mode keep Ask as it shows now, once what set_ask_aside made room for is gone.

E.g. the host's assistant closed in view mode without editing: Ask stays off, and edit mode ending later does not bring it back.

end_turn()

End the turn of the person's edits, so their next edit starts a new turn.

Call it when the person sends a request to an agent, which the FlowDash assistant does, so the edits made before and after the request form separate turns.

ensure_components_loaded(component_ids=None)

Import component modules and build their specs, if not done already.

Called automatically whenever specs are needed. On a live server prefer :meth:ensure_components_loaded_async, which imports off the event loop.

Parameters:

Name Type Description Default
component_ids Iterable[str] | None

Import only these components. Defaults to the whole catalog, which is what the editor palette needs; viewing a dashboard passes just the components it places, so an unrelated component doing work at import time cannot slow it down.

None

ensure_components_loaded_async(component_ids=None) async

Async :meth:ensure_components_loaded, importing off the event loop.

If the awaiting task is cancelled (e.g. by a newer navigation) the imports already running finish in their thread, but nothing is marked loaded and their import errors are not reported; the next call retries whatever is still unimported and reports its errors then.

exclude_from_filter(column, instance_id, excluded=True)

Opt the view instance_id out of the global filter on column, or back in.

expand_group(group_id)

Expand a collapsed group, see :meth:collapse_group.

export_dashboard(*, questions=True)

Return the canvas as a JSON-serializable dict, as the Download button writes it.

The dashboard id, owner and sharing rules are omitted, so the file can be loaded into any dashboard with :meth:import_dashboard. With questions False its turns leave out what was asked of the agent, see :func:export_model.

group_nodes(instance_ids, label=None, *, group_id=None, collapsed=False)

Frame nodes together on the canvas as one group, as one edit, and return its id.

The nodes keep their place, config, connections and tiles. A group can be collapsed into one node showing the ports its connections cross, see :meth:collapse_group.

Raises:

Type Description
ValueError

If there are no nodes, a node is not on the canvas or already in a group, or group_id is taken or not a valid name.

group_of(instance_id)

Return the id of the group a node is in, or None.

import_dashboard(data, *, keep_turns=False)

Replace the canvas with an exported dashboard, as dropping its file does.

data is a downloaded dashboard file, as JSON text or a dict, or a dashboard in the YAML format (see :mod:panel_flowdash.agent). The loaded dashboard keeps its id, owner, title and sharing rules, so saving writes the imported contents to it. Without a loaded dashboard the file's title is used and saving creates a new one. The canvas is marked dirty.

The import is an edit of its own, in the turn of whoever makes it (see :attr:turns). By default the file's turns and node origins replace the canvas's, and nodes the file gives no origin get the import's turn. With keep_turns the file's turns and origins are ignored instead: the canvas keeps its turns, nodes already on it keep their origin and new nodes get the import's turn. That is how the agent's changes are loaded, so it cannot rewrite who made what. Nodes are matched by name: a node given another component under the same name keeps its origin, and a renamed node is a new node with the import's turn as its origin. A file that changes nothing opens no turn.

Raises:

Type Description
ValueError

If data is neither a dashboard export nor a dashboard in the YAML format.

input_values(instance_id)

Return the literal values set on the unconnected inputs of a placed node, by port.

A connected input's literal is listed too; it applies once the connection is removed.

is_admin(*, fresh=False)

Whether this session administers the project, as :attr:authorize_admin says.

With fresh the host checks again from its sources, e.g. the project file read afresh, as before an admin action runs.

keep_tile_placement(instance_id)

Keep the tile of the node instance_id where it is when the agent's request ends.

While a request runs, tiles it adds are laid out only when it ends (all at once). A host that places the tile itself during the request calls this, so the layout at the end does not move it again.

later_turns(instance_id)

Return copies of the turns after a node's origin whose summary says they changed it.

load(asset_id)

Load a dashboard from the configured store, by id or title.

load_model(model)

Hydrate the canvas from an :class:AssetModel.

Items and edges that cannot be restored, such as a component this editor does not offer or an edge whose port no longer exists, do not abort the load. They are shown as placeholders and saved back unchanged.

Only the components the model places are imported, so a component that does work at import time cannot slow down dashboards that do not use it. On a live server prefer :meth:load_model_async, which imports off the event loop.

load_model_async(model) async

Async :meth:load_model, importing the model's components off the event loop.

made_by_agent(instance_id)

Whether "How was this made?" applies: an agent's request created the node.

may_rename()

Whether this session may rename the open dashboard, see :attr:authorize_rename.

A dashboard that is not stored yet may always be renamed.

new_dashboard(title)

Start a new empty dashboard, persisting it if a store is configured.

node_actions(instance_id, *, admin=None)

Return the registered node actions offered for a node to the person using the editor.

A restricted node or a placeholder gets none, nor does an action outside the editor's mode (see NodeAction.modes); an admin_only action needs :meth:is_admin, and an action whose applies fails is left out. admin says whether the session is an admin, which :meth:is_admin is asked otherwise.

node_component(instance_id)

Return the live component of the node instance_id, or None.

None for a function component, which has no instance, and for an id that is not on the canvas. The reverse of :meth:node_id.

node_id(component)

Return the id of the node component was created for, or None if it is not one of this editor's.

Only components that are Viewer classes are known by instance; a function component can call :func:current_node_id from its body.

node_inputs(instance_id, port=None)

Return the edges into the node instance_id, or only those into its input port.

Each is a dict with the source node's instance id, its source_port, the target (instance_id), the target_port and the edge's transform steps, in the order they were connected. Changing the dicts changes nothing on the canvas.

node_name(instance_id)

Return the name the node instance_id has in the dashboard YAML, e.g. "sales_chart".

node_names()

Return the YAML names of the canvas's nodes, by instance id.

They are worked out again only when the nodes change.

node_origin(instance_id)

Return the id of the turn that created a node, or None if no turn is recorded.

node_provenance(instance_id)

Return the provenance a node's numbers have, and the id of the node that reports it.

That is the node's own __flowdash_provenance__ or else the nearest upstream node's, following its inputs breadth first, each hook told the edges between it and this node (via), see :mod:panel_flowdash.node_actions. None when no node reports one.

note_own_run(run_id)

Record that the person using this editor asked for run run_id, so it is never redacted for them.

open_code_panel(instance_id, field=None, *, focus=True)

Edit the spec field field of the node instance_id in the code panel.

field defaults to the node's first spec field, a code field or a spec dict; a node without one shows its result only. The panel opens under the canvas where it was last docked there and fits, otherwise in the sidecar's Spec tab, which then shows the node. Returns False, leaving the panel as it was, where it cannot be shown: to viewers, or for a node or field it cannot edit. Callers then fall back to the field's own editor.

open_spec_in_sidecar(instance_id)

Move the code panel into the sidecar's Spec tab, remembered for the browser, showing instance_id.

origin_turn(instance_id)

Return a copy of the turn that created a node, or None if no turn is recorded.

parameters_schema()

Return the JSON Schema of a form binding the parameters, each defaulting to its field's value.

See :func:~panel_flowdash.parameters.parameters_schema.

provenance_warning(instance_id)

Return the nearest warning about a node's numbers, which tiles, reports and exports show.

Unlike :meth:node_provenance it looks past nearer provenance that is no warning, e.g. a capped analysis read through a node labelled "Derived": a label says what the nearest source is, a warning holds for everything computed from the numbers it is about. The walk stops :data:_PROVENANCE_DEPTH (64) edges up, so a warning further up than that is not found.

redo()

Redo what the last :meth:undo undid, all of it, and return whether anything was redone.

Redo is available until the next edit.

Raises:

Type Description
PermissionError

As for :meth:undo.

refresh_provenance(nodes=None)

Offer anew the node actions and provenance labels of every node, or of nodes and those downstream.

After an edit the editor does this itself for the nodes the edit may have changed. Call it when what a __flowdash_provenance__ hook or an action's applies reads changes outside the dashboard, e.g. a metric a project file defines being deleted. nodes are names as in the dashboard YAML, or instance ids.

remove_component(instance_id)

Remove a placed component along with its edges and its tile.

remove_parameter(name)

Remove a parameter; the node keeps the value its field holds.

Returns whether it existed; a parameter the user may not see counts as missing.

rename_group(group_id, label)

Change the label a group's header shows, as one edit.

report_shows(instance_id)

Whether a block of the report shows node instance_id, itself or with its group.

run_node_action(instance_id, key)

Run the node action key on a node, checking again that it is offered to this session.

An admin_only action asks :attr:authorize_admin afresh first.

Raises:

Type Description
PermissionError

If the action is not offered for the node, e.g. outside its modes or an admin_only action for someone who is no admin (any more).

run_redacted(run_id)

Whether a request is shown to the person viewing without its content.

Their own requests are always shown in full. Anyone else's are redacted for people who may not edit the dashboard, and when the request created or changed a node whose component this person may not use.

save(title=None)

Persist the current canvas and return the saved model.

With no store configured the model is still built and returned, so the caller can persist it themselves.

The owner, sharing rules and (unless title is given) title are taken from the stored dashboard rather than from the copy loaded into the editor, so saving never reverts a rename or sharing change made from another session since the dashboard was opened. If the dashboard is no longer stored (deleted from another session, or loaded from elsewhere), saving creates it with this editor's :attr:user as the owner, so it is never recreated under the previous owner's name.

Raises:

Type Description
RuntimeError

If :attr:read_only is set, or :attr:authorize_dashboard no longer grants edit access to the stored dashboard (which also sets :attr:read_only).

AssetConflictError

If the store holds a newer revision of the dashboard than the one loaded into the editor, because another session saved it since. Nothing is written; reload the dashboard or use :meth:save_as.

save_as(title)

Persist the current canvas as a new dashboard titled title and switch to it.

The new dashboard is owned by this editor's :attr:user and not shared with anyone. With no store configured the model is still built and returned.

Raises:

Type Description
RuntimeError

If :attr:read_only is set.

set_ask_aside()

Close Ask in view mode for something taking its place, such as the host's assistant.

View mode still gets Ask back as edit mode ends, e.g. after the assistant's first edit, as it does after Ask is closed in edit mode.

set_default(instance_id, config)

Give the node instance_id config values its component chose as a starting point.

A component calls it for a node :func:placement_context reports as "new", from its __init__ or function body, or later, e.g. once an input arrives. The values are saved with the dashboard like any config, and are part of the edit that brought them about: the placement, or the connection that delivered the input, so one undo takes back both. Values set outside any edit, e.g. by an input that arrives on its own, are recorded right away as a config edit of their own, so undoing a later edit keeps them. Called from a thread other than the session's event loop, they are set and recorded on the loop, as an edit of their own, and before a save.

Only fields still at their declared default take a value, so a node that arrives configured, e.g. one the agent adds or a duplicate, keeps its config. Returns whether any field took one: False, changing nothing, also while a dashboard is loaded or a version restored, to viewers and in a preview, and for a node or a config field the node does not have.

set_edge_transform(source_id, source_port, target_id, target_port, transform)

Replace the transform applied along an edge.

Each step is a dict naming an op from :data:panel_flowdash.transforms.TRANSFORMS plus its arguments, for example [{"op": "column", "column": "capacity"}, {"op": "aggregate", "how": "sum"}]. Pass an empty list to remove the transform.

Returns:

Type Description
bool or str

True on success, or a message explaining the rejection. A rejected transform leaves the edge on its previous one.

set_filter_value(column, value)

Change what the global filter on column keeps for whoever is viewing, without an edit.

value is a list of values for a select filter, [start, end] for a range, or None to keep every row.

set_filters(filters, *, label=None)

Replace the dashboard's global filters, views they exclude by instance id, as one undoable edit.

Raises:

Type Description
ValueError

If filters are malformed or exclude a node the dashboard does not have.

set_input_value(instance_id, port, value)

Give an input of a placed node a literal value, used while nothing is connected to it.

A connection always wins over the literal, which applies again once the connection is removed. None removes the literal, and the input goes back to its default. The change is recorded in the edit history.

Raises:

Type Description
KeyError

If no component is placed under instance_id.

ValueError

If the component has no such input, the input cannot hold a literal, e.g. a DataFrame, or it refuses value.

set_input_values(instance_id, values)

Set or remove (with None) the literal values of several inputs, as one edit.

Every value is checked before any is set, so a refused one changes nothing; see :meth:set_input_value.

set_report(report, *, label=None, coalesce=True)

Replace the dashboard's report, nodes by instance id, as one undoable edit.

None removes it, so the dashboard reads as its derived report again. label describes the edit in the history and the turn's summary, "Changed the report" by default, or a list of labels for an edit making several changes. A pending turn the report no longer refers to goes with its block, as it was only ever asked in the report. With coalesce False the edit is a version of its own, never batched with the quick edits before or after it, as for a structural change such as moving a block.

When the agent makes the edit, each block it adds or changes gets its turn as origin, and the blocks it leaves as they were keep theirs, whatever report gives.

Raises:

Type Description
ValueError

If report is malformed or refers to a node, group or turn the dashboard does not have.

set_title(title)

Rename the open dashboard as an edit: undoable, and stored when the dashboard is saved.

Raises:

Type Description
PermissionError

If the dashboard is read-only or this session may not rename it.

show_ask()

Bring the Explore view's feed on screen: Ask docked in view mode, the Explore view otherwise.

show_how_made(instance_id, turn_id=None)

Show the agent request that created a node, or the later turn turn_id that changed it.

It shows the request's span (question, model calls, tool calls and published versions) while :attr:agent_state holds the run's steps, and what the turn records otherwise, followed by the turns that changed the node later. In edit mode it opens the sidecar's History tab for the node; in view mode it opens the side sheet. Requests are redacted as :meth:run_redacted decides, and when the node's component is one the person may not use.

show_in_report(instance_id, label=None)

Append a block showing node instance_id to the report, unless a block shows it.

This is how a standalone report shows what is added to it, as a dashboard places a tile. Returns whether a block was added.

title_renamed(title)

Note that the open dashboard was renamed to title in the store, e.g. by the Rename action.

Undo then keeps that name rather than bringing back the old one.

to_model(title=None)

Serialize the current canvas into an :class:AssetModel.

The returned model is detached from the editor, so this is the seam to use when persisting to something other than the configured store.

toggle_palette()

Fold the component palette beside the canvas, or open it and focus its search field.

toggle_split()

Show the canvas and the tile grid side by side, or return to the previous tab.

trigger_refresh()

Trigger refresh with every change it causes delivered as one propagation pass.

A node fed by two sources that both run again then runs once, with both new values, instead of once per source.

undo(*, whole_runs=True)

Undo the last edit to the dashboard and return whether anything was undone.

A person's edits are undone one at a time, a gesture such as a drag as one edit. The edits an agent made for one request are undone together, back to the dashboard as it was before the request, unless whole_runs is False. Undo reaches back into earlier sessions, as far as the store keeps the dashboard's history (see :attr:history_limit).

Undoing restores the dashboard's turns and node origins as they were, and never brings back a node whose component the user may not use or that this editor does not offer.

Raises:

Type Description
PermissionError

If undoing would bring back such a node; nothing changes.

ungroup(group_id)

Remove a group's frame, keeping its nodes where they are, as one edit.

Returns the instance ids of the nodes that were in it.

MakeDashboardDialog

Bases: _ChatDialog

Picks a chat's answers and makes one new dashboard, laid out, or report from them.

confirm_label = 'Make' class-attribute instance-attribute

empty = pmui.Typography('This chat has no answers to make a dashboard from yet.', variant='body2', visible=False, margin=(0, 10)) instance-attribute

kind = pmui.RadioButtonGroup(options={'Dashboard': DASHBOARD_KIND, 'Report': REPORT_KIND}, value=DASHBOARD_KIND, size='small', margin=(0, 10, 8, 10), css_classes=['fd-make-kind']) instance-attribute

picked = pmui.CheckBoxGroup(options={}, value=[], inline=False, margin=(0, 10), css_classes=['fd-make-answers']) instance-attribute

offer()

Open the dialog with the chat's answers, picking those added somewhere, else all.

ScopeChip

Bases: Viewer

The chat's scope in its composer: the data it reads, and a menu to add or take some out.

button = pmui.MenuButton(label='', icon='dataset', variant='outlined', color='default', size='small', margin=0, css_classes=['fd-chat-scope']) instance-attribute

highlighted = param.Boolean(default=False, doc='Whether the chip is pointed out, e.g. by a notice.') class-attribute instance-attribute

offered = param.List(default=[], item_type=DataChip, doc='The data chips that may be added.') class-attribute instance-attribute

scope = param.List(default=[], item_type=DataChip, doc='The data chips the chat is scoped to.') class-attribute instance-attribute

Snackbar

Bases: Viewer

A short confirmation at the foot of the page with up to two actions, gone after a while.

open_button = pmui.Button(label='Open', variant='text', size='small', margin=0, css_classes=['fd-snackbar-open'], sx={'textTransform': 'none', 'color': 'primary.light'}) instance-attribute

paper = pn.Row(self.text, self.open_button, self.undo_button, self._close, visible=False, margin=0, styles=_SNACKBAR_STYLES, css_classes=['fd-snackbar']) instance-attribute

text = text_typography('', variant='body2', margin=(6, 8, 6, 0), sx={'color': 'inherit'}) instance-attribute

undo_button = pmui.Button(label='Undo', variant='text', size='small', margin=0, css_classes=['fd-snackbar-undo'], sx={'textTransform': 'none', 'color': 'primary.light'}) instance-attribute

hide()

show(text, on_open=None, on_undo=None, open_label='Open')

Say text, with Open and Undo where they are given.

_FeedChat

Bases: AnswerChat

The feed's chat: an answer's card has its own header and actions, so its cell's are hidden.

_answer_value(value)

_card_key(answer)

Return the CSS class naming an answer's card on the page.

_change_list(summary)

Return a turn's summary as a Markdown list, one change per item, read literally.

_file_slug(title)

Return a file name, without extension, made from a card's title.

_message(run_id, key, role, text, at)

_narrow_css()

Let the feed take the window's width on a narrow window.

The page's containers keep the minimum width of the editor's canvas and its panels, so the feed is limited to the window, less the navigation rail, which the shell hides below its narrow breakpoint.

_turn_time(turn)

answer_kind(title, component_id, role, tabular)

Return the tab an answer shows itself on: "chart", "number" or "data".

answers_meta(count, last, working, now=None)

Return the chat bar's note: "3 answers ยท today 10:45", or "working" while asking.

card_time(timestamp)

Return when a query ran, as the card says it: the time today, else the date and time.

derive_title(question, limit=60)

Return a card title made from the question asked: its first sentence, capitalised, without the question mark.

escape_markdown(text)

Escape text so a Markdown pane shows it verbatim, without HTML, formatting or math.

find_sql(editor, nodes)

Return the first of nodes whose config holds a query, as the query and the node.

A host's SQL component keeps its query in its config's sql, as Lumen's does.

is_explore_run(run_id)

Whether run_id is a request asked in the Explore view.

port_types_compatible(source, target)

Return whether an output of type source may connect to an input of type target.

An untyped port, or one typed any (object, a bare Parameter, a Selector or ClassSelector whose value type the name does not tell), connects to anything; otherwise the types must be equal or source a registered subtype of target.

text_typography(text, **params)

Return a pmui.Typography showing text, a string or a reactive one, as literal text.