stackai
An interactive AI agent in your terminal — like Claude Code, for StackAI.
Installation
pip install stackai
This installs the stack command.
The interactive agent
Just run stack (or stack chat) to start an interactive session:
stack
On a real terminal this opens a full-screen app (scrolling transcript +
anchored input, à la Claude Code). Piped/non-interactive input falls back to a
line REPL automatically; force it with stack chat --classic.
You get a streaming chat loop with tool use — the agent can read files, list directories, and run shell commands (with your approval) to help answer your questions. Responses render as Markdown with syntax-highlighted code blocks; extended thinking is streamed inline.
› what does pyproject.toml configure?
stack ⚙ read_file pyproject.toml
… reads the file, then explains it
Slash commands
| Command | Description |
|---|---|
/help |
show available commands |
/clear |
reset the conversation |
/tools |
list the tools the agent can call |
/compact |
summarize older turns to shrink context |
/model [name] |
switch model (Claude/OpenAI); no name opens a picker |
/backend <name> |
switch backend (anthropic | openai | stackai) |
/exit, /quit |
leave |
Models
Run /model for a picker across Claude (Opus 4.8, Fable 5, Sonnet 5,
Haiku 4.5) and OpenAI (GPT-5 Codex, GPT-5, o4-mini), or /model <name> to
switch directly — the backend is inferred from the id (gpt-*/o* → OpenAI,
claude-* → Anthropic; or force with openai:<id>). Switching starts a fresh
session. OpenAI needs OPENAI_API_KEY (or stack config set openai_api_key …).
Backends
The agent is backend-pluggable: Anthropic (Claude, default), OpenAI (GPT/Codex), or a deployed StackAI workflow.
Anthropic (default) — set a key and go:
export ANTHROPIC_API_KEY=sk-ant-...
stack # or: stack chat -b anthropic -m claude-opus-4-8
StackAI — call one of your deployed workflows:
stack config set backend stackai
stack config set stackai_url https://api.stack-ai.com/inference/v0/run/<org>/<flow>
stack config set stackai_api_key <key>
stack
Config is stored at ~/.config/stackai/config.json. Relevant keys:
backend, model, anthropic_api_key, stackai_url, stackai_api_key,
stackai_input_field (default in-0), stackai_output_field (default outputs).
Context compaction
Long sessions are kept from overflowing the model's context window by
auto-summarization. When the transcript grows past a threshold, the oldest
turns are replaced by a single summary while the most recent turns are kept
verbatim; run /compact to trigger it manually.
Compaction rewrites history rarely and in one batch, so the compacted prefix stays stable between compactions — friendly to prompt caching, unlike a rolling window that would change the prefix every turn. It only applies to backends that send the full history (currently Anthropic). Relevant config keys:
| Key | Default | Meaning |
|---|---|---|
compact |
true |
enable auto-summarization |
compact_threshold_tokens |
120000 |
compact once the transcript exceeds this |
compact_keep_tokens |
40000 |
recent tokens kept verbatim after compact |
stack config set compact_threshold_tokens 80000
stack config set compact false # disable auto-compaction
Other commands
stack --version
stack hello [name]
stack config set|get|list|path
Development
This project uses uv.
uv sync # install deps into a local venv
uv run stack # run the agent from source
uv run pytest # run the test suite
Building & publishing
uv build # produces wheel + sdist in dist/
uv publish # upload to PyPI
License
MIT
Metadata
Release files for stackai 0.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stackai-0.8.1.tar.gz | 75.8 kB | Without provenance | Details for stackai-0.8.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stackai-0.8.1-py3-none-any.whl | Python 3 | none | any | Details for stackai-0.8.1-py3-none-any.whl |
Total release size: 110.8 kB
Release files / stackai-0.8.1.tar.gz
| Download URL | stackai-0.8.1.tar.gz |
|---|---|
| Size | 75.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
defbac362a037dafc24770778184471d5ea42a169cd05f9bca285ac53b61c199
|
|
BLAKE2b-256 checksum How to use checksums |
b3bd9f81c507f74f307c0c2384d75797a3831eba754720a4cfe3e54e373cea0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / stackai-0.8.1-py3-none-any.whl
| Download URL | stackai-0.8.1-py3-none-any.whl |
|---|---|
| Size | 35.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e56fe4fbce54b5cff192dedf7eaab563f764f66847644a4d385ef60ddf876eac
|
|
BLAKE2b-256 checksum How to use checksums |
b3b0ce1d50f07ffb4a6ad9a622cad6d9af285f5ebd9740abc9cf6711d9dbf0d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for stackai 0.8.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.