Build a Custom AI Support Agent for Salesforce (Without Agentforce)
I built a custom AI agent that acts as an absolute expert on your specific Salesforce org. It reads your metadata, generates support tickets, and costs a fraction of Agentforce.

I've built a ton of AI agents, but combining them directly with Salesforce is where the real magic happens. I recently put together a custom AI support agent that lives inside Salesforce and acts as a legitimate expert on your specific org. It knows your validation rules, understands your custom errors, and knows exactly what to do when an opportunity won't move to the next stage.
Best of all? It doesn't use Agentforce. We're using direct Gemini API calls, which makes it drastically cheaper while still delivering incredible results. With a little fine-tuning, this agent can easily cut your support tickets in half.
Auto-Documenting Your Salesforce Org
To make the agent an expert, it needs to understand how your org is wired. I started by pulling down the metadata for standard Salesforce development items—Apex, validation rules, Lightning Web Components (LWCs), and flows.
Instead of writing documentation manually, I used Claude Code to iterate through every file in the metadata folder and generate detailed documentation. I asked the AI: What does this do? What criteria cause it to fire? What fields does it write to?
This is a fantastic use case for AI. It churns through a sizable amount of work and creates surprisingly accurate, comprehensive documentation for the entire org.
Chunking and Vectorizing with Pinecone
Once the documentation was generated, the next step was making it searchable. I wrote a script to chunk the markdown files using a straightforward strategy: 1,000 characters per chunk with a 200-character overlap to maintain context.
These chunks are then sent to Google's Gemini embedding model (text-embedding-001) to be vectorized and stored in a Pinecone database. (Pro tip: I initially tried using text-embedding-004, but it was recently discontinued, which caused some API failures. Switching to 001 via Google AI Studio fixed it instantly.)
By embedding this data, the agent can perform highly efficient semantic searches. If a user asks about a user interface issue, the agent will pull up the relevant LWC or Aura component documentation because they share a close semantic meaning.
Wiring Up the Agent in Flowise
For the agent orchestration, I used Flowise. While I love LangGraph for its deterministic flow control, Flowise is incredibly fast to set up and immediately gives you a publicly available endpoint without needing complex tunneling like Ngrok.
In Flowise, I dropped in an agent node, connected the Pinecone vector store, and plugged in my Google Gemini credentials. I used the gemini-1.5-flash model (or flash-lite) to keep things fast and cost-effective. Within minutes, I had a working endpoint that could query my org's vectorized documentation.
Integrating into Salesforce
Back in Salesforce, I used AI to quickly spin up a Lightning Web Component (LWC) for the chat interface and an Apex controller to handle the API requests.
Context is everything for an AI agent. I designed the LWC to send the entire chat history and the user's current page URL with every single request. If a user is stuck on a specific Opportunity, the agent knows exactly where they are and can search the vector database accordingly. I also built it so that simply refreshing the screen clears the history and resets the agent's memory.
Agentic Tools and Structured Output
To make the agent truly autonomous, it needs to take action. I gave it two specific tools:
- Create a Support Ticket: A standard Case record if the user is completely stuck.
- Create a Suggestion: A custom object that allows users (and the agent) to log ideas for improving the Salesforce org.
I enforce this behavior by prompting the agent to reply in a strict JSON structure. I mapped out the exact JSON schema in Flowise so the agent reliably outputs a message string and a tool_call enum (create_support_ticket, create_suggestion, or prefill).
If the agent realizes it can't solve the problem, it outputs JSON to prefill a support ticket form right in the chat window. Even better, because the agent watches users get snagged on the same processes, it will occasionally autonomously suggest brilliant UI or process improvements based on where users are struggling.
Watch the video
We built a fully functional, context-aware, org-expert AI from scratch in under two hours. I'm sharing this because I want to build a community of developers pushing the boundaries of what's possible with AI and Salesforce. Let's sharpen our skills together.