Topic 3 of 5 · 4 min read
Prompts, system prompts and tool calls
Goal: Label each part of a conversation as system prompt, user prompt, assistant reply or tool call.
A prompt is what you send, a system prompt is the hidden set of instructions the app adds, and a tool call is the model asking the app to run something for it. Together they make up every conversation you have with an assistant.
Check yourself · 1 of 3
A company's support bot starts every chat with hidden text that says, "Only answer questions about orders." What is that text?
Why it matters
When an assistant behaves oddly, it helps to know which part caused it. A refusal might come from the system prompt, a wrong answer from a missing tool, a long delay from a tool call. You cannot fix what you cannot name.
The parts of a conversation
- System prompt. Instructions written by the app's maker, placed before your first message. They set the role, tone, rules and sometimes the tools. A customer-service bot might have a system prompt such as "You are a helpful agent for Northwind. Only discuss orders." You usually cannot see it. It outranks your request when the two clash.
- User prompt. Your message. This is the part you control. Good user prompts name the task, the context and the format you want.
- Assistant reply. The model's answer. It is text generated from everything before it. Its past replies also count as input to the next turn.
- Tool call. Some assistants can use tools: search the web, read a file, run a calculator, check a calendar. The model does not run the tool itself. It writes a request such as "search for Northwind opening hours". The app runs it and passes the result back, and the model then writes its reply using that result.
Each of these takes up space in the context window.
Before and after
Before: "The bot ignored me when I asked for a joke."
After: "The app's system prompt limits it to order questions, so it declined. My user prompt was fine; the system prompt wins."
Another example: you ask for today's weather and the reply is right. That is probably a tool call to a weather service. If the same assistant has no search tool, it may guess from old data instead.
What goes wrong
- People believe "prompt" always means their own message. In product docs it can mean the full text sent, including the system part.
- People try to override a system prompt with a clever message. It sometimes works, but apps are built to resist it, and it can break the terms of use.
- People assume the model used a tool when it did not. Check for a visible tool step, such as "searched the web". If you do not see one, the answer came from the model's memory.
- People forget that tool results can be wrong or contain instructions that should not be followed.
Examples
Label the lines
"You are a polite travel assistant. Never discuss visas." is a system prompt. "Find me a train to Porto on Friday." is a user prompt. "search_trains(Lisbon, Porto, Friday)" is a tool call. "There are three trains..." is the assistant reply.
Why the bot said no
A banking app's bot refuses to write a poem. The system prompt says to discuss only account help. Rewording your own prompt will not change that.
Key points
- A system prompt is hidden instruction text from the app's maker that sets role, rules and tools before your message.
- Your user prompt is the part you control, and it works best with a clear task, context and format.
- A tool call is the model asking the app to run an action, such as a search; the app runs it and returns the result.
- Every part of the conversation, including hidden ones, takes up space in the context window.
- If you see no tool step, assume the answer came from the model's own memory and check it.
Common mistakes
- Thinking your message is the only text the model sees.
- Trying to argue the assistant out of its system prompt.
- Assuming a tool was used when no tool step is shown.
- Trusting a tool result without checking its source.
Check yourself · 2 of 3
An assistant writes, "search: Northwind opening hours," and the app then returns a web page. What did the model do?
Check yourself · 3 of 3
You ask a shopping bot for a poem and it declines. Which is the most likely cause?
Practice items, not counted towards your mastery.
Start here
- Glossary (Claude docs) (opens in a new tab)DocsFree
Anthropic's own definitions of context window, tokens, fine-tuning, RAG and more.
- Machine Learning Glossary (Google for Developers) (opens in a new tab)DocsFree
A long, trusted glossary to look up any term you meet.
- Tokenizer (OpenAI) (opens in a new tab)ToolFree
Paste text and see how it splits into tokens and how many there are.