A phone call tool for the OpenAI Agents SDK

An agent can read a supplier's website, but it cannot ring the front desk and ask. Give it a HumanCalls tool and it can ask a real person to phone a US or Canadian business, then read back typed answers, a summary, the recording and a transcript.

Two ways to add a phone call tool

Agent frameworks usually let you attach tools in two ways: connect an MCP server, or register your own functions. HumanCalls works with both. Pick the one that fits how you already build.

  • MCP: point the framework's MCP support at https://humancalls.ai/mcp and send your API key as a Bearer token. The agent gets the tools request_call, get_call, list_calls, cancel_call, answer_question, add_details and get_account.
  • Function tool: write a small function that calls POST /v1/calls on the REST API, plus one that reads GET /v1/calls/:id. You control the inputs and the description the model sees.

The examples below are generic. Class and helper names differ between SDK versions, so check your framework's own docs for the exact way to register an MCP server or a function tool.

Get an API key first

  1. Send POST /v1/signup with an owner_email and an agent_name. Save the returned api_key securely. It is shown once.
  2. The key stays pending until the owner clicks the link in the email. Ask your human to verify. Do not try to work around this step.
  3. Call GET /v1/account with the key as a Bearer token. A verified workspace has 10 free minutes. Read status, available_minutes and next_step before creating work.

If you would rather sign in through a chat app, the Connect page covers OAuth setup. Existing hc_live_ keys also work as Bearer tokens on the MCP server.

Option 1: connect the HumanCalls MCP server

The server speaks Streamable HTTP. In whatever form your SDK accepts an MCP server, give it the address and an Authorization header. A config in outline:

Generic MCP settings
mcp server
  transport: streamable http
  url:       https://humancalls.ai/mcp
  headers:
    Authorization: Bearer hc_live_xxxxxxxx   # example key, keep yours in an env var

The agent can then call request_call with the business, number and goal, and use get_call later to read the result. Nothing is pushed to the agent, so tell it in its instructions to check back with get_call. More detail is on Add a phone call tool to any MCP client.

Option 2: wrap POST /v1/calls as a function tool

If you prefer plain functions, two are enough. This Python sketch uses example data and passes delivery as polling, which new keys must do unless they have a verified webhook connection.

Example function tools (Python)
import os, requests

API = 'https://humancalls.ai/v1'
HEADERS = {'Authorization': 'Bearer ' + os.environ['HUMANCALLS_API_KEY']}

def request_call(job_id: str, to: str, business: str, goal: str, max_minutes: int = 10) -> dict:
    '''Ask a real person to phone a US or Canadian business. Information only: no buying or booking.'''
    body = {
        'to': to,                      # e.g. '+15125550142' (example)
        'business': business,          # e.g. 'Harbor Supply Co.' (example)
        'on_behalf_of': 'Acme Robotics',
        'goal': goal,
        'max_minutes': max_minutes,
        'collect': {'in_stock': {'type': 'boolean', 'required': True}},
        'metadata': {'agent_job_id': job_id},
        'delivery': {'mode': 'polling'},
    }
    r = requests.post(API + '/calls', json=body,
                      headers={**HEADERS, 'Idempotency-Key': 'job-' + job_id})
    return r.json()

def get_call(call_id: str) -> dict:
    '''Read the status and results of a call.'''
    return requests.get(API + '/calls/' + call_id, headers=HEADERS).json()

Register both with your framework's function tool helper. Base the Idempotency-Key on the job, not a fresh random value, so a retried tool call returns the same task with a 200 instead of creating a second one. Reusing a key with a different body returns 409.

Handle the errors the model may see. 402 insufficient_credits means no task was queued: lower max_minutes or ask the owner to top up. 403 account_not_verified means the owner still needs to verify. The API docs list every input and response.

Reading the result

A task moves from queued to assigned, dialing and in progress, then ends as completed, failed, no_answer, declined or canceled. Calls are placed between 8am and 9pm in the business's own time zone, so a result can take minutes or come back the next business morning.

A finished call includes outcome with your typed fields (null when an optional answer was unavailable), outcome_notes, summary, billed_minutes, cost_usd, and links to the recording and transcript. Media can arrive a little after completion, so poll until the URLs are present. See typed answers from phone calls for how to design collect fields.

Cost and limits

$1 per connected minute, rounded up. Calls nobody answers, declined requests and canceled calls cost $0, and reserved credit is released. A new workspace gets 10 free minutes. Your agent can read its balance but cannot buy credit; the owner adds it through the top_up_url. Details are on the pricing page.

Callers stay inside your instructions and never buy, book or agree to anything you did not authorize. Sales, debt collection, political calls, cold calls to consumers and sensitive healthcare workflows are declined. Read how our callers work.

Questions

Can an agent built with the OpenAI Agents SDK make phone calls?
Not to an ordinary business line on its own. With HumanCalls connected over MCP or as a function tool, it can ask a real person to make the call and then read the result.
Should I use MCP or a function tool?
Use MCP if your framework supports it and you want the full set of tools with no extra code. Use a function tool if you want to fix the inputs, such as which fields to collect, in your own code.
Is the caller an AI voice?
No. A trained person makes every call, says who they are calling for, and tells the business the call is recorded.
Do I need a webhook?
No. Pass delivery mode polling and read the task with get_call or GET /v1/calls/:id. Webhooks are available once you verify a connection.

Related

  • Add a phone call tool to any MCP clientConnect any MCP client to HumanCalls over Streamable HTTP with OAuth 2.1 or an API key. Seven tools let a real person call a business and return the answers.
  • A phone call API with a human callerCreate phone calls by REST: POST /v1/calls with typed collect fields, and a real person calls the US or Canadian business. Poll or use a signed webhook.
  • How to make an AI agent call a businessThree ways to make an AI agent phone a business: build a voice agent, hand the call to a person over an API, or do it yourself. Includes a worked example.

Try it with 10 free minutes

$1 per connected minute after that, and nothing when nobody picks up.

Request a callConnect a chat app