Skip to main content

ipyant

ipyant is a terminal IPython extension that supports Claude-backed prompt using the Agent SDK, so it supports Claude Code subscriptions as well as API keys.

It is aimed at terminal IPython, not notebook frontends.

Install

pip install -e ipyant

ipyant uses the local Claude Code / Claude Agent SDK stack, so Claude must already be installed and authenticated on the machine. It also depends on safepyrun for the live python tool.

How to Use Prompts

There are several ways to send a prompt to Claude from ipyant:

Dot prefix (.) — In normal IPython mode, start any line with . to send it as a prompt. Everything after the dot is sent to Claude. Continuation lines (without a dot) are included too, so you can write multi-line prompts:

.explain what this dataframe transform is doing
.draft a plan for this notebook:
focus on state management
and failure cases

Prompt mode — When prompt mode is on, every line you type is sent to Claude by default. To run normal Python code instead, prefix the line with ;. Shell commands (!) and magics (%) still work as usual. There are three ways to enable prompt mode:

  • opt-p (Alt-p) — toggle prompt mode on/off at any time from the terminal
  • -p flag — start ipyant in prompt mode: ipyant -p
  • prompt_mode config — set "prompt_mode": true in config.json to always start in prompt mode

You can also toggle prompt mode during a session with %ipyant prompt.

CLI

ipyant

Flags:

ipyant -r        # resume last session
ipyant -r 43     # resume session 43
ipyant -l file   # load a saved notebook session
ipyant -p        # start in prompt mode

On exit, ipyant prints the session ID so you can resume later.

Load As Extension

%load_ext ipyant

Usage

ipyant is a normal IPython session — you can run Python code exactly as you would in plain IPython. On top of that, you can send prompts to Claude as described above. %ipyant / %%ipyant magics are also available.

Useful commands:

%ipyant
%ipyant model sonnet
%ipyant completion_model haiku
%ipyant think m
%ipyant code_theme monokai
%ipyant log_exact true
%ipyant prompt
%ipyant save mysession
%ipyant load mysession
%ipyant sessions
%ipyant reset

Context Model

For each AI prompt, ipyant sends:

  • recent IPython code as <code>
  • string-literal note cells as <note>
  • recent outputs as <output>
  • the current request as <user-request>
  • referenced live variables as <variable>
  • referenced shell command output as <shell>

Prompts are stored in SQLite in a dedicated claude_prompts table. Claude-native session metadata is stored in IPython's sessions.remark as JSON, including cwd, provider, and provider_session_id.

Tools

ipyant exposes exactly one custom tool:

  • python: delegates to pyrun in the live IPython namespace

It also enables these built-in Claude Code tools:

  • Bash
  • Edit
  • Read
  • Skill
  • WebFetch
  • WebSearch
  • Write

The ipyant CLI loads safepyrun before ipyant, so pyrun is available by default in normal terminal use.

Skills

Skills are Claude-native. ipyant enables the built-in Skill tool and loads normal Claude user/project skills through the Agent SDK.

Notebook Save/Load

%ipyant save <filename> writes a notebook snapshot. It stores:

  • code cells
  • note cells
  • AI responses as markdown cells
  • prompt metadata including both prompt and full_prompt

%ipyant load <filename> restores that notebook into a fresh session. On the next prompt after such a load, ipyant synthesizes a Claude transcript JSONL file once, stores the resulting Claude session ID, and then resumes natively from that point onward.

Keyboard Shortcuts

  • Alt-.: AI inline completion
  • Alt-p: toggle prompt mode
  • Alt-Up/Down: history navigation
  • Alt-Shift-W: paste all Python code blocks from the last response
  • Alt-Shift-1 through Alt-Shift-9: paste the Nth Python code block
  • Alt-Shift-Up/Down: cycle through extracted Python blocks

Config

Config lives under XDG_CONFIG_HOME/ipyant/:

  • config.json
  • sysp.txt
  • exact-log.jsonl

config.json supports:

{
  "model": "sonnet",
  "completion_model": "haiku",
  "think": "l",
  "code_theme": "monokai",
  "log_exact": false,
  "prompt_mode": false
}

Development

See DEV.md.

Metadata

Release files for ipyant 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ipyant 0.0.1
File Size Uploaded Provenance Actions
ipyant-0.0.1.tar.gz 23.2 kB Without provenance Details for ipyant-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ipyant 0.0.1
File Interpreter ABI Platform Actions
ipyant-0.0.1-py3-none-any.whl Python 3 none any Details for ipyant-0.0.1-py3-none-any.whl

Total release size: 42.3 kB

Release files / ipyant-0.0.1.tar.gz

Download URL ipyant-0.0.1.tar.gz
Size 23.2 kB
Tags Source
SHA-256 checksum
How to use checksums
924133330759c3f81a5b05e7e0bf0e8b7fecd9878e8f71247becf8efa0223c9d
BLAKE2b-256 checksum
How to use checksums
dfa7ffbbdac3f5671cbdd7e5569b5ddc973eaa7ec8348ad0bce92c84c5b1e83d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.0

Release files / ipyant-0.0.1-py3-none-any.whl

Download URL ipyant-0.0.1-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddc5ef5401b2c32d86bd221241f27791815a199fac51f1cb272ea3639497783f
BLAKE2b-256 checksum
How to use checksums
692c99a22617d94c8236d5f7066ebd726485f8ed3d5170353dd3e82147454ef2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.0

Security for ipyant 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

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