Use LithoBlocks with LangChain so your agent can send Slack messages via templates. The agent chooses a template and payload; a tool calls the LithoBlocks API. You get deterministic messages and far fewer tokens because the LLM does not generate Block Kit JSON. The resulting LLM savings help offset LithoBlocks cost, with net cost reduction at higher volumes.Documentation Index
Fetch the complete documentation index at: https://docs.lithoblocks.com/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- LithoBlocks API key and at least one template
- Connecting Slack for your LithoBlocks workspace
- LangChain installed (
pip install langchain langchain-openaior equivalent)
Why use LithoBlocks with LangChain
- Deterministic messages — The agent picks a template and data; the tool sends it. No Block Kit in the prompt.
- Lower LLM cost — The agent outputs only
template_idand a small payload; the tool does the HTTP call. LLM savings help offset LithoBlocks cost; at higher volumes, net cost reduction. - Consistency — Same layout every time; fewer malformed blocks.
Implementing the tool
Define a LangChain tool that acceptstemplate_id and payload (mapped to API field data), then POSTs to the LithoBlocks API.
https://api.lithoblocks.com/v1/templates/compile (or your configured base URL plus /v1/templates/compile) with JSON {"template_id": "...", "data": {...}} and return the response to the agent or post blocks yourself. See the API reference for request/response shapes.
Using the tool in an agent
Add the tool to your agent’s tools list. The agent can then “send a Slack message” by invoking the tool withtemplate_id and payload.
send_slack_message with the appropriate template_id and payload for your template.
Next steps
AI agents overview
Why templates and agents fit together.
API reference
Endpoints, auth, and parameters.
Placeholders
Template data shape and syntax.

