Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Fabric Notebook Toolkit (fntk)

Agent Runtime Interface for Microsoft Fabric Notebooks — session management, code execution, Spark monitoring, all via CLI with structured JSON output.

Install

# Install the public alpha release
pip install fabric-notebook-toolkit

Quick Start

# Authenticate
fab auth login

# Discover resources
fntk discover whoami --json
fntk discover list-workspaces --json
fntk discover list-notebooks --workspace-id <WS_ID> --json

# Start session + execute code
fntk notebook start-session --workspace-id <WS_ID> --artifact-id <ART_ID> --json
fntk code run --workspace-id <WS_ID> --artifact-id <ART_ID> --code "print('hello')" --json

# Monitor Spark
fntk monitor list-apps --workspace-id <WS_ID> --artifact-id <ART_ID> --livy-id <LID> --json
fntk monitor get-diagnostic --workspace-id <WS_ID> --artifact-id <ART_ID> --app-id <APP> --json

# Download logs
fntk logs get-driver --workspace-id <WS_ID> --artifact-id <ART_ID> --livy-id <LID> --app-id <APP> --json

CLI Commands

fntk help              # Human-readable overview
fntk help --json       # Machine-readable manifest (for agents)
Domain Commands Description
discover whoami, list-workspaces, list-notebooks, list-lakehouses, get-capacity, spark-settings Resource discovery
notebook create, delete, start-session, get-session, list-sessions, delete-session, restart-kernel, interrupt-kernel, set-lakehouse, get-lakehouse, list-livy-sessions Notebook + session lifecycle
code run, get-result, cancel, cancel-all, ping Code execution
cell list, get, update, append, insert, delete, get-output, set-language, set-parameter Cell CRUD
monitor list-apps, get-diagnostic, get-stages, get-progress, get-executors, get-environment, get-sql, get-resources, get-advice, ... Spark monitoring
logs get-driver, get-executor, list-executors, get-livy, get-cell Log download
resource list, get, put, mkdir, delete, usage Resource folder files
server start, stop, status Local daemon management
init [path] Bootstrap repo agent instructions for Fabric workspaces
skill list, get Inspect built-in skill content

Output Format

All commands with --json return a stable envelope:

{
  "status": "success",
  "stage": "completed",
  "progress": 1.0,
  "message": "Found 14 notebooks",
  "data": { ... },
  "next_actions": [
    {
      "type": "once",
      "command": "fntk notebook start-session --workspace-id <WS> --artifact-id <ART> --json",
      "description": "Start a session on a notebook"
    }
  ],
  "plan_hints": ["Start a session", "Execute code"],
  "logs": [],
  "context": {"workspace_id": "..."},
  "error": null,
  "trace_id": "fntk-a1b2c3d4e5f6",
  "elapsed_ms": 234
}

next_actions Types

Type Description Fields
once Execute exactly once command, description
poll Retry until condition met command, retry_after, max_retries, stop_condition
conditional Execute if condition met command, stop_condition

Feature Flags

Config file: ~/.fntk/config.json

Flag Default Description
log_level info Logging verbosity
server_port 19876 Daemon port

Auth

fab auth login     # Preferred (Fabric CLI MSAL cache)
az login           # Fallback

Local Daemon (optional)

For long-running WebSocket connections and async execution:

fntk server start --json     # Start daemon on 127.0.0.1:19876
fntk server status --json    # Check status
fntk server stop --json      # Stop daemon

The daemon uses per-user auth nonce (~/.fntk/server.<port>.auth), bound to localhost only. Request tokens are forwarded on every session/code call. If a request token is supplied, it is authoritative: invalid or external tokens never fall back to the daemon's local identity. Managed sessions are bound to the authenticated principal; a mismatch closes the local WebSocket and returns SESSION_CONTEXT_MISMATCH.

Repository Init

fntk init bootstraps agent workflows. In a git repository it installs the bundled fabric-notebook-toolkit skill, detects Fabric workspace folders from .platform files, resolves workspace/capacity IDs, and writes per-workspace agent instructions. Outside a git repository it installs skills only, defaulting to user-global scope. When .vscode/settings.json contains fabric.dataEngineering.gitWorkspaceBindings, its workspace IDs and capacity IDs are used directly before any Fabric workspace listing is requested. VS Code JSONC comments and trailing commas are supported. When the selected host already has the global fabric-skills plugin, init reports it as found and does not register a marketplace or run a plugin installation. If a selected host CLI cannot be found, init completes its other stages and reports an actionable Fabric Skills warning in both text and JSON output.

In an interactive run, init installs the bundled fabric-notebook-toolkit skill first and lets you choose project or global scope. It then configures Fabric Skills for each selected host that does not already have it: Copilot and Codex offer global installation or skip; Claude Code offers project, global, or skip. Non-interactive runs preserve the default installation behavior.

Generated instruction targets use native agent mechanisms:

  • GitHub Copilot CLI: .github/instructions/*.instructions.md
  • Codex: workspace-local AGENTS.md
  • Claude Code: workspace-local CLAUDE.md
# Initialize the current git repo
fntk init

# Only scan one subtree for Fabric workspaces
fntk init fabric/yilintest2

# Initialize one explicit workspace folder
fntk init --workspace-folder fabric/yilintest2

# Non-interactive JSON mode with all enabled agent targets
fntk init --agent copilot codex claude -y --json

# Refresh previously installed skills/plugins only
fntk init --update-skills -y

# Re-identify workspaces and refresh managed prompts
fntk init fabric/yilintest2 --update-workspaces -y

# Refresh both installed skills/plugins and workspace instructions
fntk init --update -y

Flags:

Flag Default Description
[path] git root Optional subtree to scan for Fabric workspace directories
--workspace-folder PATH off Explicit workspace folder to initialize; cannot be combined with [path]
--agent NAME [NAME ...] GitHub Copilot CLI Agent integrations to generate; enabled CLI values are copilot codex claude
-g, --global off Install missing bundled skill user-globally instead of under the git root
-y, --yes off Skip interactive prompts; use defaults
--skip-fntk-skill off Do not install the bundled fabric-notebook-toolkit skill
--skip-fabric-skills off Do not install the external fabric-skills plugin
--update off Refresh installed skills/plugins and managed workspace instructions
--update-skills off Refresh previously installed bundled skills and Fabric Skills plugins
--update-workspaces off Re-identify workspaces and refresh managed instructions
--output {text,json} text Output format; JSON mode also skips prompts

If an agent instruction file already exists, interactive runs ask before appending/updating the FNTK managed prompt block. Non-interactive runs skip existing files unless -y is set, and generated prompt content includes FNTK markers for future updates.

At the interactive workspace-name prompt, enter :i to ignore that workspace folder. Other input, including skip, is treated as a workspace name.

Interactive terminal output uses color for headings, success, warnings, and errors. Set NO_COLOR=1 (or use redirected/JSON output) for plain text.

Upgrade flow: after installing a newer fntk, run fntk init --update-skills -y to refresh installed skills/plugins, then run fntk init [path] --update-workspaces -y to re-resolve workspaces and refresh managed prompt blocks.

Each invocation emits one aggregate init.summary metric, including the selected agent types, skill/instruction outcomes, completed stage, error code, and counts for detected, automatically resolved, user-renamed, explicitly ignored, and unresolved workspaces. The event does not include repository paths, workspace names or IDs, prompt input, or free-form error messages.

Bundled skill content remains inspectable with fntk skill list and fntk skill get <skill-id>.

For AI Agents

Agents can discover all capabilities via:

fntk help --json    # Returns full manifest: domains, commands, workflows, schemas

The manifest includes state machine definitions, output schema, and recommended workflows. See AGENTS.md for detailed agent integration guide.

Client attribution for integrations

Agent hosts should attach self-asserted caller metadata to each top-level FNTK invocation. fntk init generates the appropriate canonical client name for GitHub Copilot CLI, Claude Code, and Codex; terminal users do not configure it.

fntk code run ... --client-name github-copilot-cli --client-version 1.0.0

Operational commands accept --client-name, optional --client-version, --invocation-id UUIDv4, and --client-attribution {auto,explicit-only,off} at either the root or leaf position.

MCP hosts may declare connection metadata through initialize.params.clientInfo. A tools/call may override it using params._meta keys io.microsoft.fntk/client-name, io.microsoft.fntk/client-version, and io.microsoft.fntk/invocation-id.

Attribution is self-asserted telemetry metadata. Names are normalized to a fixed low-cardinality set, versions are bounded, and localhost caller headers are not forwarded to Fabric or WebSocket services. Disable attribution for one invocation with --client-attribution off.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fabric_notebook_toolkit-0.0.1a5-py3-none-any.whl (253.3 kB view details)

Uploaded Python 3

File details

Details for the file fabric_notebook_toolkit-0.0.1a5-py3-none-any.whl.

File metadata

File hashes

Hashes for fabric_notebook_toolkit-0.0.1a5-py3-none-any.whl
Algorithm Hash digest
SHA256 d75903826bd3fdb7112af2272bd4eee7afeab2c6d3adb584997baa50d1bacaab
MD5 b812c97307356044b625904c2d09edc9
BLAKE2b-256 e0a0da9bea01f6421a112eaf8373e4e1e88cc73be868aac8b06f2f6bfda149ff

See more details on using hashes here.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page