Agent examples
Prompts and patterns that make OpenPhn's MCP tools useful.
Pattern 1 — confirm-and-return
A synchronous one-shot where the agent dials, waits for the outcome, and returns structured JSON to the caller.
Prompt:
You have the
openphntool. Call+14155551234and confirm that order#A-14421is going to ship today. Return JSON with this shape:{ will_ship_today: boolean, tracking?: string, eta?: datetime }. Consent type isexisting_business_relationship.
What the agent does:
- Calls
make_callwith yourto,objective, andoutcome_schema. - Polls
get_call(call_id)untilstatus == "completed". - Returns
outcomeverbatim.
MCP agents can't receive webhooks, so polling is the pattern. A dial-and-return call is usually 30–90 seconds end-to-end.
Pattern 2 — follow-up on pending
A batch agent that scans recent outcomes and kicks off follow-up calls for unresolved ones.
Prompt:
Use
openphnto list calls with statuscompletedfrom the last 24h. For any call whose outcome hascallback_requested: true, create a new call with objective"Return Sarah's callback re: order #{order_id}"and the sameoutcome_schemaas the original.
What the agent does:
list_calls({ status: "completed", limit: 100 }).- For each item, fetches the outcome via
get_call. - Fires
make_callfor each matching row — useconsent_type: "existing_business_relationship"since the customer was the original initiator. - Attaches an
Idempotency-Keyderived from the source call's id so re-running the agent doesn't duplicate calls.
Pattern 3 — human-in-the-loop batch
Agent drafts, human approves, agent dials.
Flow:
- Human asks agent to plan a batch (e.g. 50 calls for a shipping delay).
- Agent drafts the objective, outcome_schema, and consent_type; previews one sample message.
- Human approves or edits.
- Agent invokes
make_callin a loop (batch size respecting your rate limit) withIdempotency-Key = "batch_${date}_${customer_id}". - Agent reports back with the list of
call_ids and a dashboard link.
Do / don't
- ✅ Do include a clean
outcome_schemain everymake_call. Tight schemas = tight outcomes. - ✅ Do attach
Idempotency-Keyfor any loop the agent runs, so an interrupted run can be restarted safely. - ❌ Don't put PII into the
objectivethat isn't needed for the conversation. It's logged, auditable, and surfaced in transcripts. - ❌ Don't ask the agent to infer
consent_type. It should be passed in by whoever is orchestrating the call — TCPA compliance is on the caller, not the model.