Agents · RAG · Tool calling · Backend
A sales agent with retrieval
Building an AI sales assistant that can retrieve product information, calculate financing options, and keep context throughout customer conversations.
- Year
- 2026
- Role
- AI Data Engineer
- Context
- Professional work in financial services
- Stack
- TypeScript, Bun, PostgreSQL, Redis, OpenRouter, Groq, hybrid RAG
- Length
- 2 min read
Problem
A sales assistant needs to understand more than the customer’s latest message.
It needs product information, pricing, financing calculations, and previous conversations. Some of its actions also have consequences for the business, particularly when customer information or applications are involved.
The challenge was working out which decisions the model should make and which ones needed explicit application logic.
Constraints
Product information could change over time. Financial calculations had to be consistent, and customer context had to survive across conversations.
Certain actions needed human review. Model providers could also go down or hit rate limits.
Architecture
The system combines an LLM-based agent with retrieval, specialised tools, persistent customer memory, and backend workflows.
Product knowledge comes from hybrid retrieval. The agent calls tools when it needs information or a calculation.
Lead scoring and some workflow transitions are explicit application rules. Follow-up jobs run separately from the conversational agent.
knowledge retrieval
│
specialised tools ── agent ── customer memory
│
business rules · human review · background jobsMy part
I worked on the agent’s tools, retrieval, customer memory, lead scoring, automated follow-ups, fallback between model providers, and backend integration.
I also wrote evaluation cases to see how the agent behaved in different conversation scenarios.
Trade-offs
Giving an agent more tools increases what it can do, but it also gives it more chances to pick the wrong tool or do something unexpected.
Retrieval quality depends on how the source information is represented. Adding more documents can make the relevant one harder to find.
For financial calculations and workflow decisions, explicit application logic made the behaviour easier to reason about.
Results
What got built: five specialised agent tools, four deterministic lead-scoring signals, persistent customer memory, automated follow-up workflows, human review for selected customer application actions, and fallback handling between model providers.
Those are capabilities, not outcomes. I don’t have conversion or revenue figures to share.
Lessons
This project made me more interested in the boundary between probabilistic model behaviour and deterministic software.
I spent quite a lot of time on ordinary engineering problems: data consistency, retries, permissions, and what happens when an external service fails halfway through an operation.