# Agents

> Flow를 수행하는 전문 agents와 이를 안전하게 유지하는 보호 장치입니다.

[Flow](https://pentagi.com/ko/docs/glossary/#flow)는 [agents](https://pentagi.com/ko/docs/glossary/#agent) 팀에 의해 수행됩니다. 각 [agent type](https://pentagi.com/ko/docs/glossary/#agent-type)은 고유한 프롬프트, 모델 설정 및 [tools](https://pentagi.com/ko/docs/glossary/#tool)를 가지므로 역할별로 더 강력한 모델이나 저렴한 모델을 할당할 수 있습니다.

## [Agent types](https://pentagi.com/ko/docs/concepts/agents/#agent-types)

| Agent                   | 역할                                                                                                |
| ----------------------- | ------------------------------------------------------------------------------------------------- |
| `primary_agent`         | Flow를 주도하는 주요 추론 agent                                                                            |
| `assistant`             | 대화형 [assistant](https://pentagi.com/ko/docs/glossary/#assistant) 모드                                                     |
| `generator`             | 각 [task](https://pentagi.com/ko/docs/glossary/#task)를 [subtask](https://pentagi.com/ko/docs/glossary/#subtask)로 분할                            |
| `refiner`               | 결과가 들어옴에 따라 계획 개선                                                                                 |
| `adviser`               | 전문가 조언; 실행 모니터링 시 멘토 및 task 계획 시 플래너 역할                                                           |
| `reflector`             | [Tool calls](https://pentagi.com/ko/docs/glossary/#tool-call) 생성을 멈춘 agents 수정                                          |
| `searcher`              | 정보 수집 및 웹 검색                                                                                      |
| `enricher`              | adviser가 응답하기 전 [memory](https://pentagi.com/ko/docs/glossary/#memory)와 [sandbox](https://pentagi.com/ko/docs/glossary/#sandbox)에서 추가 컨텍스트 수집 |
| `coder`                 | 코드 작성 및 분석                                                                                        |
| `installer`             | Sandbox 내 tools 설치 및 설정                                                                           |
| `pentester`             | [Pentest](https://pentagi.com/ko/docs/glossary/#pentest) 및 보안 평가                                                        |
| `simple`, `simple_json` | 일반 및 JSON 구조화된 완성                                                                                 |

두 개의 추가 agents가 백그라운드에서 작동합니다: `memorist`는 장기 memory로부터 과거 작업에 대한 다른 agents의 질문에 답변하고, `reporter`는 각 task의 결과를 작성합니다.

## [작업 위임 방식](https://pentagi.com/ko/docs/concepts/agents/#how-work-is-delegated)

```mermaid
sequenceDiagram
  accTitle: How a task is split into subtasks and the primary agent delegates each step to specialist agents through shared memory
  participant G as Generator
  participant O as Primary agent
  participant M as Memorist
  participant S as Specialists
  participant V as Vector store
  G->>O: Subtasks of the task
  O->>M: Past work, when the context lacks it
  M->>V: Search memory
  O->>S: Delegate a step to the searcher, pentester, coder or installer
  S->>V: Store tool results
  S-->>O: Result
```

## [안전 장치](https://pentagi.com/ko/docs/concepts/agents/#safeguards)

* **Tool call 제한** (항상 켜짐) — `MAX_GENERAL_AGENT_TOOL_CALLS`(기본값 100)은 `primary_agent`, `assistant`, `pentester`, `coder` 및 `installer`의 체인에서 모델 턴 수를 제한하고, `MAX_LIMITED_AGENT_TOOL_CALLS`(기본값 20)은 다른 agent들의 턴 수를 제한합니다. 한 턴에서 여러 tool을 호출할 수 있습니다. 1에서 5 사이의 값은 6으로 조정되며, 0 이하의 값은 기본값을 의미합니다.
* **반복 감지** (항상 켜짐) — 동일한 인수로 같은 tool에 세 번째 연속 호출부터는 tool이 다시 실행되지 않습니다: agent는 이전 응답을 되돌려받으며 진행 방향을 바꾸라는 요청을 받습니다. 일곱 번째 그러한 호출은 체인을 종료합니다.
* **Reflector** (항상 켜짐) — 모델이 tool call 없이 처음 응답할 때 개입하여 agent를 tool call로 다시 유도하며, 세 번의 시도 실패 후 체인이 중지됩니다.
* **실행 모니터링** (베타, `EXECUTION_MONITOR_ENABLED`) — `primary_agent`, `pentester`, `coder`, `installer`, 그리고 agent와 함께 작업할 때의 `assistant`의 경우, agent가 동일한 tool을 연속으로 `EXECUTION_MONITOR_SAME_TOOL_LIMIT`회 호출(기본값 5)하거나 마지막 조언 이후 `EXECUTION_MONITOR_TOTAL_TOOL_LIMIT`회의 tool call을 수행하면(기본값 10) adviser가 멘토 역할을 수행합니다. 이 트리거는 정체를 감지하는 것이 아니라 호출 횟수를 기준으로 작동하며, adviser는 agent의 진행 상황을 검토하여 계속 진행할지, 접근 방식을 변경할지 또는 중단할지를 권장합니다.
* **지능형 task 계획** (베타, `AGENT_PLANNING_STEP_ENABLED`) — 전문가가 subtask를 시작하기 전에 adviser가 3\~7개의 구체적인 단계를 초안으로 작성합니다.

> [!NOTE]
> 실행 모니터링과 task 계획은 토큰과 시간을 2\~3배 더 소모하는 대가로 32B 파라미터 미만 모델의 결과 품질을 대략 두 배로 높여줍니다. 기본적으로 꺼져 있습니다.

Enterprise에서는 planner가 항상 실행되며, 실행 모니터링은 기본적으로 켜져 있고 제한 값은 20과 40입니다 — [Agent profiles](https://pentagi.com/ko/docs/enterprise/agent-profiles/#planner-and-execution-monitor)를 참조하세요.