Prompt engineering
Also known as Prompt design, LLM prompting
Definition
Prompt engineering is the practice of designing and testing instructions, examples, context, and output requirements that guide a language model toward a useful result. It is an iterative engineering activity supported by evaluation and observability.
Start with the task contract
State the goal, constraints, available context, and desired output. Include a few representative examples when they clarify a pattern. If the application needs machine-readable data, describe a schema and validate it in code.
Test more than one example
Prompts can look excellent on a single request and fail on different wording, missing fields, or long context. Build a small evaluation dataset that reflects real traffic, including difficult and ambiguous cases. Keep prompt changes versioned so results remain comparable.
Watch the whole system
A prompt change can improve quality while increasing tokens or latency. It can also change tool calls and safety behavior. Weave connects these signals so teams can choose a prompt that improves completed work at an acceptable operating cost.
Treat a prompt as production code. Give it an owner, a version, a review path, and a rollback option. Small, documented changes make it possible to learn which instruction actually changed behavior.
How this relates to Weave
Weave helps teams compare prompt versions with model routes, token usage, latency, and evaluation outcomes. That makes prompt engineering measurable instead of relying on a few memorable examples.
Explore Token intelligence