← All tutorialsSales

Cold-outreach SDR

Research a lead, draft a personalized cold email, send it. Cap at $5/day so a runaway loop costs less than coffee.

Cost~$0.02 per lead
Operations
web_search.querytext_generation.generateemail.send

Prerequisites

  • Account at /signup with $5+ balance topped up at /billing
  • Agent created via /agents with monthly cap $25
  • Three services enabled: web_search.query, text_generation.generate, email.send

Walkthrough

1. Research the lead

Use Tavily to find the prospect's company news, role, and recent posts.

bash# Search the web for fresh context on the lead.
curl -X POST https://www.upivia.com/v1/service-requests \
  -H "Authorization: Bearer $AGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "service": "web_search",
    "operation": "query",
    "payload": { "q": "Acme Corp Series B 2026 CTO" }
  }'

2. Draft the email

Pipe the research result into GPT-4o-mini with a tight system prompt. Keep it under 90 words.

bash# Draft a short personalized email using the research blob.
curl -X POST https://www.upivia.com/v1/service-requests \
  -H "Authorization: Bearer $AGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "service": "text_generation",
    "operation": "generate",
    "payload": {
      "model": "openai/gpt-4o-mini",
      "messages": [
        {"role":"system","content":"You write 90-word cold emails. No fluff."},
        {"role":"user","content":"<insert research blob here>"}
      ]
    }
  }'

3. Send it

Hand the draft to email.send. The platform debits one charge per send and writes an AuditLog you can review at /audit-logs.

bash# Send the email. The idempotency_key prevents double-sends on retry.
curl -X POST https://www.upivia.com/v1/service-requests \
  -H "Authorization: Bearer $AGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "service": "email",
    "operation": "send",
    "payload": {
      "to": "cto@acme.com",
      "subject": "Quick idea after your Series B",
      "body": "<the drafted text>"
    },
    "idempotency_key": "lead_acme_cto_2026_05"
  }'

Next steps

Audit every call at /audit-logs, watch spend at /usage, and tune budgets per service on the agent's page.

Create an account →