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
