Skip to main content
These examples assume an authenticated active saved profile with the intended organization and project. Confirm it with tp context show before running commands. Add root --json before the command when machine parsing needs JSON output; use root --profile <name> only to override the active profile.

Check context and available resources

Home and Canvas pages

Prefer idempotent apply by title for repeatable page creation:
Use this path for recurring agent-created reports so reruns update the same titled page instead of creating duplicate pages. Use direct canvas pages create only for one-off pages, experiments, or exact REST payload checks. Canvas renders the page title as the visible page heading. Do not duplicate that title as the first body H1. For document pages, begin body content with an introductory paragraph or a second-level section heading. For example, use:
Do not use:
Use direct Canvas create/update when exact REST behavior is needed:

Minimal page specification

Use contentWidth: "wide" or "full" only when the user asks for it or the page needs more horizontal room, such as dense dashboards, large tables, or embedded apps. Dashboard pages commonly use "full":

Dashboard widgets

Lakehouse-backed analysis dashboards should keep visualizations live with lakehouse-query widgets. Common configs: Discover the backend-supported visualization catalog before choosing a config:
Use the explicit field roles below. The backend retains legacy column-order and yFields fallbacks for compatibility, but newly generated dashboards should not depend on them. Standard agent procedure:
  1. Run tp canvas visualizations list.
  2. Run tp canvas visualizations describe <id> when details are needed.
  3. Inspect the Lakehouse schema and preview the SQL.
  4. Create or apply the dashboard JSON using the documented camelCase roles.
  5. Run tp canvas dashboard lint, schema, query, and validate-page.
Validate Lakehouse SQL before creating a widget:
Preview is cached by default. Use --fresh only to verify a newly written Gold table. During layout changes, reuse the schema and preview result rather than reissuing SQL. For dashboards with global filters, prefer dashboardDefinition datasets and bindings. Generate or validate the spec before creating the page:
Minimal filtered Lakehouse dashboard pattern:
For project-scope validation, fully qualify tables with the project catalog. This also applies to metadata queries such as ${TP_DATABRICKS_CATALOG}.information_schema.tables; unqualified information_schema.tables can be rejected by the project catalog guard. If the current local agent environment has working Databricks CLI auth, direct Databricks commands are acceptable for inspection or troubleshooting, but keep Canvas widget validation anchored to tp lakehouse so the query is checked through ThinkPlatform’s project-scoped API:

Cost-aware execution routes

  • Local Agent/Codex: use tp canvas ... and tp lakehouse ...; keep preview cached.
  • ThinkPlatform Agent: use Canvas MCP tools and the Databricks SQL preview system tool with fresh=false.
  • Set refreshSeconds: 0. Use 900 seconds or longer only when the user explicitly requires automatic refresh.
  • Prefer one dashboard dataset for widgets sharing source SQL or filters. Use a precomputed Gold table when the same expensive aggregation is viewed frequently.
  • Run lint, schema, and a bounded query while authoring; run validate-page once after the full page is ready.

Dynamic UI

Embed a persisted Dynamic UI in Canvas with a dynamic-ui widget and the created uiId.

Verification checklist

  • Read back the page/app by ID.
  • Confirm layout.surface, block count, widget kinds, and resource references.
  • For Mermaid or Dynamic UI, browser-check rendering when available.
  • For action surfaces, verify the action target exists and is discoverable.