liveBook · Manning

Prompt

As explained in Digital Twins in Action

A system prompt is a high-level instruction supplied to a model that establishes an agent's role, behavior, and constraints.

A system prompt gives an agent high-level instructions about its role and constraints. It guides decisions in a multi-step agent loop; the agent framework manages reasoning, tool execution, and context. section 8.4.3

Home climate control

A climate-control prompt prioritizes minimizing grid electricity purchases over comfort. It supplies target temperatures, an estimated AC load, and baseload assumptions because instantaneous consumption is not available programmatically. Its policy directs the agent to fetch solar, forecast, and indoor-temperature data, calculate excess solar power, choose a cooling state, and avoid rapid AC cycling. section 8.4.3

Listing 8.11 Agent with Strands SDK for home climate control
import datetime
from strands import Agent

current_time_str = datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ")

system_prompt = f"""  #1
### ROLE
Climate Control Agent. Current Time: {current_time_str}.

### CONSTANTS
- **Target Temp:** 21°C–24°C
- **AC Load:** 1500W
- **Baseload:** 1000W (08:00–16:00); 200W (otherwise).

### CONTROL POLICY
1. **Fetch Data:** Get current solar ($P_{{solar}}$), forecast,
   and indoor temp ($T_{{room}}$ (last 24 hours).
2. **Calculate Excess:** $P_{{excess}} = P_{{solar}} - \\text{{Baseload}}$.
3. **Evaluate State:**
   - **COOLING NEEDED** if $T_{{room}} > 24°C$.
   - **OPPORTUNISTIC COOLING** if $P_{{excess}} > 1500W$ AND $T_{{room}} >
     21°C$ (Priority: Solar).
   - **IDLE** otherwise.
4. **Safety:** Apply hysteresis (don't cycle AC if state changed
   <15 mins ago).
5. **Priorities:** Always prioritize minimizing grid consumption
over comfort.

### OUTPUT INSTRUCTION
Output a concise reasoning step (e.g., "Excess solar 1600W > AC Load;
engaging cooling."), then call `set_aircon_state` if a change is needed.
"""

agent = Agent(  #2
    name="ClimateAgent",
    system_prompt=system_prompt,
    tools=[
        get_realtime_solar_data,
        get_weather_forecast,
        get_space_climate_history,
        set_aircon_state,
    ],
)

The agent listing shows the prompt as a Python string with separate role, constants, and control-policy instructions. section 8.4.3

How Digital Twins in Action covers it

How deep it goes
Shows a concrete prompt with constants and decision steps, but does not explain how the model interprets those instructions internally.
Examples
Uses a home climate-control policy with temperature thresholds, baseload estimates, excess-solar calculations, and AC hysteresis.
What you can do after
Operate/configure it to set an agent’s role, priorities, assumptions, and control steps.
How it connects
Links system prompts to agent loops, tool execution, solar forecasting, and home digital twins.

Also explained in

Compare how 50 books explain prompt →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Digital Twins in Action. The section links point to the parts of the book it draws on.