textual-chat
LLM chat for humans. Add AI to your terminal app in a few lines of code.
from textual.app import App, ComposeResult
from textual_chat import Chat
class MyApp(App):
def compose(self) -> ComposeResult:
yield Chat()
MyApp().run()
That's it. No configuration, no boilerplate.
Features
- Zero-config - Auto-detects your LLM setup and just works
- ACP agents - Works with Claude Code, OpenCode, and custom agents
- Function calling - Decorate Python functions as tools
- Fully customizable - It's a Textual widget, style it however you want
Install
uv add textual-chat
Or with pip: pip install textual-chat
For ACP agent support: uv add textual-chat[acp]
Quick Start
Set an API key:
export ANTHROPIC_API_KEY=sk-ant-... # or OPENAI_API_KEY
Then run:
from textual.app import App, ComposeResult
from textual_chat import Chat
class MyApp(App):
def compose(self) -> ComposeResult:
yield Chat(
model="claude-sonnet-4-20250514", # Optional
system="You are a helpful assistant.", # Optional
)
MyApp().run()
Tools
Pass any FastMCP tool directly:
from fastmcp import FastMCP
mcp = FastMCP("My Tools")
@mcp.tool
def get_weather(city: str) -> str:
"""Get the weather for a city."""
return f"72°F and sunny in {city}"
chat = Chat(tools=mcp.tools)
Or use the @chat.tool decorator for quick one-offs:
chat = Chat()
@chat.tool
def search(query: str) -> str:
"""Search the web."""
return results
Examples
See the examples/ folder for complete examples:
| Example | Description |
|---|---|
basic.py |
Minimal chat app |
with_tools.py |
Function calling |
with_thinking.py |
Extended thinking (Claude) |
with_mcp.py |
MCP server tools |
custom_model.py |
Custom model and system prompt |
in_larger_app.py |
Sidebar integration with tools |
chatbot_modal.py |
Modal dialog pattern |
chatbot_sidebar.py |
Toggleable sidebar |
with_tabs.py |
Tabbed interface |
acp_chat.py |
ACP agent integration |
Run any example:
uv run examples/basic.py
uv run examples/acp_chat.py examples/echo_agent.py
Configuration
Chat(
model="claude-sonnet-4-20250514", # Model ID or agent command
adapter="litellm", # "litellm" or "acp"
system="You are a pirate.", # System prompt
temperature=0.9, # Response randomness
thinking=True, # Extended thinking (Claude)
tools=[fn1, fn2], # Tool functions
cwd="/path/to/project", # Working directory
show_token_usage=True, # Show token counts
show_model_selector=True, # Allow /model switching
)
License
MIT
Metadata
Release files for textual-chat 0.1.4
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 |
|---|---|---|---|---|
| textual_chat-0.1.4.tar.gz | 551.6 kB | Without provenance | Details for textual_chat-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| textual_chat-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for textual_chat-0.1.4-py3-none-any.whl |
Total release size: 614.4 kB
Release files / textual_chat-0.1.4.tar.gz
| Download URL | textual_chat-0.1.4.tar.gz |
|---|---|
| Size | 551.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c52b7a4d06c343c835a665afacfd647ac25d2629d0ac59e499ac7f78630f19d9
|
|
BLAKE2b-256 checksum How to use checksums |
7c371b74b2ab60d036745e1067b8f51980224f5a54adc777b40fc36598eaf282
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.22
|
Release files / textual_chat-0.1.4-py3-none-any.whl
| Download URL | textual_chat-0.1.4-py3-none-any.whl |
|---|---|
| Size | 62.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50a83f283f27485d11361accc5f7555417220908e8b2cc35083720d9fbeda3e2
|
|
BLAKE2b-256 checksum How to use checksums |
38861014ccd4178b15d1593b9036c38d3acf1a9d45e0fe554427415dccc9791f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.22
|
Security for textual-chat 0.1.4
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.