Git Workflows for Prompt, Tool, and Config Changes
Prompt packs, tool schemas, and runtime pins change agent behavior as much as Python modules do.
Busca en todas las páginas de la documentación
Prompt packs, tool schemas, and runtime pins change agent behavior as much as Python modules do.
Use a deliberate branch, review, and path-filter workflow so config ships with the same care as code - and so prompt-only fixes do not get buried under unrelated refactors.
Keep agent behavior files in a known tree, open focused branches per concern (prompt vs tools vs host code), require review via CODEOWNERS, run pack-aware CI path filters, and ship through a pin so production never means "whatever is on disk on the box."
agent_pack/prompts, agent_pack/tools, agent_pack/policies, deploy/pins.prompt/..., tools/..., config/..., agent/... for mixed.system_v3.txt) over silent overwrites of a single live file.agent_pack/** and deploy/pins/** through CODEOWNERS (agent + safety reviewers)."""Minimal helpers a team might share for pack-oriented PR hygiene."""
from __future__ import annotations
import json
import re
from pathlib import Path
PACK = Path("agent_pack")
BRANCH_RE = re.compile(r"^(prompt|tools|config|agent|eval)/[a-z0-9._-]+$")
def assert_branch_name(name: str) -> None:
if not BRANCH_RE.match(name):
raise ValueError(
f"unexpected branch {name!r}; use prompt|tools|config|agent|eval prefix"
)
def list_changed_pack_files(paths: list[str]) -> list[str]:
return sorted(
p
for p in paths
if p.startswith("agent_pack/") or p.startswith("deploy/pins/")
)
def validate_tools_json(path: Path) -> None:
data = json.loads(path.read_text(encoding="utf-8"))
if not isinstance(data, list):
raise ValueError(f"{path} must be a JSON array of tool definitions")
for i, tool in enumerate(data):
if "name" not in tool or "parameters" not in tool:
raise ValueError(f"{path} tool[{i}] missing name or parameters")
def pr_checklist(changed: list[str]) -> list[str]:
items = [
"Diff reviewed as behavior change (not only code style)",
"No secrets or raw prod transcripts in pack files",
"Pin / version fields updated if this ships alone",
]
if any(p.endswith(".json") and "/tools/" in p for p in changed):
items.append("Tool schema: dual-support plan if breaking")
items.append("Eval cases covering new or renamed tools")
if any("/prompts/" in p for p in changed):
items.append("Gold-set eval run or explicit waiver with owner")
return items
# Demo: simulate a prompt-only PR file list
changed = [
"agent_pack/prompts/system_v2.txt",
"deploy/pins/active.json",
]
print("pack files:", list_changed_pack_files(changed))
for line in pr_checklist(changed):
print("-", line)Example branch and commit flow (shell):
git checkout main && git pull --ff-only
git checkout -b prompt/refund-policy-v2
# add agent_pack/prompts/system_v2.txt (immutable new version)
# point deploy/pins/staging.json at prompt_version=v2
git add agent_pack deploy/pins/staging.json
git commit -m "prompt: add system_v2 refund policy wording"
# open PR → CODEOWNERS review → eval CI → merge → promote pin| Prefix | Typical files | Review focus |
|---|---|---|
prompt/ | agent_pack/prompts/** | Policy tone, refusal, tool guidance |
tools/ | agent_pack/tools/**, tool host code | Schema compatibility, side effects |
config/ | flags, model routes, spend caps | Cost, latency, blast radius |
eval/ | gold sets, scorers | Suite integrity, no silent retarget |
agent/ | mixed host + pack | Full release train discipline |
Humans scanning the PR list immediately know risk class. CI can also key notifications off prefixes.
Example idea for GitHub Actions-style CI:
on:
pull_request:
paths:
- "agent_pack/**"
- "deploy/pins/**"
- "evals/**"
- "src/agent/**"Also run a nightly full suite on main so path filters cannot hide cross-file breakage forever.
# .github/CODEOWNERS
/agent_pack/ @team-agent-owners @team-safety
/deploy/pins/ @team-agent-owners @team-platform
/evals/ @team-agent-ownersTreat tool schema breaks like API breaks. A drive-by rename of a required property is a compatibility project.
When host code must understand a new tool field:
Never pin a pack that only new code can load onto old workers. See Versioning Prompts and Tool Schemas Alongside Code.
Allow a fast path that is still reviewable:
system_vN+1 (or minimal patch file if your loader supports overlays)."SSH and edit prod prompt" is not a workflow; it is an incident in slow motion.
Workflow rules:
.env.example lists names only.Reviewers should ask:
system.txt in place so history cannot reconstruct what shipped yesterday.agent_pack/** so pack PRs merge with zero evals.| Approach | Strength | Weakness |
|---|---|---|
| Git packs + PR + pin (this recipe) | Reviewable, CI-friendly, rollbackable | Needs loader discipline |
| Prompt hub as sole source of truth | Fast UI edits | Weak PR culture unless mirrored to git |
| Feature-flag payloads only | Instant toggles | Easy to skip review if flags edited live |
| Monorepo trunk with no pack ownership | Simple ACLs | High conflict and drive-by policy edits |
| Separate config repo | Clear isolation | Version skew vs host code |
Mature teams often author in git and serve the active pin via a config service or flags.
When tools can move money, delete data, or message customers, yes. Route those paths to safety/agent owners via CODEOWNERS.
Follow the team default. What matters more is frequent integration with main so conflicts stay small and readable.
Yes if the workflow is documented, the editor is clear, and an agent owner still reviews impact and evals.
One coherent behavior change. Split "tone pass" from "new tool instructions" when both are large.
Not always. Many teams ship from main with pins and flags. Use release branches when compliance or multi-service trains require them.
New version file, changelog note, dual registration period, and eval cases for old and new. Do not reuse the same version label.
In the pin or a versioned config file under the same review rules as prompts. Model swaps change quality, cost, and tool calling.
Prefer pin rollback to a previous immutable pack. git revert on main is fine for the source of truth; production still needs the pin flip. See Rollback Strategies When a Deployed Agent Regresses.
When the product behavior intentionally changes, update fixtures in the same PR. Do not silently weaken assertions to pass a bad prompt.
If shared tool code lives outside src/agent, include those paths in the eval workflow triggers or you will miss breakages.
Stack versions: Pins from the category manifest (verify at build): OpenRouter (~315+ models, July 2026 pricing/fees); LangGraph 1.0+; CrewAI 1.14+; Microsoft Agent Framework 1.0; Vercel AI SDK 6; Pydantic AI (latest); LlamaIndex (latest); OpenAI Agents SDK (latest + MCP); MCP (Linux Foundation governance); A2A (HTTP+SSE+JSON-RPC 2.0); Solana
@solana/web3.js+@solana/spl-token.
Revisado por Chris St. John·Última actualización: 16 jul 2026