Using a Language Model in Code › Key Concepts

Michael BrenndoerferJune 27, 20251 min read
AI Agent HandbookAll chapters
Part 2 of 15Language Models - The Brain of the Agent
Chapter 5Using a Language Model in Code › Key Concepts
Reading section 13 of 15 · Key Concepts · 1 minSection 13 of 15 · 1 min

Book contents

Section 13 of 15 · 1 min read

Using a Language Model in Code › Key ConceptsOne section · Sections in this chapter13 / 15 ↓

API (Application Programming Interface): A way for programs to communicate with each other. In our case, we use APIs to send requests to language model providers and receive responses.

API Key: A secret credential that authenticates your requests to an API. Think of it like a password that identifies you to the service provider.

System Message: Instructions that set the language model's behavior, personality, or role. This is where you tell the model "You are a helpful assistant" or "You are an expert programmer."

Temperature: A parameter that controls randomness in the model's responses. Low temperature (0.0-0.3) makes responses more focused and deterministic; high temperature (0.7-1.0) makes them more creative and varied. Note: GPT-5 has removed this parameter; use Claude Sonnet 4.5 or Gemini 2.5 if you need temperature control.

Tokens: The units that language models process. Roughly, a token is a piece of a word (common words are one token, longer words might be two or three). Both input (your prompt) and output (the model's response) are measured in tokens.

Max Tokens: A parameter that limits how long the model's response can be. Useful for controlling costs and ensuring responses stay concise.