askable-streamlit
Streamlit binding for askable — give your Streamlit app LLM awareness.
Install
pip install askable-streamlit
Quick start
import streamlit as st
from askable.streamlit import askable_context
st.title("AI Dashboard")
# Render data with data-askable annotations
st.markdown(
"""
<div data-askable='{"metric":"revenue","period":"Q3","value":"$2.3M"}'>
<h3>Q3 Revenue: $2.3M</h3>
<p>Down 12% month-over-month</p>
</div>
""",
unsafe_allow_html=True,
)
# Get the current focus context
focus = askable_context()
if focus:
st.caption(f"Context: {focus['text'][:80]}...")
if st.button("Ask AI about this"):
prompt_context = (
f"User is focused on: {focus['text']} "
f"(metadata: {focus['meta']})"
)
# Pass prompt_context as your LLM system message
response = call_your_llm(
system=f"UI context: {prompt_context}",
user="What should I know about this?",
)
st.write(response)
How it works
askable_context() renders a hidden zero-height iframe component that:
- Injects
@askable/coreinto the parent Streamlit page via same-origin iframe access - Observes all
[data-askable]elements ondocument.body - When the user clicks, focuses, or hovers an annotated element, sends the focus data back to Python as the component value
The returned dict has the same shape as AskableFocus from the JS core:
{
"meta": {"metric": "revenue", "period": "Q3"}, # parsed from data-askable
"text": "Q3 Revenue: $2.3M", # element text (≤200 chars)
"timestamp": 1711234567890, # unix ms
}
Requirements
- Python ≥ 3.9
- Streamlit ≥ 1.28.0
- Works with all standard Streamlit deployment targets (local, Streamlit Cloud, etc.)
Note: The component injects JS into the parent page via same-origin iframe access. This works in all standard Streamlit deployments because custom component frontends are served from the same origin as the app.
License
MIT
Metadata
Release files for askable-streamlit 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| askable_streamlit-0.1.2.tar.gz | 2.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| askable_streamlit-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.9 kB
Release files / askable_streamlit-0.1.2.tar.gz
| Download URL | askable_streamlit-0.1.2.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
475159b0613f0854189da592c5c4285756bd5e5ff3afdf67f8fd255440ad4d13
|
|
BLAKE2b-256 checksum How to use checksums |
f786b73380495fa9725a995ea2e8abf8711a8e0d44475bb62d3399b5a8c46668
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / askable_streamlit-0.1.2-py3-none-any.whl
| Download URL | askable_streamlit-0.1.2-py3-none-any.whl |
|---|---|
| Size | 2.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac0f7fd33a92382f95b8757006399af62681b9d1eb8636ef4b68dcc7e48ddf29
|
|
BLAKE2b-256 checksum How to use checksums |
86b373f4f24348b46b21549182341f7d00737d3e42064e32b0918cc4578cc294
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency log