> Discover all available pages from the documentation index: https://mastra.zisheng.pro/zh-HK/llms.txt # Agent.getInstructions() `.getInstructions()` 方法會取得為 Agent 設定的指示;如設定為函數,則會先解析函數。這些指示會引導 Agent 的行為,並定義其能力及限制。 ## 使用範例 ```typescript await agent.getInstructions() ``` ## 參數 **options** (`{ requestContext?: RequestContext }`): 包含請求內容的可選設定物件。 (Default: `{}`) **options.requestContext** (`RequestContext`): 用於依賴注入及內容資訊的 Request Context。 ## 傳回值 **instructions** (`SystemMessage | Promise`): 為 Agent 設定的指示。SystemMessage 可以是:string | string\[] | CoreSystemMessage | CoreSystemMessage\[] | SystemModelMessage | SystemModelMessage\[]。此方法會直接傳回指示,或傳回解析為指示的 promise。 ## 延伸使用範例 ```typescript await agent.getInstructions({ requestContext: new RequestContext(), }) ``` ## 相關內容 - [Agent 概覽](https://mastra.zisheng.pro/zh-HK/docs/agents/overview) - [Request Context](https://mastra.zisheng.pro/zh-HK/docs/server/request-context)