{
  "name": "🤖 Contact Agent",
  "nodes": [
    {
      "parameters": {
        "inputSource": "passthrough"
      },
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        -280,
        -20
      ],
      "id": "463d989c-b683-4f72-9229-21d0aa21224e",
      "name": "When Executed by Another Workflow"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.query }}",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        -60,
        -20
      ],
      "id": "6098ab8e-aee6-4689-9055-a29f0dd85fef",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -280,
        260
      ],
      "id": "73df74f7-78b5-4528-ad8e-2ff002463050",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "nrDrI8MUFREwh9aM",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "operation": "getAll",
        "limit": 5,
        "fields": [
          "*"
        ],
        "useQuery": true,
        "query": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Query', ``, 'string') }}"
      },
      "type": "n8n-nodes-base.googleContactsTool",
      "typeVersion": 1,
      "position": [
        -60,
        260
      ],
      "id": "e9d462ab-f63a-4da9-9241-cec958993b4e",
      "name": "Get Contacts",
      "credentials": {
        "googleContactsOAuth2Api": {
          "id": "jCRXvy8Qi3VzhrVf",
          "name": "Google Contacts account"
        }
      }
    },
    {
      "parameters": {
        "familyName": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Family_Name', ``, 'string') }}",
        "givenName": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Given_Name', ``, 'string') }}",
        "additionalFields": {
          "emailsUi": {
            "emailsValues": [
              {
                "type": "home",
                "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Value', ``, 'string') }}"
              }
            ]
          }
        }
      },
      "type": "n8n-nodes-base.googleContactsTool",
      "typeVersion": 1,
      "position": [
        80,
        260
      ],
      "id": "03c0d94f-8ba0-4140-ac14-befd0ba7809c",
      "name": "Create Contact",
      "credentials": {
        "googleContactsOAuth2Api": {
          "id": "jCRXvy8Qi3VzhrVf",
          "name": "Google Contacts account"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "contactId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Contact_ID', ``, 'string') }}",
        "fields": [
          "names",
          "emailAddresses"
        ],
        "updateFields": {
          "emailsUi": {
            "emailsValues": [
              {
                "type": "home",
                "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Value', ``, 'string') }}"
              }
            ]
          }
        }
      },
      "type": "n8n-nodes-base.googleContactsTool",
      "typeVersion": 1,
      "position": [
        220,
        260
      ],
      "id": "abb50935-0b83-42fe-9674-d1f56ba04f76",
      "name": "Update contacts",
      "credentials": {
        "googleContactsOAuth2Api": {
          "id": "jCRXvy8Qi3VzhrVf",
          "name": "Google Contacts account"
        }
      }
    }
  ],
  "pinData": {
    "When Executed by Another Workflow": [
      {
        "json": {
          "query": "Update Mary's email to mary.test@test.com"
        }
      }
    ]
  },
  "connections": {
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get Contacts": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create Contact": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Update contacts": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9831242a-1633-4151-a2a3-aa6706c174a4",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "cd8f3260f4f840103c2ad768fc0a1d92f91d8588e163407d3747cc2f7c516a5a"
  },
  "id": "bO06EcgZPKxpSx73",
  "tags": []
}