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 |
/backend <name> |
switch backend (anthropic | stackai) |
/exit, /quit |
leave |
Backends
The agent is backend-pluggable. Default is Anthropic (Claude); you can also point it at 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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stackai-0.7.0.tar.gz.
File metadata
- Download URL: stackai-0.7.0.tar.gz
- Upload date:
- Size: 70.0 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e62247057d97df1f97d54d2ca3c30ce39cc0e5f4b87f0ae56ebcd70794f8bf0a
|
|
| MD5 |
6e4b451afb40f945a50517455c8ccef4
|
|
| BLAKE2b-256 |
b5bfe1b344724b9ad1681e95b21ccf6337fb4b1c21fe48b864b8c5d6b29b6726
|
File details
Details for the file stackai-0.7.0-py3-none-any.whl.
File metadata
- Download URL: stackai-0.7.0-py3-none-any.whl
- Upload date:
- Size: 30.5 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bb73f85da8093a70428fc66732ccaadee212f6a3bbefeaa3f3fbc5b9ac4bf50
|
|
| MD5 |
40d5a5edafe832960b0b411d8e037672
|
|
| BLAKE2b-256 |
7745e624c4e9cd247f3b05d9c25a401d7d0106d81486ef936bfe2150013acb7b
|