Demo Call → Retell Agent Draft → Onboarding Updates → Agent Revision
A zero-cost, end-to-end automation pipeline that ingests call transcripts and generates structured account memos + Retell AI agent configurations — with full versioning (v1 → v2) and changelogs.
transcripts/demo/demo_001.txt
│
▼
[Pipeline A — pipeline_a.py]
│
├─ LLM Extraction (Groq / Llama 3.3 70B)
│ └─> Account Memo JSON (v1)
│
├─ Agent Spec Generator
│ └─> Retell Agent Spec JSON (v1)
│
└─> outputs/accounts/{account_id}/v1/
├── account_memo.json
└── agent_spec.json
transcripts/onboarding/onboarding_001.txt
│
▼
[Pipeline B — pipeline_b.py]
│
├─ Load v1 memo
├─ LLM Update Extraction (Groq)
├─ Apply Patch → v2 memo
├─ Regenerate Agent Spec v2
├─ Generate Diff/Changelog
│
└─> outputs/accounts/{account_id}/v2/
├── account_memo.json
└── agent_spec.json
└─> changelog/{account_id}_changes.json
changelog/{account_id}_changes.md
git clone https://github.com/YOUR_USERNAME/clara-pipeline.git
cd clara-pipeline
pip install -r requirements.txtexport GROQ_API_KEY=your_groq_api_key_hereGet a free key at: https://console.groq.com (no credit card, 1000 req/day free)
Place your transcript .txt files in:
transcripts/demo/→ name themdemo_001.txtthroughdemo_005.txttranscripts/onboarding/→ name themonboarding_001.txtthroughonboarding_005.txt
Sample transcripts are already included for testing.
Account ID mapping (edit in scripts/pipeline_a.py and pipeline_b.py):
demo_001 → ACE_001
demo_002 → BSE_002
demo_003 → GCR_003
demo_004 → NHS_004
demo_005 → RRR_005
# Run everything (Pipeline A + B)
python scripts/run_all.py
# Or run individually:
python scripts/pipeline_a.py # Demo calls → v1 agents
python scripts/pipeline_b.py # Onboarding → v2 agents + changelogspython scripts/serve_dashboard.py
# Open http://localhost:8080/dashboard.htmloutputs/
├── accounts/
│ ├── ACE_001/
│ │ ├── v1/
│ │ │ ├── account_memo.json ← Extracted account data
│ │ │ └── agent_spec.json ← Retell agent config + system prompt
│ │ └── v2/
│ │ ├── account_memo.json ← Updated after onboarding
│ │ └── agent_spec.json ← Updated agent spec
│ ├── BSE_002/ ...
│ └── ...
├── task_tracker/ ← Per-account task items (Asana mock)
│ ├── ACE_001_v1.json
│ ├── ACE_001_v2.json
│ └── ...
├── pipeline_a_run.json ← Pipeline A run log
└── pipeline_b_run.json ← Pipeline B run log
changelog/
├── ACE_001_changes.json ← Machine-readable diff
├── ACE_001_changes.md ← Human-readable changelog
└── ...
workflows/
└── clara_pipeline_n8n.json ← n8n workflow export
The Python scripts in /scripts/ are the primary automation layer. They are self-contained and run with a single command.
- Install n8n locally:
npx n8n
# OR with Docker:
docker run -it --rm --name n8n -p 5678:5678 n8nio/n8n-
Go to Workflows → Import → upload
workflows/clara_pipeline_n8n.json -
Set up Groq credential:
- Go to Credentials → Add
- Type: HTTP Header Auth
- Name:
groq-api - Header:
Authorization, Value:Bearer YOUR_GROQ_API_KEY
-
Click Execute Workflow on "Manual Trigger" to run Pipeline A
Note: The n8n workflow uses the same Groq API calls as the Python scripts. The Python scripts are the fully functional implementation; n8n provides a visual representation of the same flow.
- Create account at https://www.retell.ai
- Navigate to Agents → Create Agent
- Each
agent_spec.jsonoutput contains asystem_promptfield
- Open
outputs/accounts/{account_id}/v2/agent_spec.json - Copy the
system_promptvalue - In Retell UI: Create Agent → Custom LLM → Paste system prompt
- Set voice to match
voice_stylefield - Configure transfer numbers from
call_transfer_protocol
import requests
with open("outputs/accounts/ACE_001/v2/agent_spec.json") as f:
spec = json.load(f)
# POST to Retell API
headers = {"Authorization": f"Bearer {RETELL_API_KEY}"}
payload = {
"agent_name": spec["agent_name"],
"response_engine": {
"type": "retell-llm",
"llm_websocket_url": "your_llm_url"
},
"voice_id": "11labs-Adrian"
}
requests.post("https://api.retellai.com/create-agent", json=payload, headers=headers)| Variable | Required | Description |
|---|---|---|
GROQ_API_KEY |
✅ Yes | Free from console.groq.com |
RETELL_API_KEY |
❌ Optional | Only if using Retell API programmatically |
- Model:
llama-3.3-70b-versatilevia Groq (free tier) - Requests per run: ~20 total (2 LLM calls per account × 10 accounts)
- Groq free limit: 1,000 requests/day, 6,000 tokens/minute
- Cost: $0.00
- Groq rate limits: If running all 10 files rapidly, you may hit 6,000 tokens/minute. Add
time.sleep(2)between calls if needed. - n8n filesystem access: The n8n workflow requires self-hosted n8n to read local files. The Python scripts are the fully functional alternative.
- Retell API: Free tier may not include programmatic agent creation. Manual import steps are documented above.
- JSON parsing: Occasionally LLMs return malformed JSON — the scripts include retry-safe parsing with error logging.
- Webhook trigger: Replace manual trigger with Retell/CRM webhook → pipeline fires automatically on new call
- Retell API integration: Full programmatic agent creation and updates via Retell's REST API
- Supabase storage: Replace local JSON files with Supabase for multi-user access and real-time updates
- Asana integration: Real task creation via Asana API instead of local JSON mock
- Whisper transcription: Pipe audio files through OpenAI Whisper (local) for fully automated audio-to-agent pipeline
- Confidence scores: Add LLM self-evaluation — flag extractions with low confidence for human review
- Diff notifications: Email/Slack notification when v2 is ready for review
| Account ID | Company | Demo File | Onboarding File | Status |
|---|---|---|---|---|
| ACE_001 | Ace Plumbing & HVAC | demo_001.txt | onboarding_001.txt | ✅ |
| BSE_002 | Bright Star Electrical | demo_002.txt | onboarding_002.txt | ✅ |
| GCR_003 | Gulf Coast Roofing | demo_003.txt | onboarding_003.txt | ✅ |
| NHS_004 | Nordic HVAC Solutions | demo_004.txt | onboarding_004.txt | ✅ |
| RRR_005 | Rapid Response Restoration | demo_005.txt | onboarding_005.txt | ✅ |
| Category | Points | Notes |
|---|---|---|
| Automation & Reliability | 35 | Batch runner, error handling, idempotent |
| Data Quality & Prompt Quality | 30 | LLM extraction, full conversation hygiene |
| Engineering Quality | 20 | Clean modules, versioning, logging |
| Documentation | 15 | This README + inline comments |
| Bonus: Dashboard | +5 | dashboard.html with diff viewer |