OpenPhn docs

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 openphn tool. Call +14155551234 and confirm that order #A-14421 is going to ship today. Return JSON with this shape: { will_ship_today: boolean, tracking?: string, eta?: datetime }. Consent type is existing_business_relationship.

What the agent does:

  1. Calls make_call with your to, objective, and outcome_schema.
  2. Polls get_call(call_id) until status == "completed".
  3. Returns outcome verbatim.

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 openphn to list calls with status completed from the last 24h. For any call whose outcome has callback_requested: true, create a new call with objective "Return Sarah's callback re: order #{order_id}" and the same outcome_schema as the original.

What the agent does:

  1. list_calls({ status: "completed", limit: 100 }).
  2. For each item, fetches the outcome via get_call.
  3. Fires make_call for each matching row — use consent_type: "existing_business_relationship" since the customer was the original initiator.
  4. Attaches an Idempotency-Key derived 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:

  1. Human asks agent to plan a batch (e.g. 50 calls for a shipping delay).
  2. Agent drafts the objective, outcome_schema, and consent_type; previews one sample message.
  3. Human approves or edits.
  4. Agent invokes make_call in a loop (batch size respecting your rate limit) with Idempotency-Key = "batch_${date}_${customer_id}".
  5. Agent reports back with the list of call_ids and a dashboard link.

Do / don't

  • Do include a clean outcome_schema in every make_call. Tight schemas = tight outcomes.
  • Do attach Idempotency-Key for any loop the agent runs, so an interrupted run can be restarted safely.
  • Don't put PII into the objective that 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.

On this page