Connect OpenAI Agents SDK to Skysay
Give an OpenAI SDK agent scoped access to Skysay MCP, verify a real read, and prepare phone-number onboarding.
Use OpenAI Agents SDK with hosted Skysay MCP to inspect a workspace and, when separately configured and approved, operate calls and SMS. The example verifies workspace access or checks number types and calling and SMS support for one country. Each mode calls a single read tool; no private repository or phone-carrier account is needed.
Prerequisites
- Python 3.13 and uv; a Skysay workspace.
- A workspace key with
account:readfor the default check, orcoverage:readfor the country lookup. Put the key inSKYSAY_API_KEYthrough your local environment or secret manager. Never commit it or paste it into chat. - No OpenAI key is needed for the default transport probe. The optional
model-mediated mode needs your own securely configured
OPENAI_API_KEY.
Create a scoped credential. Get the public sample.
Install the pinned example
In the public sample's examples/agent-sdks directory:
uv venv --python 3.13.13
uv pip sync --require-hashes requirements.lock
uv run --no-sync python openai_agent.pyThe sample pins openai-agents==0.23.1 and claude-agent-sdk==0.2.166;
its checked-in hash-locked requirements.lock pins the transitive MCP transport too. If copying only
this OpenAI sample, install openai-agents==0.23.1 in your own Python 3.13
virtual environment. The combined sample installs both SDKs for reproducibility.
Connect and verify a tool result
The sample source
uses the read-only MCP endpoint and calls account_overview directly.
SDK tracing is disabled to keep workspace tool data out of hosted traces.
A successful default run prints:
Connected: account_overview succeeded. No phone action was performed.Check phone-number coverage for a country
Use a key with only coverage:read. Pass the English country name, quoting
names with spaces:
uv run --no-sync python openai_agent.py --country "United Kingdom"This mode uses the standard MCP address, https://api.skysay.ai/mcp, because
the fixed read-only endpoint does not expose get_coverage. The sample calls
only get_coverage with the country you enter. The result lists number types
and reports incoming and outgoing calls and SMS separately. Read the
qualifiers: an available service may require review or an SMS-enabled number.
If the catalogue cannot confirm a number type, the sample says so.
The lookup makes no model request and orders no number. It describes coverage at country level. Check the requirements for the specific number type before relying on it for a particular customer.
Optional: let an agent make the read
Configure your own OpenAI API credential securely, then run:
uv run --no-sync python openai_agent.py --ask-modelThis sends tool output to the model provider and may incur model charges. Review the provider's data policy and use a test workspace. Never run this against customer data merely to check installation.
Before calls or SMS
A successful read is not an active phone number. In the workspace, choose a country and number type, inspect voice/SMS capabilities and prices, and complete any required identity, business and carrier-document review. Skysay handles carrier onboarding; you still provide the required information. Number activation is not instant in every market. See regulated numbers and pricing.
Your SDK agent configures and operates Skysay. It is not automatically the voice model speaking to the person on the phone. Configure the voice agent's published flow before enabling real calls.
A country lookup grants no permission to order a number. Before adding paid actions to your application, use the least scopes for the selected tools, an explicit destination/action/cost confirmation, and a server-side approval flow before number purchases, calls or SMS. An SDK allowlist is not an authorization or spending boundary. Quickstart explains these boundaries; MCP tools gives exact names and arguments. This guide does not dial, text or purchase a number.
Troubleshooting
- 401: confirm the workspace key is active and present in the launching process. Do not print the key while debugging.
- Tool error / missing scope: the workspace check needs
account:read; the country lookup needscoverage:read. Connection success alone does not prove authorization to call the tool. - 405 in your browser: MCP uses POST. Opening the endpoint as a web page is not an initialization or tool-call test.
- Timeout: check outbound HTTPS to
api.skysay.aiand proxy configuration. Do not disable TLS validation. - Unexpected tools: check which mode and endpoint you selected. Use a clean example directory. Do not inherit unrelated MCP, shell or file tools.
What was verified
The pinned OpenAI client verified the default workspace read, United Kingdom and Germany coverage, an unconfirmed country, and refusal with the wrong scope against the real Skysay HTTP handler in an isolated local workspace. The tests used disposable credentials. No production account, customer data, hosted model request, phone call, SMS or number purchase was used. Optional model-mediated runs above remain untested; they incur provider usage. This is transport/configuration acceptance, not a live-carrier or model-quality benchmark.
SDK reference
Configuration checked on 14 October 2026 against the official SDK MCP documentation. Recheck pinned versions before upgrading.