Pytensor Workflows logo

Pytensor Workflows

Organization
pymc-labs
pytensor-workflows

Build, differentiate, compile, and debug PyTensor symbolic computations for models. Use for symbolic tensor shape or dtype errors, named dimensions, indexing and broadcasting, vectorization and scan, numerical or sparse operations, symbolic RNG state, graph transformations and profiling, or custom differentiable Ops and backend lowering.

Overview

Publisherpymc-labs
Repositorypymc-modeling
Skill namepytensor-workflows
Stars
93
Forks
10
Bundled files
11
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 11 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by pymc-labs on GitHub. Read the source before you install it.

Installation

Install the Pytensor Workflows AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/pymc-labs/pymc-modeling/tree/main/skills/pytensor-workflows
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/pymc-labs/pymc-modeling.git /tmp/pymc-modeling
mkdir -p .claude/skills
cp -r /tmp/pymc-modeling/skills/pytensor-workflows .claude/skills/pytensor-workflows
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Pytensor Workflows in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Pytensor Workflows on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Pytensor Workflows is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

PyTensor workflows

Express the intended calculation, then verify its values, shapes, derivatives, and state transitions.

Establish the contract

  1. Use the project's existing environment. Check installed PyTensor and relevant backend versions before choosing an API; development builds may differ.
  2. State input/output shapes, axis meanings, dtypes, support, and mutable or random state. Named axes are not automatically coordinate-indexed arrays.
  3. Choose the simplest supported graph operation. Prefer existing tensor primitives to an unnecessary custom Op. Preserve the scientific calculation when diagnosing compiler or backend limitations.
  4. Check version-appropriate official documentation and installed source when a signature or backend limitation is uncertain.
  5. Define an independent numerical or analytic reference and meaningful failure cases before executing the example.

Select the relevant workflow

Read only the references needed for the calculation. This skill is independently installable; no other skill, host adapter, or service is required. If the graph belongs to a probabilistic model, numerical correctness does not replace its formulation, prior checks, inference diagnostics, or predictive criticism.

Verify the calculation

  • Compare compiled values to the declared reference over representative inputs, including relevant boundaries. Check shape and dtype as well as values.
  • For differentiable computations, check the required Jacobian/vector products or gradients independently. Explain nondifferentiable inputs and boundaries; never return fabricated zero gradients merely to make inference run.
  • For stateful computations, demonstrate both intended progression and reproducibility under a reconstructed initial state. Do not assume identical random numbers across different backend implementations.
  • Reproduce a compiler failure before fixing it. Correct the graph, input contract, or supported implementation rather than hiding the exception.
  • Separate compilation cost from repeated execution when profiling. Preserve existing compiler caches and report measurements rather than universal speed claims.
  • Record the exact modes/backends exercised. Missing optional dependencies, unsupported operations, and untested hardware are different states. Linux execution does not establish macOS or accelerator support.

Minimal runnable graph

This float64 vector example compiles a squared norm and its gradient, checks both against independent references, and exercises the rank contract.

python
import numpy as np
import pytensor
import pytensor.tensor as pt
from pytensor.gradient import grad

x = pt.vector("x", dtype="float64")
energy = pt.sqr(x).sum()
evaluate = pytensor.function([x], [energy, grad(energy, x)])

values = np.array([1.0, -2.0, 3.0], dtype="float64")
value, derivative = evaluate(values)
np.testing.assert_allclose(value, np.square(values).sum(), rtol=1e-12)
np.testing.assert_allclose(derivative, 2 * values, rtol=1e-12)
print("Squared norm:", float(value))  # 14.0
print("Gradient:", derivative)  # [ 2. -4.  6.]

try:
    evaluate(values.reshape(1, -1))
except TypeError as error:
    print("Rank-two input rejected:", error)
else:
    raise AssertionError("A vector input accepted a rank-two array")

Optional implementation examples

Prefer built-in operations for ordinary models. The reusable BinomialLogpOp illustrates a pointwise likelihood with explicit shape, support, and derivative contracts; it requires PyTensor, NumPy, and SciPy. Keep the modules in this skill's scripts/ directory together on the Python import path when using an example.

Import only the lowering needed before compiling for that backend:

  • Numba requires Numba.
  • JAX requires JAX/jaxlib with x64 enabled.
  • PyTorch requires PyTorch; this example is CPU-only.
  • MLX requires MLX with CPU float64 support.

These dependencies are optional and needed only for the corresponding examples. Importing the base Op does not register optional lowerings. Check values, derivatives, state, and unsupported inputs on the actual backend before using an extension in a model; a working forward calculation does not establish support for every shape-only, derivative, or accelerator graph.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Pytensor Workflows AI skill do?

Build, differentiate, compile, and debug PyTensor symbolic computations for models. Use for symbolic tensor shape or dtype errors, named dimensions, indexing and broadcasting, vectorization and scan, numerical or sparse operations, symbolic RNG state, graph transformations and profiling, or custom differentiable Ops and backend lowering.

Why use Pytensor Workflows on TypingMind?

Because you install it once and use it with any model. Pytensor Workflows is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Pytensor Workflows in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/pymc-labs/pymc-modeling/tree/main/skills/pytensor-workflows. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Pytensor Workflows?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Pytensor Workflows?

As many as you like. As long as a model supports skills, you can use Pytensor Workflows with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Pytensor Workflows AI skill free?

Yes. It is published on GitHub by pymc-labs under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇