Prompt Functions: Treating Prompts as Reusable Functions
Prompt functions wrap a prompt in a name, inputs, and a rule so you can call and compose it like code. The chat-window version is dated; the idea runs everything now.
13 articles
Prompt functions wrap a prompt in a name, inputs, and a rule so you can call and compose it like code. The chat-window version is dated; the idea runs everything now.
Most agents fail for boring, fixable reasons. Here are the practices that make an agent reliable: fewer LLM calls, tools that explain themselves, and a debugging ladder to climb when it misbehaves.
smolagents ships two agent classes that act in completely different ways: one writes Python, one emits structured JSON. Here is how each works, what each is good and bad at, and when to reach for which.
Chain-of-Thought lets a model reason and compute in the same breath, which is where it slips. PAL keeps the reasoning in language but hands the math to a Python interpreter.
ART made a frozen LLM generate its own multi-step reasoning, pause to call tools, and resume. It is 2023 research, but the pattern is everywhere in modern agents.
An agent is a stateless model wrapped in a loop. Here is the ReAct pattern built from scratch: the message list as memory, the exact algorithm, and the rule that generate calls equal tool rounds plus one.
Prompt caching is solved. The bigger win for agents is caching tool-call results, and that is harder because tools have side effects. Here is how to do it safely.
How to stream LLM tokens, tool progress, and state updates from a LangGraph agent using the v2 stream API, with the custom writer pattern most people miss.
Skills give an agent deep, reusable capability without paying for it on every turn. Here is how DeepAgents loads them in layers, and how to write ones that get picked.
A practical guide to keeping production agents safe: where to put input and output rails, how to contain tools, and why prompt injection needs layers, not a fix.
Structured outputs guarantee the model's response matches your JSON schema. Here is how it works under the hood, how it relates to function calling, and the patterns that hold up in production.
A hands-on guide to building MCP servers with FastMCP, drawn from two I actually shipped: the anatomy, the rules, stdio vs remote HTTP, the pitfalls, and how to test and deploy.
An agent with no tools is just a chatbot. Here is how tool calling really works, what makes a tool the model can use reliably, and how MCP lets you plug in tools you did not write.