Skip to main content
POST
/
agent
/
{agent_id}
/
update
Update Agent
curl --request POST \
  --url https://api.example.com/agent/{agent_id}/update
Updates an existing agent. graph updates are full replacements:
  • Nodes not included are removed.
  • Connections not included are removed.
  • New nodes can use temporary IDs in the payload; backend normalizes them.

Request

curl -X POST "https://api.mosaic.so/agent/123e4567-e89b-12d3-a456-789012345678/update" \
  -H "Authorization: Bearer mk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "UGC Variants v2",
    "graph": {
      "nodes": [
        {
          "id": "bf750792-a2e9-48c2-9d39-24f892772f6a",
          "node_id": "9451e6ff-ac7f-4317-9055-a2f35f641b29",
          "position_x": 150,
          "position_y": 220,
          "params_used": {}
        },
        {
          "id": "music_node",
          "node_id": "3b281fb9-9eb2-40f6-b05b-4b6f909a3da9",
          "position_x": 620,
          "position_y": 220,
          "params_used": {
            "use_intelligent_analysis": true,
            "genre": "Cinematic"
          }
        }
      ],
      "connections": [
        {
          "source_agent_node_id": "bf750792-a2e9-48c2-9d39-24f892772f6a",
          "target_agent_node_id": "music_node"
        }
      ]
    }
  }'
You can also call the same operation with PATCH /agent/{agent_id}/update.

Body Parameters

FieldTypeRequiredDescription
namestringNoAgent name (1-120 chars).
descriptionstringNoAgent description (<=5000 chars).
visibilitystringNopublic or private.
graph.nodes[]arrayNoFull replacement list of nodes.
graph.connections[]arrayNoFull replacement list of connections.
At least one of name, description, visibility, or graph is required.

Response

{
  "success": true,
  "agent_id": "123e4567-e89b-12d3-a456-789012345678",
  "name": "UGC Variants v2",
  "description": "",
  "visibility": "private",
  "workspace_id": "31d7da52-e2ea-4d7d-9066-aa34df5890d0",
  "created_at": "2026-03-01T12:00:00.000Z",
  "updated_at": "2026-03-11T17:31:10.124Z",
  "graph_updated": true,
  "nodes_created": 1,
  "nodes_updated": 1,
  "nodes_deleted": 1,
  "connections_created": 1,
  "warnings": []
}