Skip to main content
LithoBlocks templates let your AI agent send Slack messages without generating Block Kit JSON. The agent picks a template and fills in the data; LithoBlocks handles the message structure. Use templates so your agent uses far fewer tokens. The resulting LLM savings help offset LithoBlocks credits, with net cost reduction at higher volumes and for richer messages.

Why use templates with agents

  • Deterministic output — The agent chooses a template and supplies variables. The LLM does not need to generate Block Kit JSON, so output is predictable and valid.
  • Lower LLM cost — The agent sends only a template ID and a small payload instead of long block structures. The resulting LLM savings help offset LithoBlocks cost; at higher volumes and for medium/large messages, many customers see net cost reduction.
  • Consistency and safety — The same layout and structure every time; fewer malformed blocks or prompt drift.
  • Faster iteration — Change the message in LithoBlocks once; every agent using that template gets the update.

Common pattern (generic tool)

Your agent decides what to do and what data to send; the LithoBlocks API handles how (the Slack message).
  1. Tool/action inputs: template_id, payload (and optionally channel/user for send).
  2. One HTTP call: POST to the compile or send endpoint; return success or error to the agent.
  3. Optional: Use webhooks for two-way flows (e.g. button click in Slack triggers the agent).

Prerequisites

  • LithoBlocks API key (from your dashboard → API Keys)
  • At least one template (see Quickstart)
  • Connecting Slack for your LithoBlocks workspace (required for send)
  • Optional: webhook destination if the agent should react to button or modal interactions

Implementing the tool (generic)

  • Base URL: https://api.lithoblocks.com
  • Authentication: Authorization: Bearer YOUR_LITHOBLOCKS_API_KEY
  • Paths: e.g. POST /templates/{template_id}/compile, POST /templates/{template_id}/send. See the API reference for all endpoints and parameters.
  • Body: JSON in the shape your template expects (same as sample data). The agent provides this payload; your tool forwards it to the API.
Return the API response (or a short success/error message) to the agent so it can decide the next step.

Platform guides

Same pattern in each framework: define a tool that calls the LithoBlocks API with template_id and payload, then add that tool to your agent.

Next steps