> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ko/llms.txt # Memory.createThread() 그만큼`.createThread()`메소드는 Memory 시스템에 새로운 대화 스레드를 생성합니다. 각 스레드는 고유한 대화나 컨텍스트를 나타내며 여러 메시지를 포함할 수 있습니다. ## 사용예 ```typescript await memory?.createThread({ resourceId: 'user-123' }) ``` ## 매개변수 **resourceId** (`string`): 이 스레드가 속한 리소스의 식별자입니다(예: 사용자 ID, 프로젝트 ID). **threadId** (`string`): 스레드에 사용할 선택적 사용자 정의 ID입니다. 제공하지 않으면 자동으로 생성됩니다. **title** (`string`): 스레드의 선택적 제목 **metadata** (`Record`): 스레드와 연결할 선택적 메타데이터 ## 보고 **id** (`string`): 생성된 스레드의 고유 식별자 **resourceId** (`string`): 스레드와 연결된 리소스 ID **title** (`string`): 스레드의 제목(제공된 경우) **createdAt** (`Date`): 스레드가 생성된 시점의 타임스탬프 **updatedAt** (`Date`): 스레드가 마지막으로 업데이트된 시점의 타임스탬프 **metadata** (`Record`): 스레드와 연결된 추가 메타데이터 ## 확장된 사용 예 ```typescript import { mastra } from './mastra' const agent = mastra.getAgent('agent') const memory = await agent.getMemory() const thread = await memory?.createThread({ resourceId: 'user-123', title: 'Memory Test Thread', metadata: { source: 'test-script', purpose: 'memory-testing', }, }) const response = await agent.generate('message for agent', { memory: { thread: thread!.id, resource: thread!.resourceId, }, }) console.log(response.text) ``` ### 관련된 - [Memory 클래스 참조](https://mastra.zisheng.pro/ko/reference/memory/memory-class) - [Memory 시작하기](https://mastra.zisheng.pro/ko/docs/memory/overview)(스레드 개념을 다룹니다) - [getThreadById](https://mastra.zisheng.pro/ko/reference/memory/getThreadById) - [목록스레드](https://mastra.zisheng.pro/ko/reference/memory/listThreads) - [상기하다](https://mastra.zisheng.pro/ko/reference/memory/recall)