Aug 17, 2026

Programmatic Access to NotebookLM with notebooklm-py

An unofficial Python API, CLI, MCP server, and agent skill for Google NotebookLM (now Gemini Notebook) — generate audio overviews, video explainers, slide decks, infographics, quizzes, and reports, and use it as cross-session memory for Claude Code.

#tutorial#python#ai-agents#productivity#developer-tools

NotebookLM's web UI is the most pleasant way to chat with a stack of sources. But the moment you want to script it — generate audio overviews on a schedule, embed a notebook as memory for an agent, or pipe YouTube transcripts through it — the browser becomes a wall. notebooklm-py is an unofficial Python API, CLI, MCP server, and agent skill that gives you programmatic access to NotebookLM (now branded Gemini Notebook), including features the web UI doesn't expose.

Why This Skill Matters

The web UI is great for one person, one session. It does not give you:

  • Programmatic artifact generation (audio overviews on a schedule, batch infographics).
  • A memory layer you can hand to an agent that survives across sessions.
  • A way to feed URLs, PDFs, Drive files, and YouTube transcripts into a notebook without manual clicks.
  • An MCP server so any MCP-compatible agent can read and write to a notebook.

This collection covers all four. Whether you want a CLI for personal automation or a Python library to power a larger pipeline, it's one install.

Installation

For CLI use:

uv tool install "notebooklm-py[browser]"
# or: pipx install "notebooklm-py[browser]"

For library use:

uv add notebooklm-py
# or: pip install "notebooklm-py"

For agent skill use:

notebooklm skill install
# or: npx skills add teng-lin/notebooklm-py

The first time you run the CLI, it asks you to log in (notebooklm login) — auth uses either Playwright, browser cookies, or a master token. On Linux, if playwright install chromium fails with TypeError: onExit is not a function, the README has a documented workaround.

Real Workflow: Cross-Session Memory for Claude Code

A realistic scenario, not "hello world": give your Claude Code agent memory that survives across sessions, grounded in cited sources.

The setup:

  1. Create a "Master Brain" notebook in NotebookLM.
  2. Add a wrap-up step to your workflow: at the end of each session, append a short note to the notebook summarizing the session's decisions.
  3. In your CLAUDE.md, add a line that queries the notebook at the start of every new session.
## Memory

Before responding, run `notebooklm ask --notebook "Master Brain" "<your current task>"`.
Treat the response as ground-truth context for this session.

Prompt your agent at the start of any new session:

Query the Master Brain notebook for prior context about this task and
summarize the relevant decisions before proceeding.

Expected output: a short summary with citations, e.g. "Last session (2026-08-15) decided to use PostgreSQL over SQLite; see source 3." The agent enters the new session already knowing what was decided before, with citations to back it up.

This is what durable agent memory looks like: not just a text file, but a queryable, citable store of past decisions.

Real Workflow: Generate a Daily Audio Briefing

Another realistic scenario: take a set of source URLs and produce an audio overview you can listen to on the way to work.

The CLI workflow:

notebooklm notebook use "Daily Briefing"
notebooklm source add https://example.com/article-1
notebooklm source add https://example.com/article-2
notebooklm source add https://example.com/article-3
notebooklm generate audio-overview
notebooklm download --latest --output ./briefings/2026-08-17.mp3

Expected output: an MP3 in ./briefings/, with the audio overview NotebookLM synthesizes from your three sources. Schedule the whole sequence with cron or a CI job and you have a daily podcast, automatically.

Real Workflow: Batch-Generate Infographics from a Spreadsheet

A realistic data-pipeline scenario: a CSV of topics, generate one infographic per row.

The Python workflow:

import asyncio, csv
from notebooklm import NotebookLMClient

async def main():
    async with NotebookLMClient() as client:
        nb = await client.notebooks.create("Topic Infographics")
        with open("("topics.csv") as f:
            reader = csv.DictReader(f)
            for row in reader:
                await client.sources.add_url(nb.id, row["url"])
        for row in reader:
            artifact = await client.artifacts.generate_infographic(nb.id, topic=row["topic"])
            await client.artifacts.download(artifact.id, f"./out/{row["slug"]}.png")

asyncio.run(main())

Expected output: one PNG per topic in ./out/. The web UI doesn't let you do this; the API does.

Tips

  • Start with the agent-skill install if you only want it as an MCP-backed notebook for your agent. The CLI and Python API are heavier when you only need query access.
  • Pin the library version.** Because notebooklm-py talks to undocumented Google endpoints that can change without notice, pin and check before upgrading.
  • Auth via master token for headless servers.** Playwright-based login works locally; for CI or server use, master tokens are more reliable.
  • Watch per-notebook source caps.** Google tiers cap how many sources a notebook can hold. If you hit the cap, split into multiple notebooks rather than fight the limit.

When Not to Use This

  • You need a stable, supported production API.** This is unofficial and uses undocumented endpoints. Internal Google APIs can break at any time. Treat any production usage as risk-bearing.
  • You're rate-limited or have strict SLAs.** Heavy usage gets throttled; there's no service-level commitment.
  • Your data has privacy constraints that the official UI doesn't cover.** Anything you put in a notebook goes to Google's systems. Same considerations as the web UI apply — no more, no less.
  • You only need one feature.** If you just want audio overview generation, a more focused tool may serve you better. This is breadth-first.

See the leaderboard for more skills.