Skip to main content

Agent.getInstructions()

.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.

使用示例
Direct link to 使用示例

🌐 Usage example

await agent.getInstructions();

参数
Direct link to 参数

🌐 Parameters

options?:

{ requestContext?: RequestContext }
= {}
Optional configuration object containing request context.

返回
Direct link to 返回

🌐 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.

扩展使用示例
Direct link to 扩展使用示例

🌐 Extended usage example

await agent.getInstructions({
requestContext: new RequestContext(),
});

选项参数
Direct link to 选项参数

🌐 Options parameters

requestContext?:

RequestContext
= undefined
Request Context for dependency injection and contextual information.

🌐 Related