> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ko/llms.txt # 사용자 Tool에 물어보세요 사용자에게 질문하고 응답을 기다리는 Agent에 구애받지 않는 내장 Tool입니다. 이 Tool은 자유 텍스트 질문, 단일 선택 Prompt 및 다중 선택 Prompt를 지원합니다. Tool은 기본 [Tool 일시 중단](https://mastra.zisheng.pro/ko/docs/agents/agent-approval) 프리미티브를 통해 일시 중단됩니다. 질문 페이로드와 함께 `suspend()`를 호출하면 Agent가 `tool-call-suspended` 이벤트와 영구 실행 상태를 방출합니다. `agent.resumeStream(answer, { runId })`을 사용하여 실행을 재개하세요. Agent 실행 외부에서 실행되어 `suspend`를 사용할 수 없는 경우 Tool은 질문과 선택지가 포함된 읽기 쉬운 대체 문자열을 반환합니다. ## 사용예 Agent의 Tool 집합에 `askUserTool`을 추가하세요. ```typescript import { Agent } from '@mastra/core/agent' import { askUserTool } from '@mastra/core/tools' const agent = new Agent({ id: 'assistant', name: 'Assistant', instructions: 'Ask the user for clarification when the request is ambiguous.', model, tools: { askUserTool }, }) ``` 정지 처리 및 재개: ```typescript const stream = await agent.stream('Summarize my project') for await (const chunk of stream.fullStream) { if (chunk.type === 'tool-call-suspended') { const { question, options, selectionMode } = chunk.payload.suspendPayload // Present the question to the user, collect their answer, then resume: const resumed = await agent.resumeStream('The main repo', { runId: stream.runId }) for await (const c of resumed.textStream) process.stdout.write(c) } } ``` 다중 선택 Prompt의 경우 문자열 배열로 다시 시작하세요. ```typescript await agent.resumeStream(['Add tests', 'Update docs'], { runId: stream.runId }) ``` ## 입력 스키마 Model은 다음 매개변수를 사용하여 이 Tool을 호출합니다. **question** (`string`): 사용자에게 할 질문입니다. 비어 있으면 안 됩니다. **options** (`AskUserOption[]`): 사용자에게 제공할 구조화된 선택지입니다. 생략하면 Prompt가 자유 텍스트 형식이 됩니다. **options.label** (`string`): 이 선택지에 표시할 짧은 텍스트입니다. 선택하면 이 값이 Model에 반환됩니다. **options.description** (`string`): 이 선택지의 의미에 대한 설명입니다. **selectionMode** (`'single_select' | 'multi_select'`): 사용자가 선택할 수 있는 선택지 수를 제어합니다. 선택지가 제공된 경우 기본값은 'single\_select'입니다. options가 필요합니다. ## 페이로드 일시중단 `tool-call-suspended` 이벤트에는 입력과 동일한 형태의 `suspendPayload`가 담깁니다. **question** (`string`): 사용자에게 표시되는 질문입니다. **options** (`AskUserOption[]`): 구조화된 선택지가 있는 경우 해당 선택지입니다. **selectionMode** (`'single_select' | 'multi_select'`): 확정된 선택 모드입니다. 자유 텍스트 Prompt에서는 생략됩니다. ## 데이터 재개 사용자의 답변을 다음으로 전달합니다.`agent.resumeStream()`: - **자유 텍스트 및 단일 선택:** `string`입니다. - **다중 선택:** 선택된 선택지 레이블의 `string[]`입니다.