Skip to content
reaatech

Files · Anthropic Knowledge Agent for Pipedrive Small Business Sales Insights

73 (1 binary, 660.7 kB total)attempt 1

README.md·3353 B·markdown
markdown
# Anthropic Knowledge Agent for Pipedrive Small Business Sales Insights
 
Chat with your Pipedrive pipeline using natural language to get deal summaries, follow-up reminders, and win probability.
 
## Problem
 
Sales reps and managers waste hours clicking through Pipedrive to find deal statuses and next steps. This conversational assistant speeds up daily stand-ups and pipeline reviews.
 
## Architecture
 
1. **Sync** — Pipedrive API fetches deals, persons, and activities
2. **Chunk & Embed** — Voyage AI (`voyage-3`) embeds each entity via `@reaatech/agent-memory-embedding`
3. **Store** — Embeddings are upserted into Qdrant via `@reaatech/agent-memory-retrieval`
4. **Chat** — User messages retrieve relevant context, enriched with session history, and sent to Anthropic Claude
5. **Cache**`@reaatech/llm-cache` caches frequent queries (exact + semantic match)
6. **Eval**`@reaatech/rag-eval-core` + Langfuse track answer quality
 
## Quick Start
 
```bash
cp .env.example .env
# Fill in your API keys
pnpm install
pnpm dev
```
 
## API Reference
 
### POST /api/chat
Send a message to the assistant.
```json
{ "message": "Show me all open deals", "sessionId": "optional-existing-session" }
```
Returns SSE stream of response tokens.
 
### POST /api/sync
Trigger a Pipedrive data sync.
```json
{ "fullResync": false }
```
Returns sync result with counts.
 
## Environment Variables
 
| Variable | Required | Description |
|----------|----------|-------------|
| `ANTHROPIC_API_KEY` | Yes | Anthropic Claude API key |
| `PIPEDRIVE_API_TOKEN` | Yes | Pipedrive API token (from Pipedrive settings) |
| `VOYAGE_API_KEY` | Yes | Voyage AI API key for embeddings |
| `QDRANT_URL` | Yes | Qdrant vector database URL |
| `LANGFUSE_PUBLIC_KEY` | No | Langfuse public key (for tracing, skip if empty) |
| `LANGFUSE_SECRET_KEY` | No | Langfuse secret key |
| `LANGFUSE_HOST` | No | Langfuse host URL (default: https://cloud.langfuse.com) |
| `SYNC_INTERVAL_MS` | No | Pipedrive sync interval in ms (default: 300000) |
 
## Testing
 
```bash
pnpm test
```
 
## Packages Used
 
### REAA Packages
- **@reaatech/agent-memory-core** — Foundation types, enums, and utilities for the agent-memory ecosystem (Memory, MemoryType, withRetry)
- **@reaatech/agent-memory-embedding** — Embedding provider abstraction with CachedEmbeddingProvider and InMemoryEmbeddingCache
- **@reaatech/agent-memory-retrieval** — Semantic memory retriever with MemoryRetriever, ContextInjector, and pluggable ranking strategies
- **@reaatech/session-continuity** — Multi-turn session lifecycle manager with SessionManager, token budget enforcement, and context compression
- **@reaatech/llm-cache** — LLM response cache with exact-match (SHA-256) and semantic (cosine similarity) lookups
- **@reaatech/rag-eval-core** — RAG evaluation types and Zod schemas for answer quality monitoring
 
### Third-Party Packages
- **pipedrive** — Official Pipedrive REST API v2 client for deals, persons, and activities
- **@anthropic-ai/sdk** — Anthropic Claude API client for streaming chat completions
- **@qdrant/js-client-rest** — Qdrant vector search REST client
- **voyageai** — Voyage AI embeddings API client
- **langfuse** — LLM observability and tracing platform
- **zod** — TypeScript-first schema validation for request and eval data boundaries
 
## License
 
MIT