Registry / llm-agents / banks
library2.5.0pypypi✓ verified 24d ago

Banks (version 2.4.1) is a Python library designed as a prompt programming language for Large Language Models (LLMs). It simplifies the creation, templating, versioning, and management of LLM prompts, offering an intuitive alternative to f-strings for complex prompt engineering. The library maintains an active and frequent release cadence, continuously adding features and improvements.

pip install banks
INSTALL
IMPORT
SIG · BANKS
B
banks
llm-agentspythonv2.5.0
Install
12.4s avg
Import
859ms
Disk
83MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.725s · 32.4MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 12.4s · import 0.650s · 32MB
83MB installed
● package 83MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Prompt
from banks import Prompt
DirectoryTemplateRegistry
from banks.registries import DirectoryTemplateRegistry
Used for loading templates from the filesystem.

This example demonstrates how to define a multi-turn chat prompt using Banks' templating syntax and then render it into a list of chat messages suitable for Large Language Model (LLM) APIs.

from banks import Prompt # Define a prompt template using Banks' templating language prompt_template = """ {% chat role="system" %} You are a {{ persona }}. {% endchat %} {% chat role="user" %} Hello {{ name }}! {% endchat %} """ # Create a Prompt object p = Prompt(prompt_template) # Render the prompt with context to generate chat messages chat_messages = p.chat_messages({"persona": "friendly assistant", "name": "Alice"}) # Print the generated chat messages (e.g., for use with an LLM client) print(chat_messages) # Expected output: # [{'role': 'system', 'content': 'You are a friendly assistant.'}, # {'role': 'user', 'content': 'Hello Alice!'}]
Debug
Known issues
gotchaPython 3.9 compatibility was temporarily removed in v2.3.0 (stopping testing) but re-added in v2.4.1. Users on Python 3.9 should ensure they are using Banks v2.4.1 or newer to avoid compatibility issues.
fix
Upgrade to Banks v2.4.1 or later if using Python 3.9. Consider using Python 3.10+ for broader compatibility.
affects: >=2.3.0, <2.4.1
breakingIn v1.8.0, `litellm` and `redis` transitioned from direct requirements to optional dependencies. If your application relies on features that use these libraries (e.g., LLM text generation within prompts or caching), you must install Banks with the `[all]` extra (e.g., `pip install "banks[all]"`).
fix
Modify your installation command to `pip install "banks[all]"` or install specific extras like `"banks[litellm]"` if only certain optional features are needed.
affects: >=1.8.0
gotchaFor asynchronous operations, the environment variable `BANKS_ASYNC_ENABLED` must be set to `true`, and you should use the `AsyncPrompt` class instead of `Prompt`. Failure to set the environment variable will result in synchronous behavior even with `AsyncPrompt`.
fix
Set `os.environ['BANKS_ASYNC_ENABLED'] = 'true'` before initializing your application, and ensure you are importing and using `AsyncPrompt` where async functionality is desired.
affects: All versions with async support
breakingVersion 2.0.0 introduced breaking changes specifically related to dependencies, noted as `[breaking] fix deps again`. Users upgrading from versions prior to 2.0.0 may encounter issues with their dependency tree.
fix
Review the Banks v2.0.0 changelog and your project's dependency resolution. It might be necessary to recreate virtual environments or manually update/pin specific dependency versions.
affects: 2.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'banks'
The 'banks' library has not been installed in your Python environment or the Python interpreter cannot find it.
fix
Install the library using pip: `pip install banks`
jinja2.exceptions.TemplateSyntaxError: expected token 'end of print statement', got 'number'
There is a syntax error within a Jinja2 template used by the 'banks' library, often due to incorrect variable naming or misplaced characters inside `{{ }}` or `{% %}` blocks.
fix
Review the template string for syntax errors, ensuring variables names are valid Python identifiers and Jinja2 syntax is correctly applied. For example, `{{ cyl number }}` should be `{{ cyl_number }}`.
jinja2.exceptions.UndefinedError: 'your_variable_name' is undefined
A variable or attribute referenced in the Jinja2 template (e.g., `{{ your_variable_name }}` or `{{ object.your_variable_name }}`) was not provided during the `render()` call or the object itself is undefined.
fix
Ensure all variables used in the template are passed as keyword arguments to the `prompt.render()` method, or that the objects they are attributes of exist and are correctly passed.
Upgrade
Version history
2.5.0latest on PyPI · released Aug 8, 2026
Audit
Dependencies
platformdirsrequiredRequired for internal path management, added in v2.1.1. [cite: `v2.1.1` changelog]
litellmoptionalOptional dependency for LLM-generated text within prompts and other LLM integrations.
redisoptionalOptional dependency for prompt caching mechanisms.
Agent activity
25 hits · last 30 days
node
18
OpenAI (training)
1
Resources
banks — pip install banks · libregistry