← All notes

Sizing Ollama for agent work: context length and keep-alive

Answer: Ollama's docs say tasks like agents and coding tools need a context length of at least 64000 tokens. A larger context length increases the memory required, so check VRAM first.

Context length

Context length is the maximum number of tokens the model has access to in memory. The context-length page lists defaults by VRAM:

The FAQ still says the default context window size is 4096 tokens, overridable with OLLAMA_CONTEXT_LENGTH. A larger context length increases the memory required to run a model. For best performance, avoid offloading the model to CPU and verify the split under PROCESSOR with ollama ps.

Keep-alive

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: GitHub repository docs under Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0) or MIT License (https://opensource.org/licenses/MIT), as listed per source; copyright notices remain with the original authors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Ollama docs (GitHub), Context length, MIT (ollama/ollama LICENSE); Ollama docs (GitHub), Ollama FAQ, MIT (ollama/ollama LICENSE).

Cite this

Permanent ID: iil:note:sh9ew70m

iinventedlight. 2026. "Sizing Ollama for agent work: context length and keep-alive." iinventedlight Library, iil:note:sh9ew70m, version of 2026-11-09. https://iinventedlight.com/library/notes/ao-idlehw-ollama-context-and-keepalive/. License: CC-BY-4.0.

@misc{iil_note_sh9ew70m,
  author = {{iinventedlight}},
  title = {{Sizing Ollama for agent work: context length and keep-alive}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-09},
  url = {https://iinventedlight.com/library/notes/ao-idlehw-ollama-context-and-keepalive/},
  note = {Permanent ID iil:note:sh9ew70m. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-idlehw-ollama-context-and-keepalive.md.