This depends on how you are creating the partners and how you are triggering the automated action.
If the automated action is set to run on the creation of a partner, it will call the nominated server action on the newly created records, therefore the records variable in the server action will be populated, so records.ids will get you the ids of the newly created records (It should only be 1 created at a time, so it should be safe to use record and record.id).
If you are creating the partner record inside an automated action, the create method returns the recordset, so you should be assigning a variable to the result of the create method, ie. partner = env['res.partner'].create({}) then use partner.id.