PyChat.ai is an interactive Python REPL that embeds an LLM agentic loop, which has access to the Python environment and can query a value or run code.
Please see the accompanying blog post for more information.
- This is a prototype at the moment, to explore the idea. It is not a full product!
- This is very insecure - the model can run arbitrary Python code, so it can read your file system or use the network, which makes it susceptible to the lethal trifecta. Please don't use this outside of a container or virtual machine!
- Run Python code
- Switch between Python mode and assistant mode with
Tab - Ask assistant questions grounded in the current runtime
- Use slash commands for quick inspection and session operations
- Rust toolchain
- either
uvfor the pinned Python workflow used in CI, or Python installed locally GEMINI_API_KEYif you want assistant responses. You can get one, which has a free tier, Google AI Studio
CI uses a pinned Python version from .python-version installed via uv.
Use this workflow if you want reproducible local checks (fmt, clippy, test) with the same Python version as CI.
If you just want to try the app, you can skip this section and use cargo run below.
Install the pinned Python:
scripts/python/install-managed-python.shRun project checks with the pinned interpreter:
scripts/dev/checks-with-pinned-python.shPrint PyO3 interpreter config (debugging):
scripts/dev/pyo3-config-check.shRemember - this is insecure! Do this in a container or vm!
The commands below are the simplest local run path. They use your local Python/PyO3 setup (unless you set PYO3_PYTHON yourself).
cargo runWith assistant enabled:
GEMINI_API_KEY=your_key cargo runYou can also set GEMINI_API_KEY in .env.
- Enter Python code and press
Enter - Press
Tabto switch modes - Type
/helpto see commands - Type
exitorquitto leave
- User guide:
docs/user-guide.md - Config reference:
docs/config-reference.md - Command reference:
docs/command-reference.md - Contributing:
docs/contributing.md - Architecture:
docs/architecture.md
- Python learners
- Data scientists
- Developers working interactively
- Anyone who frequently uses Python REPL
- Learning Python: understand objects/functions interactively, explore built-ins
- Debugging: inspect variable state, understand exceptions, check assumptions
- Data exploration: inspect data structures, summarize collections
- Interactive experimentation: prototype ideas, verify behavior, explore APIs
