> Discover all available pages from the documentation index: https://mastra.zisheng.pro/zh-TW/llms.txt # Agent.getInstructions() `.getInstructions()` 方法會取得為 Agent 設定的指示;若指示為函式,也會解析函式。這些指示會引導 Agent 的行為,並定義其能力與限制。 ## 使用範例 ```typescript await agent.getInstructions() ``` ## 參數 **options** (`{ requestContext?: RequestContext }`): 包含 request context 的選用設定物件。 (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-TW/docs/agents/overview) - [Request Context](https://mastra.zisheng.pro/zh-TW/docs/server/request-context)