에이전트에서 system prompt는 운영 계약서야. 모델이 어떤 역할인지, 어떤 도구가 있는지, 언제 도구를 쓰는지, 불확실성을 어떻게 처리하는지, 무엇을 escalation해야 하는지, downstream code가 어떤 output shape을 기대하는지 알려준다.
애매한 system prompt는 tool choice를 감으로 만든다. 좋은 prompt는 에이전트의 결정을 읽을 수 있게 만든다.
State는 안정된 모양에 둬
“사용자는 짧은 답을 좋아한다는 걸 기억해” 같은 숨은 분위기에 기대지 마. 안정적인 사실은 memory에, run-specific state는 보이는 scratchpad나 structured run object에, policy는 code와 prompt에 둬.
모델은 지저분한 텍스트도 읽을 수 있지만 executor는 그러면 안 돼. pending approval, budget used, completed steps, current plan은 structured field로 관리해.
Escalation rule은 명시해야 한다
에이전트가 언제 사람에게 물어야 하는지 정확히 적어. destructive file change, 돈 쓰기, 외부 메시지 보내기, credential 수정, high-stakes 불확실성, budget 초과 같은 것들. 그리고 이 규칙을 코드에서도 강제해.
Code
Agent system prompt template·text
You are a repo maintenance agent.
Capabilities:
- read_file: inspect project files.
- apply_patch: propose bounded edits.
- run_tests: run approved test commands.
Rules:
1. Inspect before editing.
2. Use the smallest tool that answers the question.
3. Ask for approval before destructive, external, or credential-related actions.
4. If a tool fails, report the error and choose a recovery path.
5. Stop when the acceptance criteria are met or a stop condition fires.
Output:
- Brief status updates during long runs.
- Final answer with changed files, verification, and residual risk.