Tools, Toolsets, Code Execution
기준일: 2026-07-26
난이도: 중급
공식 기준: Tools, Code Execution, Toolsets Reference, Tools Reference
Hermes의 도구는 toolset 단위로 켜고 끕니다. execute_code는 Python 스크립트 안에서 Hermes 도구를 RPC로 호출해, 여러 단계 작업을 한 LLM turn으로 압축합니다.
핵심 개념
| 항목 | 의미 |
|---|---|
| tool | 에이전트가 호출하는 함수 (예: web_search, terminal, delegate_task) |
| toolset | 관련 도구 묶음 (core / composite / platform) |
| platform toolset | hermes-cli, hermes-telegram, hermes-cron 등 배포 컨텍스트 기본 세트 |
execute_code |
code_execution toolset — 자식 프로세스 + Unix domain socket RPC |
| terminal backend | local, docker, ssh, singularity, modal, daytona |
카테고리 예
| 카테고리 | 도구 예 |
|---|---|
| Web | web_search, web_extract |
| Terminal & Files | terminal, process, read_file, patch |
| Browser | browser_navigate, browser_snapshot, browser_vision |
| Orchestration | todo, clarify, execute_code, delegate_task |
| Automation | cronjob |
| Memory | memory, session_search |
공통 toolset 이름 예: web, terminal, file, browser, code_execution, delegation, cronjob, safe, coding, debugging. 전체 표는 Toolsets Reference.
선택 기준
- 플랫폼별로 노출을 줄이려면
hermes toolsUI 또는toolsets:/--toolsets. - 읽기·조사만:
safe(파일 쓰기·terminal·code execution 없음). - 3회 이상 도구 호출 + 중간 필터/분기:
execute_code(중간 결과가 컨텍스트에 안 쌓임). - 단순 셸·빌드·백그라운드 프로세스:
terminal/process. - 판단이 필요한 병렬 작업:
delegate_task(위임과 Kanban). - Windows:
execute_code는 UDS 필요로 비활성 — 순차 도구 호출로 폴백.
실습
toolset 켜기
hermes chat --toolsets "web,terminal"
hermes chat --toolsets debugging
hermes tools
세션 중:
/tools list
/tools disable browser
/tools enable homeassistant
# ~/.hermes/config.yaml 예시
toolsets:
- hermes-cli
all / * 와일드카드도 있지만, 일부 도구는 백엔드·자격 증명이 있을 때만 등록되고, kanban은 all만으로 켜지지 않습니다(명시 필요).
Terminal backend
terminal:
backend: local # docker | ssh | singularity | modal | daytona
cwd: "."
timeout: 180
Docker 예: 프로세스당 긴 수명 컨테이너 하나, docker exec로 terminal/file/execute_code 공유. 보안 강화(read-only root, capability drop 등)는 공식 Tools 문서 참고.
terminal(command="pytest -v tests/", background=true)
process(action="poll", session_id="proc_abc123")
execute_code
에이전트가 from hermes_tools import ... 스크립트를 쓰면, 부모는 stub 모듈·UDS RPC를 열고 자식에서 도구를 호출합니다. 스크립트 안 사용 가능 도구: web_search, web_extract, read_file, write_file, search_files, patch, terminal(foreground only). 재귀 execute_code·delegate_task·MCP 도구는 스크립트에서 불가.
code_execution:
mode: project # project(default) | strict
timeout: 300
max_tool_calls: 50
| 모드 | 작업 디렉터리 | Python |
|---|---|---|
project |
세션 cwd (terminal과 동일) | VIRTUAL_ENV/CONDA_PREFIX 우선 |
strict |
임시 staging | Hermes sys.executable |
한도(기본): timeout 300s, stdout 50KB, stderr 10KB, tool calls 50. 자식 env에서 자격 증명 스트립; skill required_environment_variables 또는 terminal.env_passthrough로 명시 허용.
from hermes_tools import web_search, web_extract
import json
results = web_search("Python 3.13 features", limit=5)
# ... filter ...
print(json.dumps(summary, indent=2))
execute_code vs terminal vs delegate
| 용도 | 선택 |
|---|---|
| 도구 사이 로직·루프·대량 필터 | execute_code |
| 셸·빌드·대화형/백그라운드 | terminal |
| 별도 LLM 판단·격리 컨텍스트 | delegate_task |
Hermes에 입력할 프롬프트
현재 세션에 로드된 toolset과 개별 도구 목록을 알려줘.
code_execution과 terminal backend 설정(mode, timeout)을 확인한 뒤,
다음 작업을 execute_code로 한 번에 돌릴지 순차 도구로 할지 추천해줘: <작업 설명>.
체크리스트
- 플랫폼/
hermes tools에서 필요한 toolset만 켰다. - 위험 도구(browser, terminal, delegation) 노출을 최소화했다.
- multi-step 파이프라인에
execute_code한도와 mode를 이해했다. - Docker/SSH 등 backend 선택 시 영속성·보안 경계를 확인했다.
- Windows면 code execution 폴백을 가정했다.