Token problems: 5 of 20
By Prof. Tom Yeh
Published: 2026-05-28
URL: https://www.byhand.ai/p/library-agents-tokens-will-it-fit
Token problems: the workbook
- Will It Fit?
Can an agent always read a document it is given? Not if the document exceeds the space that remains in the context window. The window is shared: the system prompt and conversation history already occupy part of it. Estimate the document size first, then compare it to what is left. If the estimate exceeds the remaining space, the agent cannot read it in one call.
Problem
An agent has a 4,000-token context window. The system prompt and conversation history already use 1,200 tokens. The document to read is 55 paragraphs, each about 50 tokens. Can the agent read the document in this call?
Space available for the document

Estimate the document

Does it fit?

Practice 1
An agent has a 4,000-token context window. The system prompt and conversation history already use 600 tokens. The document to read is 8 pages, each about 500 tokens. Can the agent read the document in this call?
Space available for the document

Estimate the document

Does it fit?

Practice 2
An agent has a 4,000-token context window. The system prompt and conversation history already use 1,000 tokens. The document to read is 18 slides, each about 150 tokens. Can the agent read the document in this call?
Space available for the document

Estimate the document

Does it fit?

Next: 6. The Price of a Call