> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ko/llms.txt # BatchParts프로세서 그만큼`BatchPartsProcessor`은**출력 프로세서**스트리밍 중 방출 빈도를 줄이기 위해 여러 스트림 부분을 함께 일괄 처리합니다. 이 프로세서는 네트워크 오버헤드를 줄이고, 작은 텍스트 청크를 통합하여 사용자 경험을 개선하고, 부분이 클라이언트에 내보내지는 시기를 제어하여 스트리밍 성능을 최적화하는 데 유용합니다. ## 사용예 ```typescript import { BatchPartsProcessor } from '@mastra/core/processors' const processor = new BatchPartsProcessor({ batchSize: 5, maxWaitTime: 100, emitOnNonText: true, }) ``` ## 생성자 매개변수 **options** (`Options`): 스트림 부분을 일괄 처리하기 위한 구성 옵션 **options.batchSize** (`number`): 내보내기 전에 함께 일괄 처리할 부분의 수 **options.maxWaitTime** (`number`): 배치를 내보내기 전까지 기다리는 최대 시간(밀리초)입니다. 설정하면 현재 배치가 batchSize에 도달하지 않아도 내보냅니다. **options.emitOnNonText** (`boolean`): 텍스트가 아닌 부분을 만나면 즉시 내보낼지 여부 ## 보고 **id** (`string`): 'batch-parts'로 설정되는 프로세서 식별자 **name** (`string`): 선택적 프로세서 표시 이름 **processOutputStream** (`(args: { part: ChunkType; streamParts: ChunkType[]; state: Record; abort: (reason?: string) => never }) => Promise`): 스트리밍 출력 부분을 함께 일괄 처리하도록 처리합니다. **flush** (`(state?: BatchPartsState) => ChunkType | null`): 스트림이 끝날 때 남아 있는 일괄 처리된 부분을 강제로 플러시합니다. ## 확장된 사용 예 ```typescript import { Agent } from '@mastra/core/agent' import { BatchPartsProcessor } from '@mastra/core/processors' export const agent = new Agent({ id: 'batched-agent', name: 'batched-agent', instructions: 'You are a helpful assistant', model: 'openai/gpt-5.6-sol', outputProcessors: [ new BatchPartsProcessor({ batchSize: 5, maxWaitTime: 100, emitOnNonText: true, }), ], }) ``` ## 관련된 - [난간](https://mastra.zisheng.pro/ko/docs/agents/guardrails)