Back to Skills

setup-python-tools

MUST be used when adding Pyodide or Python tool support to a Flows app. Do NOT manually configure usePyodideRuntime or wire pythonRuntime into useAtlasChat — this skill handles pyodide installation, hook setup, loading UI, and chat hook wiring. Prerequisite: integrate-atlas-chat (vendored src/atlas-agent + atlas chat wiring). Triggers: Pyodide, Python tools, pythonRuntime, usePyodideRuntime, runPythonCode, Python execution, client-side Python.

5stars1forksUpdated 6/27/2026

Security Assessment

Safe(100/100)
Security Score100/100

About setup-python-tools

Adds client-side Python tool execution to a Cognite Flows application by wiring Pyodide into an existing Atlas chat integration. Atlas agents can declare Python tools in their CDF configuration (type "runPythonCode"); when an agent calls one, it arrives as an auto-allowed toolConfirmation followed by a clientTool action, and the library fetches the tool's Python code from the agent config and runs it in the browser via a supplied pythonRuntime. The skill covers Pyodide installation, the runtime hook, the loading UI, and the chat-hook wiring so none of this has to be assembled by hand.

Use it after the prerequisite integrate-atlas-chat skill is complete, meaning the app already has the vendored atlas-agent sources under src/atlas-agent/ and the @sinclair/typebox peer dependency. The Python-related modules (python.ts, pyodide.ts, pyodide-react.ts, pyodide-runtime.ts) are copied from that skill. Pyodide must be installed at exactly version 0.29.3 to match the CDN artifacts loaded at runtime; a mismatched version causes errors.

Mechanically, the work reduces to two integration points: call usePyodideRuntime to obtain a runtime instance, and pass that pythonRuntime to useAtlasChat. The usePyodideRuntime hook accepts loadPyodide, the Cognite SDK client, and an optional requirements list (for example pandas and numpy), and returns runtime, loading, error, progress, and isReady fields for driving the UI. The first load downloads roughly 30MB and takes 30 to 60 seconds, after which it is cached and reloads in under two seconds. Guidance directs placing a compact loading pill above the chat input (not in the message list), showing a separate error badge, and disabling the entire input area and any suggestion chips until the runtime is ready. Notably, Python tools are never declared via the tools array because the agent already knows them from its CDF config.

FAQ

What is the prerequisite for this skill?

The integrate-atlas-chat skill must already be complete, so the app has vendored atlas-agent sources under src/atlas-agent/ (including react.ts for useAtlasChat) and the @sinclair/typebox peer dependency. The Python modules are copied from that skill's code directory.

Which version of Pyodide does it require?

Exactly [email protected], installed with the app's package manager. This version must match the CDN artifacts loaded at runtime, and installing a different version will cause errors.

Do I need to declare Python tools in the tools array of useAtlasChat?

No. Python tools are not declared to the agent via tools because the agent already knows about them from its CDF config. The library fetches the tool's code automatically when it is called and runs it through the provided pythonRuntime.

How long does Pyodide take to load?

The first load downloads roughly 30MB and takes about 30 to 60 seconds while it loads Pyodide, installs packages, and injects Cognite SDK credentials. Subsequent loads come from the browser cache in under two seconds.

Where should the loading indicator go?

Place it above the chat input rather than in the message list, kept compact as a pill or badge showing the stage text and percent from usePyodideRuntime's progress field, with a separate error badge if initialization fails. The entire input area and any suggestion chips should be disabled while loading.

Install setup-python-tools

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill