Skip to main content

Configuration Versioning

Every change to agent configurations is automatically tracked. The versioning system provides complete audit history, field-level diffs, and rollback capabilities — with zero impact on agent runtime performance.

Architecture

Two levels of versioning work together:

LevelTableTriggerPurpose
Per-resourceconfig_historyAutomatic (PostgreSQL)Track every INSERT/UPDATE/DELETE on agents, schemas, triggers, MCP servers
Agent snapshotbuilder_versionsOn publishCapture complete agent state for full rollback
┌─────────────────────────────────────────────────────────────────┐
│ Agent Lifecycle │
│ │
│ edit schema ──► config_history v2 (auto) │
│ edit trigger ──► config_history v3 (auto) │
│ publish ────────► builder_versions snapshot #1 (auto) │
│ edit persona ──► config_history v4 (auto) │
│ publish ────────► builder_versions snapshot #2 (auto) │
│ │
│ rollback to snapshot #1 ──► restores agent + schemas + │
│ triggers + MCP servers │
└─────────────────────────────────────────────────────────────────┘

Per-Resource History

What Is Tracked

ResourceTableTracked Fields
Agentsbuilder_agentsname, bio, commercial_name, llm_config, tags, type, visibility, metadata, status
Schemasbuilder_agent_schemasschema_data, schema_type, is_active, metadata, validation_rules
Triggersbuilder_agent_triggersname, trigger_type, trigger_config, enabled, description
MCP Serversbuilder_mcp_serversname, endpoint, transport, auth_method, config, status

What Is NOT Tracked

Statistical/runtime fields are excluded to avoid noisy version history:

updated_at, trigger_count, last_triggered_at, total_interactions, success_rate, avg_response_time, last_interaction, last_connected_at, last_error, tools_count

Version Record Structure

Each version record contains:

FieldTypeDescription
idUUIDRecord ID
resource_typestringagent | schema | trigger | mcp_server
resource_idUUIDID of the changed resource
agent_idUUIDParent agent (for aggregation)
tenant_idUUIDTenant isolation
versionintegerSequential per resource (1, 2, 3...)
operationstringINSERT | UPDATE | DELETE
data_beforeJSONState before change (null on INSERT)
data_afterJSONState after change (null on DELETE)
changed_fieldsstring[]Fields that changed (UPDATE only)
changed_byUUIDUser who made the change (when available)
changelogstringOptional note (auto-filled on rollback)
created_attimestampWhen the change occurred

Agent Snapshots

When an agent is published, a snapshot captures the complete state:

ComponentContent
agent_snapshotFull agent record (name, bio, llm_config, tags, metadata...)
schemas_snapshotAll active schemas at publish time
triggers_snapshotAll triggers linked to the agent
mcp_servers_snapshotAll MCP servers linked to the agent

Snapshots are sequential per agent (version_number: 1, 2, 3...).

Snapshot Rollback

Rolling back a snapshot restores the entire agent to the published state:

  1. Agent fields are restored (bio, llm_config, tags, etc.)
  2. Current schemas are deactivated; snapshot schemas are reactivated
  3. Triggers are updated/recreated from snapshot data
  4. MCP servers are updated/recreated from snapshot data

Each individual restoration triggers automatic per-resource versioning — providing full traceability even during rollback.

warning

Snapshot rollback is a destructive operation that overwrites current agent configuration. It does not affect active sessions or conversation history.


REST API Endpoints

Per-Resource History

MethodEndpointAuthDescription
GET/api/agents/:agentId/versions/:resourceType/:resourceIdJWT / API KeyList versions of a resource
GET/api/agents/:agentId/versions/:resourceType/:resourceId/:versionJWT / API KeyGet specific version details
GET/api/agents/:agentId/versions/:resourceType/:resourceId/compare?from=X&to=YJWT / API KeyField-by-field diff
POST/api/agents/:agentId/versions/:resourceType/:resourceId/rollbackJWT onlyRollback resource to a version
GET/api/agents/:agentId/historyJWT / API KeyAgent change timeline

Snapshots

MethodEndpointAuthDescription
GET/api/agents/:agentId/snapshotsJWT / API KeyList publish snapshots
GET/api/agents/:agentId/snapshots/:snapshotIdJWT / API KeyGet snapshot details
POST/api/agents/:agentId/snapshots/:snapshotId/rollbackJWT onlyRestore agent to snapshot

Query parameters (list endpoints): limit (default 20/50), offset (default 0), resource_type (history only).

Rollback body: { "target_version": 1 } (per-resource only).


MCP Builder Tools

The versioning system is accessible via 8 MCP tools in the Versioning domain:

Per-Resource History

ToolDescription
list_versionsList all versions of a resource with pagination
get_versionGet details of a specific version (before/after data)
compare_versionsField-by-field diff between two versions
rollback_versionRestore a single resource to a previous version
list_agent_historyCombined timeline of all changes for an agent

Snapshots

ToolDescription
list_snapshotsList all published snapshots of an agent
get_snapshotFull snapshot details (all 4 components)
rollback_snapshotRestore entire agent to a published state

Example: Compare Two Versions

Using compare_versions to see what changed between version 1 and 3 of an agent:

{
"resource_type": "agent",
"resource_id": "2378a810-...",
"from_version": 1,
"to_version": 3
}

Response:

{
"success": true,
"comparison": {
"from_version": 1,
"to_version": 3,
"diff": {
"bio": {
"from": "Original bio text",
"to": "Updated bio text"
}
},
"changed_field_count": 1
}
}

Example: Rollback Agent to Previous Version

Using rollback_version to restore an agent's bio to version 1:

{
"resource_type": "agent",
"resource_id": "2378a810-...",
"target_version": 1
}

Response:

{
"success": true,
"message": "Resource restored to version 1",
"restored": { "id": "2378a810-...", "bio": "Original bio text" },
"restored_to_version": 1,
"new_version": 4
}

The rollback creates a new version (4) with the restored data — the original version history is preserved.


Tenant Isolation

All versioning operations enforce multi-tenant isolation:

  • config_history records include tenant_id for filtering
  • All queries validate resource ownership before returning data
  • Cross-tenant access returns "Resource not found" (no information leakage)
  • Trigger records validate tenant_id directly; others validate via agent_id → tenant_agents

Zero Runtime Impact

The versioning system has no impact on agent execution performance:

  • The PostgreSQL trigger fires AFTER the operation (non-blocking)
  • The trigger includes an exception handler (never fails the parent operation)
  • The agent loop reads only is_active=true schemas — no queries touch config_history or builder_versions
  • Snapshots on publish are fire-and-forget (never block the publish operation)