liveBook · Manning

LLMAgentTemplates

As explained in Build a Multi-Agent System (from Scratch)

LLMAgentTemplates is a framework type that defines the prompt templates used for standardized interactions with an agent's backbone LLM.

LLMAgentTemplates is a TypedDict that stores named string templates for standardizing an agent’s interactions with its backbone LLM. Fill template placeholders before sending the resulting text to the LLM; a system-message template, for example, can specify the task. Templates can also implement prompting techniques such as in-context learning. section 4.1.2

Listing 4.2 Implementing LLMAgentTemplates
# llm_agents_from_scratch/agent/templates/llm_agent.py
from typing import TypedDict
 
 
class LLMAgentTemplates(TypedDict):
    """Prompt templates dict for LLMAgent."""
 
    system_message: str
    # for TaskHandler #A
    get_next_step: str
    step_rollout_chat_message: str
    step_rollout_content_instruction: str
    step_rollout_content_tool_call_request: str
    run_step_system_message_without_rollout: str
    run_step_system_message: str
    run_step_user_message: str
 
 
default_templates = LLMAgentTemplates( #B
    … #C
)

See the TypedDict fields for the named templates used by the agent. section 4.1.2

How Build a Multi-Agent System (from Scratch) covers it

How deep it goes
Defines named string fields and explains placeholder filling, but does not detail each template’s content.
Examples
Uses a system-message template with a task placeholder and lists templates for agent task steps.
What it assumes
Assumes familiarity with LLM text inputs and chat messages, while illustrating placeholders with a system-message example.
What you can do after
Apply templates by filling placeholders before sending standardized prompt text to the LLM.
How it connects
Connects prompt templates to LLM agents, backbone LLMs, task execution, and in-context learning.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Multi-Agent System (from Scratch). The section links point to the parts of the book it draws on.