Ch6. Context, Skills, Dynamic Capabilities
Eve의 컨텍스트 제어 원칙과 skills, dynamic tools, dynamic instructions를 활용한 고급 에이전트 설계를 정리한다.
핵심 요약
- 고품질 Eve 에이전트는 모든 정보를 prompt에 넣지 않고 instructions, skills, dynamic capabilities로 분해합니다.
- Skill description은 모델의 routing contract이므로 짧고 구체적이어야 합니다.
- dynamic tools/instructions/skills는 권한을 좁히고 테넌트별로 기능을 노출하는 데 유용하지만, 이름과 이벤트 순서는 운영 기준으로 관리해야 합니다.
에이전트 품질은 모델보다 컨텍스트 설계에 더 자주 좌우됩니다. Eve는 컨텍스트를 한 prompt에 다 붙이지 않고 always-on instructions, on-demand skills, dynamic capabilities, sandbox workspace로 나눕니다.
컨텍스트 레버
| 레버 | 모델에게 보이는 시점 | 사용 기준 |
|---|---|---|
instructions.md | 모든 turn | 정체성, 안전 원칙, 답변 기본 규칙 |
instructions.ts | build-time 생성 후 모든 turn | typed helper로 prompt 조립 |
skills/ | 모델이 load_skill 호출 후 | 긴 절차, 플레이북, 참고 자료 |
tools/ | tool descriptor는 항상 또는 동적으로 | 실행 가능한 capability |
sandbox/workspace | 모델이 파일 도구로 읽을 때 | 데이터/스크립트/artifact |
| subagent | parent가 delegation할 때 | 별도 role/tool surface |
defineDynamic | session/turn/step event 후 | 사용자/테넌트/상태별 capability |
좋은 Eve 에이전트는 “항상 보이는 prompt”를 줄이고 “필요할 때 드러나는 지식/도구”를 늘립니다.
Instructions는 짧고 안정적으로
instructions.md에는 변하지 않는 계약만 넣습니다.
좋은 예:
You are an internal operations agent.
Verify facts before taking action.
For destructive or external side-effecting actions, explain the planned action and wait for approval.
Use available skills when a task matches their description.나쁜 예:
- 모든 업무 절차를 instructions에 붙인다.
- 팀별 정책을 하나의 prompt에 모두 넣는다.
- 자주 바뀌는 가격/조직/권한 정보를 prompt에 하드코딩한다.
자주 바뀌는 정보는 dynamic instructions 또는 tool/connection으로 가져와야 합니다.
Skills는 procedure memory다
Eve skill은 “새 실행 능력”이 아니라 “모델이 로드하는 절차”입니다. tool은 skill을 로드하기 전에도 보일 수 있습니다. 여기를 헷갈리면 skill을 보안 경계로 오해합니다.
| 필요 | Skill | Tool |
|---|---|---|
| 릴리즈 절차를 설명 | 적합 | 부적합 |
| GitHub release 생성 | 부적합 | 적합 |
| 사고 대응 체크리스트 | 적합 | 부적합 |
| PagerDuty incident 생성 | 부적합 | 적합 |
Packaged skill은 sibling files를 가질 수 있습니다.
agent/skills/incident-response/
├── SKILL.md
├── references/severity-matrix.md
└── scripts/render-report.ts모델은 load_skill로 SKILL.md를 prompt에 추가하고, 필요하면 sandbox file tools로 sibling files를 읽습니다.
Skill description은 routing contract다
description은 “무엇인지”보다 “언제 써야 하는지”를 적습니다.
| 약한 설명 | 좋은 설명 |
|---|---|
| Release checklist | Use when planning, validating, or rolling back a production release. |
| SQL guide | Use when writing read-only warehouse queries or validating metric definitions. |
| Incident docs | Use when triaging severity, assigning incident roles, or writing postmortems. |
Eve는 skill description을 모델에게 광고합니다. 설명이 약하면 모델은 skill을 로드하지 않습니다.
Dynamic tools
defineDynamic을 agent/tools/*.ts에서 사용하면 session/turn/step event에 따라 tool set을 생성할 수 있습니다.
대표 시나리오:
| 시나리오 | event |
|---|---|
| tenant별 warehouse table tool 생성 | session.started |
| turn별 화면/route context에 맞는 UI action 제공 | turn.started |
| 직전 tool result에 따라 임시 repair tool 제공 | step.started |
여기서 주의할 점은 dynamic tool의 execute가 inline function이어야 한다는 것입니다. Eve bundler transform은 inline execute closure를 step boundary 이후에도 복원하도록 처리합니다. execute: myFn 형태로 쓰면 replay/resume 안정성이 깨질 수 있습니다.
Dynamic naming
Dynamic tool map을 반환하면 tool name은 <fileSlug>__<key>가 됩니다.
export default defineDynamic({
events: {
"session.started": async () => ({
orders: defineTool({ /* query__orders */ }),
users: defineTool({ /* query__users */ }),
}),
},
});이 naming은 운영 로그와 eval에 그대로 남습니다. key가 tenant data에서 온다면 sanitize하고, 이름이 흔들리지 않게 유지해야 합니다.
Dynamic skills와 instructions
팀/역할/요금제별 컨텍스트는 dynamic skills/instructions가 적합합니다.
import { defineDynamic, defineInstructions } from "eve/instructions";
export default defineDynamic({
events: {
"session.started": (_event, ctx) => {
const plan = ctx.session.auth.current?.attributes.plan ?? "unknown";
return defineInstructions({
markdown: `The caller plan is ${plan}. Apply the matching support policy.`,
});
},
},
});보안상 중요한 점:
- dynamic resolver는
ctx.session.auth를 기준으로 capability를 제한할 수 있다. - 제한된 capability가 prompt에 노출되기 전에 route auth가 정확해야 한다.
- channel metadata도 resolver 입력이 되므로, channel은 신뢰할 수 있는 metadata만 project해야 한다.
Event 순서
Eve의 stream event 처리 순서는 구조적입니다.
- channel adapter handler가 실행된다.
- channel metadata projection이 갱신된다.
- hooks가 실행된다.
- dynamic tool/skill/instruction resolver가 실행된다.
그래서 dynamic resolver는 갱신된 channel metadata를 읽습니다. 예를 들어 channel event handler가 Slack thread state를 업데이트하면, dynamic skill resolver가 그 thread의 team/playbook을 고릅니다.
컨텍스트 오염 방지 패턴
| 위험 | 대응 |
|---|---|
| 모든 정책이 always-on prompt에 들어감 | skills로 분리 |
| tenant A의 플레이북이 tenant B에게 보임 | dynamic skills + route auth + eval |
| tool output이 과도하게 모델 history에 남음 | toModelOutput으로 축약 |
| 파일/문서 전체를 prompt에 붙임 | sandbox workspace + read_file |
| subagent에 불필요한 root 권한 전달 | declared subagent로 별도 surface 구성 |
평가 기준
컨텍스트 설계는 eval로 검증해야 합니다.
| Eval | 기대 |
|---|---|
| skill routing | 관련 task에서 load_skill 호출 |
| least context | 무관 task에서 skill 미호출 |
| tenant isolation | 다른 principal로 접근 시 dynamic skill/tool 미노출 |
| prompt compactness | long session에서 compaction 이후 핵심 state 유지 |
| tool output minimization | model reply에 secret/PII가 섞이지 않음 |
Eve의 progressive disclosure는 고급 기능이지만 품질을 저절로 보장하지는 않습니다. description, routing eval, dynamic resolver의 auth 기준이 함께 갖춰져야 합니다.