Prompt
How do I troubleshoot an agent that sends bad data to the CRM?
Latest observation
Here’s a practical way to troubleshoot an agent that’s sending bad data to your CRM.
1) Identify the exact bad data
Start by being specific:
- Which CRM field is wrong?
- Is it consistently wrong or only sometimes?
- Is the issue a format problem, missing value, duplicate, or completely incorrect mapping?
- Does it happen for one source, one workflow, or all records?
2) Trace the full data path
Follow the data from source to CRM:
- Source input: user entry, form, call transcript, email, API, etc.
- Agent processing: extraction, classification, enrichment, summarization
- Mapping layer: field-to-field mapping, transformation rules
- CRM write step: API call or integration
- Post-write validation: record created/updated as expected?
Look for the point where the value changes.
3) Check the agent’s prompt or extraction rules
If the agent uses an LLM:
- Review the system prompt and task instructions
- Check whether the schema is clearly defined
- Make sure examples are accurate and unambiguous
- Verify the agent is not “guessing” missing information
- Ensure it’s instructed to return null/empty if uncertain
Common issue: the agent hallucinates a value instead of leaving it blank.
4) Validate field mappings
In many cases, the CRM is fine and the mapping is wrong:
- First name/last name swapped
- Company name mapped to contact name
- Phone number in the wrong country format
- Status/stage values not matching CRM allowed values
- Free-text values being sent where enums are expected
Check:
- Source field name
- Transformation logic
- Destination CRM field
- Required format and allowed values
5) Inspect logs and payloads
Look at the actual request sent to the CRM:
- Raw input to the agent
- Agent output
- Final payload sent to the CRM
- CRM response/error message
Compare expected vs actual.
If possible, log each step with a unique record ID so you can trace one transaction end-to-end.
6) Reproduce with a known test case
Use a simple test record that should produce a predictable result:
- One clean example
- One edge case
- One malformed input
If the agent fails on the test case, you can isolate the problem faster.
7) Check for schema and validation issues
Add validation before writing to CRM:
- Type checks: string vs number vs date
- Required fields present
- Email/phone/date formats
- Allowed enum values
- Length limits
- Duplicate detection
If validation fails, stop the write and send the record to a review queue instead of writing bad data.
8) Review recent changes
Bad data often starts after a change:
- Prompt edits
- New model/version
- CRM field changes
- Integration updates
- New enrichment source
- Updated taxonomy or stage names
Compare current behavior with the last known good version.
9) Add guardrails
To prevent recurrence:
- Use strict output schema
- Require confidence thresholds
- Reject low-confidence extractions
- Normalize formats before CRM write
- Add a human review step for uncertain cases
- Build automated tests for common inputs
10) Monitor and alert
Set up monitoring for:
- Validation failures
- Unusual value patterns
- Spike in nulls or duplicates
- CRM API errors
- Mismatch rates between expected and written data
This helps catch issues early.
Quick checklist
- Reproduce the issue
- Inspect raw input, agent output, and CRM payload
- Verify prompt/instructions
- Verify field mappings
- Check format/type validation
- Review recent changes
- Add logging and guardrails
If you want, I can also give you:
- a step-by-step debugging flowchart, or
- a sample log format for tracing agent-to-CRM issues.