Skip to content

commit_files

Use commit_files for atomic multi-file changes, especially model plus run.py edits. Confirm expected SHAs when available, then run tests or the model after commit.

NameTypeRequiredDefaultDescription
model_nameAnnotated[str, Field(description='Name of the Bridge Town model.')]Yes
filesAnnotated[list[dict[str, Any]], Field(description="List of file operations to commit atomically. Each item must have: path (str, model-relative), content (str), encoding ('text' or 'base64'), and operation ('create', 'update', or 'delete'). For delete operations, content may be omitted. create/update entries may optionally include assert_blob_sha1 (40-hex git blob SHA-1), assert_sha256 (64-hex digest), and/or assert_size_bytes — the exact-bytes-written postcondition described on create_file. delete entries must not set these. A single-entry list is the normal way to update or delete one file.")]Yes
commit_messageAnnotated[str, Field(description='Git commit message. If omitted, the server generates a default message.')]Yes
branch`Annotated[strNone, Field(description=“Branch to operate on. Defaults to the model’s default branch when omitted or null.”)]`NoNone
workspace_id`Annotated[strNone, Field(description=WORKSPACE_ID_FIELD_DESCRIPTION)]`NoNone

Returns a structured object. Top-level fields:

  • model (string)
  • branch (string)
  • commit_sha (string)
  • files_changed (integer)
  • files (array<object>)
  • deleted_paths (array)

See the response example below for the full payload shape.

{
"name": "commit_files",
"arguments": {
"model_name": "forecasts",
"branch": "scenario/actuals-rebase",
"commit_message": "feat: update FP&A variance model and run contract",
"files": [
{
"action": "update",
"path": "model/revenue.py",
"content": "inputs = ['actuals', 'plan']\noutputs = ['variance_summary']\ndependencies = []\n\nresult = {'variance_summary': [{'month': '2026-03', 'actual': 128000, 'plan': 120000, 'variance': 8000}]}\n",
"encoding": "text",
"expected_sha": "0123456789abcdef0123456789abcdef01234567"
},
{
"action": "update",
"path": "run.py",
"content": "PIPELINE = ['revenue']\n",
"encoding": "text",
"expected_sha": "fedcba9876543210fedcba9876543210fedcba98"
},
{
"action": "create",
"path": "README.md",
"content": "# Revenue variance workflow\n\nRuns forecast versus actuals.\n",
"encoding": "text",
"assert_blob_sha1": "f1e2d3c4b5a697887766554433221100ffeedcca"
}
]
}
}
{
"model": "forecasts",
"branch": "scenario/actuals-rebase",
"commit_sha": "abc1234def5678901234567890abcdef12345678",
"files_changed": 3,
"files": [
{
"path": "model/revenue.py",
"blob_sha1": "abc1234def5678901234567890abcdef12345678",
"size_bytes": 210
},
{
"path": "run.py",
"blob_sha1": "0123456789abcdef0123456789abcdef01234567",
"size_bytes": 24
},
{
"path": "README.md",
"blob_sha1": "f1e2d3c4b5a697887766554433221100ffeedcca",
"size_bytes": 63
}
],
"deleted_paths": []
}
  • Module: Files
  • Requires authentication via API token or Auth0 JWT.