When a Solana trading bot makes a losing trade, the question isn’t just what went wrong — it’s why. Which LLM call produced the bad signal? Which tool returned stale data? Did the Solana transaction even land? Without a complete evidence chain, you’re guessing. Mortem captures that evidence automatically and turns it into a structured, replayable record you can inspect after every run.Documentation Index
Fetch the complete documentation index at: https://docs.mortemlabs.com/llms.txt
Use this file to discover all available pages before exploring further.
What Mortem is for
Mortem is built for TypeScript trading bot teams that use LLMs to make or assist with trade decisions. It is a debugging and observability tool, not a monitoring dashboard. The distinction matters: Mortem is focused on post-trade reconstruction — showing you the exact sequence of decisions, the market context that surrounded them, and which specific moment caused the loss. If your agent uses an LLM to evaluate trade setups, calls tools to fetch quotes or prices, and submits Solana transactions, Mortem gives you a complete picture of every one of those steps for every run.What Mortem captures
Every agent run produces a trace — a chronological record of everything your agent did. Mortem captures the following across each trace:- LLM calls — prompts, completions, model names, token counts, and cost estimates
- Tool calls — which tools fired, their inputs, and what they returned
- Solana transactions — signatures, lamport flows, and on-chain state
- Market context — Jupiter quotes and Pyth prices at decision time
- MCP calls — model context protocol round-trips if your agent uses them
- x402 payments — HTTP payment channel interactions
- Custom events — any arbitrary step you instrument with
session.beginEvent
The core workflow
Mortem is designed around four steps that take you from instrumented code to a diagnosed fix.Instrument
Add
@mortemlabs/sdk to your TypeScript agent and wrap your LLM clients, tool definitions, and Solana connection. Most integrations require fewer than ten lines of changes.Trace
Every agent run produces a trace that is streamed in real time to the Mortem ingest service and stored as a queryable evidence chain. You can watch runs live from the dashboard.
Replay
Open any trace in the dashboard to step through the full decision chronology — seeing every LLM prompt and response, every tool invocation, and every on-chain transaction in the order they happened.
Who Mortem is for
Mortem is designed for teams that meet all of the following criteria:- Building in TypeScript
- Using an LLM (OpenAI, Anthropic, Ollama, or a Vercel AI SDK compatible model) to drive trade logic
- Submitting transactions on Solana (devnet or mainnet)
- Struggling to reconstruct why a specific run produced a specific outcome
The SDK design
The@mortemlabs/sdk package is intentionally lightweight. It has no hard dependencies on any LLM provider, the Solana SDK, LangChain, or any other framework. Instrumentation wrappers are structural and lazy-loaded, so adding Mortem to your agent does not pull in providers you aren’t already using.
The SDK is also best-effort: every buffer flush error is swallowed and optionally reported through a logger you provide. A network hiccup or misconfigured API key will never throw into your agent runtime or interrupt a trade.
The default ingest endpoint is
https://ingest.mortem.dev. You don’t need to configure this for cloud usage. For local development against a self-hosted stack, set MORTEM_INGEST_URL=http://localhost:4001.Where to go next
Quickstart
Create an agent, install the SDK, and send your first trace in under five minutes.
Core concepts
Understand agents, sessions, events, and autopsies before you integrate.
SDK installation
Full setup instructions, all configuration options, and optional encryption.
API reference
Direct HTTP access to the Mortem ingest and trace APIs.