Skip to main content
Use LithoBlocks with LlamaIndex so your agent can send Slack messages via templates. The agent selects 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.

Prerequisites

  • LithoBlocks API key and at least one template
  • Connecting Slack for your LithoBlocks workspace
  • LlamaIndex installed (pip install llama-index or equivalent)

Why use LithoBlocks with LlamaIndex

  • 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_id and 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 LlamaIndex tool that accepts template_id and payload (mapped to API field data), then POSTs to the LithoBlocks API.
For compile (get blocks without sending), use POST /v1/templates/compile with body {"template_id": "...", "data": {...}}. See the API reference for request/response shapes.

Using the tool in an agent

Add the tool to your agent. The agent can then invoke “send Slack message” with template_id and payload.
The agent will call 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.