Skip to main content

Templates

Predefined system prompts for common use cases.

Available templates​

TemplateBest for
defaultGeneral assistant
coderProgramming tasks
researcherResearch and analysis
creativeCreative writing
analystData analysis
tutorTeaching and explaining

Usage​

from pure_agents import Agent

# Expert programmer
coder = Agent(template="coder")
await coder.run("Write a function to merge two sorted lists")

# Research assistant
researcher = Agent(template="researcher")
await researcher.run("What are the main causes of inflation?")

# Creative writer
creative = Agent(template="creative")
await creative.run("Write a haiku about debugging")

With tools​

Templates work with tools:

@tool
def run_code(code: str) -> str:
"""Execute Python code."""
return str(exec(code))


coder = Agent(template="coder", tools=[run_code])

Custom templates​

For custom prompts, use system directly:

agent = Agent(system="You are a pirate. Respond in pirate speak. Arrr!")

View template content​

from pure_agents import TEMPLATES

for name, prompt in TEMPLATES.items():
print(f"{name}: {prompt[:60]}...")