refactor: checkpoint API cleanup

This commit is contained in:
Greyson LaLonde
2026-04-08 01:13:23 +08:00
committed by GitHub
parent 9325e2f6a4
commit 5958a16ade
11 changed files with 119 additions and 126 deletions

View File

@@ -39,7 +39,7 @@ crew = Crew(
agents=[...],
tasks=[...],
checkpoint=CheckpointConfig(
directory="./my_checkpoints",
location="./my_checkpoints",
on_events=["task_completed", "crew_kickoff_completed"],
max_checkpoints=5,
),
@@ -50,7 +50,7 @@ crew = Crew(
| 필드 | 타입 | 기본값 | 설명 |
|:-----|:-----|:-------|:-----|
| `directory` | `str` | `"./.checkpoints"` | 체크포인트 파일 경로 |
| `location` | `str` | `"./.checkpoints"` | 체크포인트 파일 경로 |
| `on_events` | `list[str]` | `["task_completed"]` | 체크포인트를 트리거하는 이벤트 타입 |
| `provider` | `BaseProvider` | `JsonProvider()` | 스토리지 백엔드 |
| `max_checkpoints` | `int \| None` | `None` | 보관할 최대 파일 수; 오래된 것부터 삭제 |
@@ -95,7 +95,7 @@ result = crew.kickoff() # 마지막으로 완료된 태스크부터 재개
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, write_task, review_task],
checkpoint=CheckpointConfig(directory="./crew_cp"),
checkpoint=CheckpointConfig(location="./crew_cp"),
)
```
@@ -118,7 +118,7 @@ class MyFlow(Flow):
flow = MyFlow(
checkpoint=CheckpointConfig(
directory="./flow_cp",
location="./flow_cp",
on_events=["method_execution_finished"],
),
)
@@ -137,7 +137,7 @@ agent = Agent(
goal="Research topics",
backstory="Expert researcher",
checkpoint=CheckpointConfig(
directory="./agent_cp",
location="./agent_cp",
on_events=["lite_agent_execution_completed"],
),
)
@@ -160,7 +160,7 @@ crew = Crew(
agents=[...],
tasks=[...],
checkpoint=CheckpointConfig(
directory="./my_checkpoints",
location="./my_checkpoints",
provider=JsonProvider(),
max_checkpoints=5,
),
@@ -179,15 +179,12 @@ crew = Crew(
agents=[...],
tasks=[...],
checkpoint=CheckpointConfig(
directory="./.checkpoints.db",
provider=SqliteProvider(max_checkpoints=50),
location="./.checkpoints.db",
provider=SqliteProvider(),
),
)
```
<Note>
`SqliteProvider`를 사용할 때 `directory` 필드는 디렉토리가 아닌 데이터베이스 파일 경로입니다.
</Note>
## 이벤트 타입