NylorunDocsBeta
BuildDefine

Instructions

Instruction strings on the agent, the notes our harness adds, and instructions for one turn.

Instructions are what the model reads before it answers. Add them with .instructions():

export const assistant = Agent({ id: "assistant", name: "Order assistant" })
  .instructions("Help with orders. Always use lookup_order for order questions.")
  .build();

.instructions() takes one or more strings and accumulates: each call adds to the ordered list, the instructions of the agent manifest's harness section. A function that adds tools and instructions to several agents adds to the same list; see Reuse.

What the harness adds

The model reads the agent's instructions first, then the notes the harness writes for the session. Nothing is added to the agent manifest: the harness writes them at each turn from what the agent declares and the Agent the session runs on. Our harness writes, in this order:

  • the skills' usage and catalog, when the agent has skills;
  • a note on the sandbox and its workspace, when the Agent has a sandbox, and a note on where each skill's files are in it;
  • the notes on reading and saving artifacts;
  • a note on schedule_wake, when the manifest's runtime section sets selfWake (see Triggers and wakes);
  • the memory rules, then the manifest's harness.memory.instructions, when it turns memory on (see Agent memory).

A custom harness writes its own.

Instructions for one turn

Instructions are part of the manifest, so no code of yours runs to change them during a session. To change them for one turn, send the message with a turn manifest: a message command with manifest, sent through session.command(). A turn manifest can also leave out tools the model should not see in that turn. It cannot add tools or change the agent's skills. Request shapes are on the Runtime API.

Do not put secrets in instructions or manifests. They become history.

Next step

On this page