Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/vrashmanyu605-eng/Agentic_Sales-Markerting/llms.txt

Use this file to discover all available pages before exploring further.

The CRM update agent closes the loop between a sales conversation and your CRM record. After a meeting with a prospect, you supply the transcript and the client’s name. The agent searches the web for recent news about the client, asks the LLM to extract structured CRM-ready data from the transcript, and writes a row to your Google Sheet. It captures everything a sales manager needs to track an opportunity: what was discussed, what the client needs, objections raised, budget signals, urgency, next steps, and estimated deal value.

State inputs

meeting_transcript
string
required
The full text of the meeting transcript. The LLM analyzes this to extract all CRM fields.
client_name
string
required
The name of the client company. Used to search for recent news and written to the Google Sheet as the row identifier.
spreadsheet_id
string
The Google Sheets spreadsheet ID. If not provided, the agent skips the sheet write and logs a warning. The spreadsheet ID is the long alphanumeric string in the sheet’s URL.
spreadsheet_range
string
The cell range to write to. Defaults to "Sheet1!A1" if not provided. Use standard A1 notation (e.g., "CRM!A2") to target a specific sheet and starting cell.

State outputs

crm_update
string
required
A JSON string containing the full extracted CRM data. See output schema for all fields. This is stored in state regardless of whether the Google Sheet write succeeds.

What it does

1

Search for recent client news

The agent constructs the query "recent news {client_name} company" and calls web_search. Fresh news about funding rounds, leadership changes, acquisitions, or product launches can reveal new buying signals or objections not mentioned in the transcript.
2

Extract CRM data with the LLM

The agent sends client_name, meeting_transcript, and client_news to the LLM. The LLM extracts seven structured fields: meeting summary, client requirements, objections, budget signals, urgency level, next steps, and estimated opportunity value.
3

Write to Google Sheets

The agent parses the LLM’s JSON response and builds a single-row array with five columns: client_name, meeting_summary, client_requirements, opportunity_value, and next_steps. If spreadsheet_id is present in state, the agent calls update_google_sheet to append the row. If the ID is missing, the agent logs a warning and skips the write.
4

Store the result in state

The raw LLM response string is stored as crm_update regardless of whether the sheet write succeeded. This lets you inspect or reprocess the extracted data without re-running the LLM.

Tools used

web_search

Fetches recent news about the client company to supplement transcript analysis with current context.

google_sheets

Writes the extracted CRM row to the specified Google Sheet using the Sheets API.

Google Sheet columns

The agent writes exactly one row per invocation. The columns written are, in order:
ColumnSource fieldDescription
Aclient_nameThe client company name from state
Bmeeting_summaryLLM-generated summary of the meeting
Cclient_requirementsRequirements extracted from the transcript
Dopportunity_valueEstimated deal value or revenue opportunity
Enext_stepsAgreed follow-up actions from the meeting
The agent requires a credentials.json file in the project root to authenticate with the Google Sheets API. Without it, update_google_sheet returns an error string immediately and the sheet write is skipped — no exception is raised. See the Google Sheets setup guide for instructions on generating and placing this file.

Output schema

The LLM is prompted to return structured JSON only. The expected structure is:
{
  "meeting_summary": "Discussed Acme Corp's current ERP pain points and explored a phased migration approach. Client expressed strong interest in the cloud-native option.",
  "client_requirements": "Cloud ERP with real-time inventory tracking, integration with existing MES, and a 6-month implementation timeline.",
  "objections": [
    "Concerned about data migration risks",
    "Board approval required for contracts over $100K"
  ],
  "budget_signals": "Finance director mentioned a $150K budget approved for Q3. Looking to start before fiscal year end.",
  "urgency_level": "High — contract renewal with current vendor expires in 4 months.",
  "next_steps": "Send detailed proposal by Friday. Schedule technical deep-dive with CTO for next week.",
  "opportunity_value": "$137,000 first year, $24,000 annual support thereafter"
}
objections and budget_signals are not written to Google Sheets by default, but they are available in the crm_update state field for use in follow-up outreach or internal review.

Source code

import json
from llm import llm
from tools.google_sheets_tool import update_google_sheet
from tools.search_tool import web_search

def crm_update_agent(state):
    meeting_transcript = state["meeting_transcript"]
    client_name = state["client_name"]
    spreadsheet_id = state.get("spreadsheet_id")
    spreadsheet_range = state.get("spreadsheet_range", "Sheet1!A1")

    # Search for any recent news about the client company
    search_query = f"recent news {client_name} company"
    client_news = web_search(search_query)

    response = llm.invoke(
        f"""
        You are a CRM Update Agent.

        Analyze the meeting transcript and fresh client news to generate CRM-ready updates.

        Client Name:
        {client_name}

        Meeting Transcript:
        {meeting_transcript}

        Fresh Client News:
        {json.dumps(client_news, indent=2)}

        Extract:
        - meeting_summary
        - client_requirements
        - objections
        - budget_signals
        - urgency_level
        - next_steps
        - opportunity_value

        Return structured JSON only.
        """
    )

    try:
        crm_data = json.loads(response.content)
        # Prepare values for Google Sheet: [Name, Summary, Requirements, Value, Next Steps]
        sheet_values = [[
            client_name,
            crm_data.get("meeting_summary", ""),
            crm_data.get("client_requirements", ""),
            crm_data.get("opportunity_value", ""),
            crm_data.get("next_steps", "")
        ]]
        
        if spreadsheet_id:
            sheet_status = update_google_sheet(spreadsheet_id, spreadsheet_range, sheet_values)
            print(f"[CRM AGENT] Google Sheet Status: {sheet_status}")
        else:
            print("[CRM AGENT] Spreadsheet ID missing, skipping Google Sheet update.")
            
    except Exception as e:
        print(f"[CRM AGENT] Error parsing CRM data or updating sheet: {e}")

    return {
        "crm_update": response.content
    }

Build docs developers (and LLMs) love