Skip to main content

agent-branches API

📄️Fork new variant branch

Forks a new CANDIDATE branch, copying a spec into a fresh, independent artifact lineage. The source can be this agent's own lineage (`published`, `draft`, or a specific artifact `version`), ANOTHER agent in the same application (`agent`, copying that agent’s published version or current draft), or a spec document supplied inline (`spec`, e.g. the `agent.spec` of an exported agent file — only the spec is imported; evals, routines, sub-agents and insights in the export are not). Never touches the agent's published pointer — a fork is purely additive until a later promote. Capped at 10 live variants per agent.

📄️Promote variant branch to MAIN

Promotes a variant branch: makes it the agent's main line by flipping the agent's draft pointer (`Agent.metadata.specArtifactId`) and both branch rows (old MAIN -> CANDIDATE, variant -> MAIN) together. The old MAIN line is demoted, not archived — it keeps its artifact and version history and stays a fully editable variant that can be renamed, edited, promoted back, or deleted. This does **not** publish — `Agent.publishedArtifactId`/`publishedVersion` are left exactly where they were, and production keeps serving whatever was last published until a separate call to the publish endpoint. A stale promote — one whose fork base is no longer what is published — is rejected with 409 unless `acknowledgeSupersede` is `true`.