Skip to Content
ReferenceAgents.getInstructions()

Agent.getInstructions()

The .getInstructions() method retrieves the instructions configured for an agent, resolving them if they’re a function. These instructions guide the agent’s behavior and define its capabilities and constraints.

Usage example

await agent.getInstructions();

Parameters

options?:

{ runtimeContext?: RuntimeContext }
= {}
Optional configuration object containing runtime context.

Returns

instructions:

string | Promise<string>
The instructions configured for the agent, either as a direct string or a promise that resolves to the instructions.

Extended usage example

await agent.getInstructions({ runtimeContext: new RuntimeContext() });

Options parameters

runtimeContext?:

RuntimeContext
= undefined
Runtime context for dependency injection and contextual information.