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?:
{ requestContext?: RequestContext }
= {}
Optional configuration object containing request context.
Returns
instructions:
SystemMessage | Promise<SystemMessage>
The instructions configured for the agent. SystemMessage can be: string | string[] | CoreSystemMessage | CoreSystemMessage[] | SystemModelMessage | SystemModelMessage[]. Returns either directly or as a promise that resolves to the instructions.
Extended usage example
await agent.getInstructions({
requestContext: new RequestContext(),
});
Options parameters
requestContext?:
RequestContext
= undefined
Request Context for dependency injection and contextual information.