Context Engineering Template for AI Systems

1. Define System Role and Instructions

2. Collect User Input and Interaction History

3. Retrieve Relevant External Knowledge

4. Incorporate User Profile and Preferences

5. Prepare Tool and API Context

6. Context Formatting and Prioritization

7. Specify Expected Output Formats or Constraints


Example of a Filled Template

  1. Role: Sustainability analyst specializing in supply chain emissions.
  2. User Input: User asks, “How can I reduce transportation emissions in my logistics network?” Conversation history includes discussion of current fleet fuel use.
  3. External Knowledge: Latest supply chain carbon reports 2023, lifecycle assessment data.
  4. User Profile: Logistics manager with intermediate AI familiarity.
  5. Tools: Access to real-time vehicle tracking API and carbon calculator API.
  6. Formatting: Summarize key strategies; list pros and cons in bullets; limit to 5 points.
  7. Expected Output: Bullet points with citations and actionable recommendations.