Orchestration & integration
n8n · Rewst · REST APIs · webhooks · MCP
Connect systems, route work and expose tools with clear inputs and permissions.
LOGAN MULLIGAN / HOW I BUILD AUTOMATION
The engineering behind the business automation I build: how a project is scoped and tested, what “real checks” means, how retrieval and AI steps earn their place, how the work is traced, and when running AI on your own hardware makes sense.
Written for technical teams and the curious. If you run the business and want the short version, start with what automation does for you, what it costs and how we begin.
This is the engineering behind the investment. From our first working session through handover, I build around your process, the result we agreed on and what your team needs to keep it running.
Walk through the work with the person doing it. Identify inputs, handoffs, exceptions, data ownership and the cost of getting it wrong. Agree on what a useful result looks like.
Document the source of truth, APIs, permissions and dependencies. Decide where ordinary code is enough and where a model’s judgment actually helps. Define the human handoff.
Connect the trigger to a real outcome. Use test data, versioned configuration and narrow permissions. Keep credentials out of prompts, workflow exports and source control.
Test missing fields, repeated events, stale documents, expired credentials, timeouts and conflicting instructions. Use a fixed evaluation set so an “improvement” has evidence behind it.
Stage the release, limit its reach and verify changes against the source system. Document ownership, rollback, recovery and how a person takes over.
Review success rate, exceptions, cost and latency. An alert should tell someone what failed, what is affected and what to do next. Re-test when prompts, models or source data change.
Validate the input. Types, required fields, ranges and business rules. A valid JSON object can still contain a wrong answer.
Make retries safe. Timeouts, bounded backoff and an idempotency key, so the same event does not create two invoices or two jobs.
Control the action. Least privilege, scoped tools and explicit approval for actions that need a person’s judgment.
Verify the result. Read back the affected record, reconcile the outcome and preserve an audit trail. A 200 response is not the whole check.
RAG means retrieval-augmented generation. In plain English: find relevant information first, then use it to help answer the question. It can make your documents useful without retraining a model every time a policy changes.
“What is our policy for returning a damaged item?” The application identifies the user and which documents they are allowed to see.
Damaged items: retain packaging, record the issue, request a review.
Illustrative workflow and fictional policy. This demonstration does not send data to an AI model.
Clean extraction, sensible passage boundaries, source links, dates and permissions all affect the answer. I plan for updates and deletions, too. An old policy that keeps resurfacing is a data problem with an AI interface.
Retrieval can miss evidence. Documents can disagree. A model can misread a good passage. I check each stage and give the system a way to say it does not have enough information.
Is your team spending its day hunting for answers? Let’s look at the documents, the access rules and the work that comes after the answer.
Talk through my use caseI work across workflow automation, software, infrastructure and AI. The point of knowing the stack is being able to explain which parts a project actually needs.
n8n · Rewst · REST APIs · webhooks · MCP
Connect systems, route work and expose tools with clear inputs and permissions.
Python · TypeScript · SQL · Postgres / pgvector · Supabase · Redis
Build the rules, records, retrieval and state that make the workflow dependable.
Docker · Git · Cloudflare Workers · queues · CI/CD
Ship repeatable releases, isolate workloads and recover when dependencies fail.
Langfuse · embeddings · hybrid RAG · rerankers · local LLMs
Choose the evidence, inspect the model calls and measure whether changes help.
Workflow tools make triggers, integrations and handoffs visible. I treat them as software: named steps, separated environments, credential management, error paths and versioned changes. A failure workflow should point to a recoverable job and a specific next action.
n8n: error handling ↗Model Context Protocol gives applications a common way to discover and use tools, resources and prompts. A RAG service can expose a search tool through MCP. I still own the authorization, input limits, timeouts, logging and approval rules around it.
MCP: architecture ↗Inside the AI app, one MCP client talks to each MCP server, and each server reaches one tool. Requests that only read go straight through. Requests that change something wait for a person’s OK.
Drawn from the MCP specification, revision 2026-07-28: one client per server inside the host, and a person able to deny any tool call. What is MCP? A plain-English guide
Before we talk about model speed or context windows, this part matters. A token is a unit the model processes. It might represent a word, part of a word, punctuation or bytes. One word does not always equal one token.
A tokenizer converts text into token IDs. Byte-pair encoding, or BPE, builds a vocabulary by repeatedly merging frequent symbol pairs during training. At inference, the learned merge rules split new text into pieces the model knows.
Tokenization varies by model and language. Code, unusual identifiers and long documents can use very different token counts from ordinary prose. I use the actual model’s tokenizer when the budget matters.
Input tokens affect prompt processing, context usage and cost. Output tokens affect how long generation continues. The context window is shared by instructions, history, retrieved material, tool results and the response budget.
Hugging Face: BPE tokenization ↗Start with symbols. In byte-level BPE, the base vocabulary represents bytes; text encoding and pre-tokenization come first.
A small teaching vocabulary, not the output of a production tokenizer. Real splits and token IDs depend on the model.
Embedding dimensions, search effort, reranking and context size all affect the path to an answer. I change one thing at a time and measure both quality and latency on representative questions.
An embedding is a numerical representation used to compare meaning. More dimensions mean more vector storage and distance-computation work; they do not automatically mean better retrieval. Model quality, domain fit and chunking matter too.
For uncompressed float32 vectors, raw storage is roughly documents × dimensions × 4 bytes, before index and metadata overhead. Dimension reduction must be supported by the embedding model and validated on the task.
HNSW is a graph-based approximate nearest-neighbor index. The search walks the graph instead of comparing every vector. efSearch controls the search candidate-list size; pgvector calls it hnsw.ef_search.
Increasing it generally trades more search work for better recall. It is different from the number of results returned, top-k. Selective filters can leave too few matches; inspect filtering and iterative scan behavior in the actual database.
Approximate search can miss neighbors. ANN recall@k compares its results with an exact-search reference under the same filters. That measures index fidelity; a labeled relevance set tells us whether the retrieved passages actually help answer the question.
Combine lexical retrieval, often BM25, with semantic retrieval when exact IDs and meaning both matter. Reciprocal rank fusion can merge ranked lists without pretending their raw scores are directly comparable.
A cross-encoder reads a query and passage together to score their relevance. It can reorder candidates more precisely than comparing independently created embeddings, at the cost of extra model work.
Candidate count, passage length, batching and hardware determine that cost. Rerank a bounded set, evaluate answer quality and trace the stage. Better ordering is valuable only if the overall response still meets the project’s goals.
Technical references: pgvector HNSW · Sentence Transformers cross-encoders · Supabase hybrid search
I want to see the wait, the retrieval, the model call and the first useful response separately. Otherwise we are guessing at the bottleneck.
Same pipeline.
Different place to investigate.
The model’s prefill is the longest span here. Check context length and cache reuse before changing the vector index.
Hand-set, sequential timings for explanation. These are not production measurements, p95 results or performance predictions. Real spans can overlap.
Time until the response starts arriving. A header or empty stream event can arrive before there is anything useful to read.
Time until generated content starts. Define the boundary: model-call TTFT and the user’s request-to-first-token time are different measurements.
The time at or below which 95% of measured requests fall. Segment by workload and load; a single fast demo is not a p95 measurement.
One trace per request or workflow run, with separate observations for retrieval, reranking, each model call and each tool action. I attach prompt and model versions, token usage, latency, errors and evaluation results, with sensitive content redacted.
For a hybrid RAG pipeline behind MCP, I trace the boundary call and each internal stage. I record the first generated content timestamp, retrieval settings and source IDs so an answer can be investigated later.
Langfuse: trace structure ↗Start with slow requests in the relevant p95 cohort. Compare them with normal requests. Check which spans expanded, then correlate with inference-server metrics: queue depth, prefill time, running requests and KV-cache pressure.
Changing efSearch might help retrieval time while hurting recall. A larger rerank batch might improve relevance while increasing TTFT. I compare end-to-end latency and quality before calling either one an improvement.
Running a model locally can keep inference and data inside your environment. It also means owning capacity, updates, monitoring, access control and recovery. I work through that tradeoff before recommending the hardware.
Start with the workload: model quality, number of users, context length, response time and data boundaries. Then size the machine. “The model fits” is only the first question.
Four-bit weight quantization reduces the storage used for model weights. An 8-billion-parameter model is roughly 4 GB of raw 4-bit weights versus 16 GB at 16 bits, in decimal units, before scales, unquantized tensors and runtime overhead.
It does not make the entire application four times smaller or faster. Quantization format, kernels and hardware matter, and quality can change. I test task accuracy and throughput with the actual serving stack.
Autoregressive models retain attention keys and values so earlier tokens do not have to be recomputed at every step. This cache grows with sequence length and concurrent requests. Weight-only INT4 does not automatically make the KV cache four-bit.
A useful sizing estimate is 2 × layers × KV heads × head dimension × cached tokens × bytes per element, summed across active sequences. Architecture, cache sharing and implementation change the details. Memory pressure can force queuing, eviction or offload, each with a latency cost.
In a sparse MoE model, a learned router selects a subset of expert networks for each token. That reduces active computation relative to using every expert. The full set of weights still has to be available in memory or through an offloading strategy.
“Active parameters” helps explain compute. “Total parameters” matters for weight storage. Experts are learned components, not little people assigned to specific subjects. Routing, shared layers, interconnect bandwidth and expert imbalance all affect serving behavior.
Mixtral of Experts: original paper ↗Illustrative routes, not a model inference. Real expert counts, shared experts and routing rules vary by architecture.
Released into early access September 15, 2026 · Note updated October 1, 2026
TypeSafe introduced Jev as its first public “System One Model,” built for structured decisions with probability and confidence information. Its announcement describes a different training approach, Reinforcement Learning for Calibrated Decisions, or RLCD.
What interests me is the interface: a bounded decision that software can use directly. Routing, classification and scoring can fit that shape well. A system may not need to generate a paragraph just to choose the next step.
That changes what I would evaluate: decision accuracy, calibration, cost of a wrong action and the threshold for human review. A correctly typed decision can still be wrong. I would validate those thresholds on the actual workload and monitor them after deployment.
Read TypeSafe’s dated release announcement ↗Choose thresholds from evaluation data and the consequence of being wrong.
Bring me the task that keeps coming back, the handoff that keeps breaking or the process that is holding the business back. We’ll sit down, put numbers around the problem and work out a plan worth investing in.
Plan my automationLet’s discuss the design choices: evaluation, tool boundaries, retrieval quality, serving constraints and the traces that prove where the time went.
Email Logan at info@sunnyshoresit.com