grokbuildstreaming
Stream text from the Grok Build CLI. This library is a text-completion alternative to agentmake: you pass chat messages, and it yields response text as the CLI produces it.
Authentication is the subscription session from grok login (~/.grok/auth.json). The child process does not receive XAI_API_KEY. No API key is read or sent.
Install
pip install grokbuildstreaming
Published on PyPI. Requires the grok executable on PATH or at ~/.grok/bin/grok, and a completed grok login.
Stream
import asyncio
from grokbuildstreaming import stream_text
async def main():
messages = [
{"role": "system", "content": "You are a concise Bible study assistant."},
{"role": "user", "content": "What is John 3:16 about?"},
{"role": "assistant", "content": "It states God's love for the world."},
]
async for chunk in stream_text(messages, follow_up="Quote it briefly.", model="grok-4.7"):
print(chunk, end="", flush=True)
asyncio.run(main())
messages use role and content, the same shape agentmake accepts. follow_up is the newest user turn. System text is sent with --system-prompt-override. Each call is a new headless process: the library does not resume a previous Grok session.
The process is text-only. It runs with --max-turns 1, plan mode off, web search off, subagents off, and built-in tools removed, in a temporary working directory. Cancel an in-flight stream by setting the asyncio.Event passed as cancel_event.
collect_text returns the whole reply:
from grokbuildstreaming import collect_text
text = await collect_text(follow_up="Reply with exactly: pong")
Metadata
Release files for grokbuildstreaming 0.1.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 | |
|---|---|---|---|---|
| grokbuildstreaming-0.1.1.tar.gz | 7.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| grokbuildstreaming-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.8 kB
Release files / grokbuildstreaming-0.1.1.tar.gz
| Download URL | grokbuildstreaming-0.1.1.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f52fa7d46759ebe16f5a7d1f18d9072a92367416830543dea7a80efbbaceaf14
|
|
BLAKE2b-256 checksum How to use checksums |
a4a51b541be8bbafc3779f2ce5e84e39c80b08d5e701123eefb13f89adf0b8ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / grokbuildstreaming-0.1.1-py3-none-any.whl
| Download URL | grokbuildstreaming-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65dff31eb87641f99f81104a196815845c0df5859bb498cd5aba5e93efdeee84
|
|
BLAKE2b-256 checksum How to use checksums |
925bee17f71fb18cb855e6261a4e464163dcd70248665eae43cb4d4111b3a199
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for grokbuildstreaming 0.1.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.