Spaces:
Running
Running
| """๋ฃจํธ ์์ด์ ํธ โ ๊ฐ์ ํฌ์ผ ํด ํ์ดํ๋ผ์ธ ์กฐ๋ฆฝ (ํฉํ ๋ฆฌ๋ ์กฐ๋ฆฝ๋ง ๋ด๋น). | |
| pocket_session (SequentialAgent) โ ์ ์ ๋ฉ์์ง 1๊ฑด = 1ํ ์คํ | |
| โโโ pocket_context_loader โ BaseAgent: ์นด๋ ๋ธ๋ฆฌํ/๊ฒฐ ์ ์ฌ (์คํฌ์ผ๋ฌ ํํฐ) | |
| โโโ input_guard โ BaseAgent: ์ ์ฒด์ง๊ฒฉ/์ฝ์ /๋ฉํ ๊ฐ์ง โ ์ง์ ์์ฑ | |
| โโโ carmilla โ LlmAgent: ์บ๋ฆญํฐ ์๋ต | |
| โโโ director โ LlmAgent: ์ถ/๋นํธ/์๋ ด ํ์ (๋๊ตฌ๋ก state ๊ธฐ๋ก) | |
| ์ฃผ: CLAUDE.md์ turn_loop(LoopAgent) ๊ธฐ์ค ๊ตฌ์กฐ๋ ์ฌ ์ ์ฒด๋ฅผ 1ํ ํธ์ถ๋ก ๋๋ | |
| ์์จ ๋ฃจํ์ฉ์ด๋ค. ์ฌ๋์ด ํด๋ง๋ค ์ ๋ ฅํ๋ ์ฑํ ์ Runner์ ํ์ค ํจํด๋๋ก | |
| "์ ์ ๋ฉ์์ง๋ง๋ค ํ์ดํ๋ผ์ธ 1ํ ์คํ"์ด ADK ๊ณต์ ํ๋ฆ์ด๋ฉฐ, ํด ์ํยท์๋ ด | |
| ์ฌ๊ฒ์ฆ์ services/pocket.py์ ๊ฒฐ์ ์ ์ฝ๋๊ฐ ๋ด๋นํ๋ค. | |
| director๊ฐ ๋ง์ง๋ง์ด๋ฏ๋ก finish_pocket์ escalate๊ฐ ์ผํฌ ํ์ ์์ด์ ํธ๋ ์๋ค. | |
| `adk web /path/to/sorac` ์คํ ์ ์ด ๋ชจ๋์ root_agent๊ฐ ๋ ธ์ถ๋๋ค (์ฑ ์ด๋ฆ: engine). | |
| """ | |
| from __future__ import annotations | |
| from pathlib import Path | |
| from google.adk.agents import SequentialAgent | |
| from engine.agents.input_guard import create_input_guard | |
| from engine.agents.pocket_context_loader import create_pocket_context_loader | |
| from engine.repositories.content import ContentRepository | |
| from engine.sub_agents.character.agent import create_character | |
| from engine.sub_agents.director.agent import create_director | |
| _CONTENT_DIR = Path(__file__).resolve().parent.parent / "content" | |
| def create_pocket_pipeline(repo: ContentRepository | None = None, | |
| character_model=None, director_model=None) -> SequentialAgent: | |
| # ADK 2.3์ด SequentialAgent์ deprecation(โ google.adk.workflow)์ ๋์ฐ์ง๋ง, | |
| # Workflow๋ ๊ทธ๋ํ ๊ธฐ๋ฐ ์ API๋ผ CLAUDE.md์ ์์ด์ ํธ ๊ท์น๊ณผ ํจ๊ป ๋ณ๋ ๊ฒํ ํ | |
| # ๋ง์ด๊ทธ๋ ์ด์ ํ๋ค (follow-up). ํํ ๊ณต์ ๋ฆด๋ฆฌ์ค์์ SequentialAgent๋ ์ ์ ๋์. | |
| repo = repo or ContentRepository(_CONTENT_DIR) | |
| return SequentialAgent( | |
| name="pocket_session", | |
| sub_agents=[ | |
| create_pocket_context_loader(repo), | |
| create_input_guard(repo), | |
| create_character(character_model), | |
| create_director(director_model), | |
| ], | |
| ) | |
| root_agent = create_pocket_pipeline() | |