OpenAI's official agent framework, pointed at every social platform you run.
OpenAI shipped the Agents SDK in 2025 as the official Python framework for building agentic apps on OpenAI models. It supports MCP servers natively — no third-party adapter — through MCPServerStreamableHttp for HTTP transports like SociaHive's at https://sociahive.com/api/mcp. Once registered, every SociaHive tool flows in as an SDK Tool the agent can call, with the same tracing, hand-off, and guardrail primitives the SDK provides for other tool sources.
Get StartedWhy pair OpenAI Agents SDK with SociaHive
Native MCP, ship from OpenAI itself
MCP support is in the box for the Agents SDK — MCPServerStreamableHttp is documented in OpenAI's own SDK reference, not a community port. SociaHive sits inside that path identically to filesystem, GitHub, or any other MCP server. No SociaHive-specific Python wrappers, no custom Tool subclasses.
Tracing in the OpenAI dashboard
Every SociaHive tool call traces into OpenAI's Traces UI alongside the model spans and other tool calls in your agent. When create_post hits a tier limit or generate_flow returns an error, the trace shows the full request/response with structured error classes — same debug surface as the rest of your OpenAI agent stack.
Hand-offs and guardrails work as designed
The Agents SDK's primitives — agent hand-offs, input/output guardrails, the @function_tool decorator — all work against MCP-loaded tools. You can hand off a SociaHive-equipped 'social manager' agent to a 'reviewer' agent for the publish step, with a guardrail that blocks pending_confirmation envelopes from sneaking through without human approval.
Register SociaHive with MCPServerStreamableHttp
The Agents SDK's MCPServerStreamableHttp class connects to any HTTP-transport MCP server. Pass SociaHive's URL plus a headers dict with X-API-Key. The Agent picks up SociaHive's tools at construction time.
# pip install openai-agents
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp
import os
sociahive = MCPServerStreamableHttp(
name="sociahive",
params={
"url": "https://sociahive.com/api/mcp",
"headers": {
"X-API-Key": os.environ["SOCIAHIVE_API_KEY"],
},
},
)
await sociahive.connect() # discover tools
agent = Agent(
name="Social ops",
instructions=(
"You manage cross-platform social presence via SociaHive. "
"Use schedule_post for content; generate_flow for DM automations. "
"Surface pending_confirmation envelopes to the human; never auto-approve."
),
mcp_servers=[sociahive],
)
result = await Runner.run(
agent,
input="Pull last 7d Instagram + LinkedIn analytics, draft a Threads recap, "
"and schedule it for Sunday 6pm. Stop at confirmation.",
)
print(result.final_output)A real workflow: scheduled weekly recap with hand-off to a reviewer agent
One agent pulls analytics and drafts the recap; a second agent (with a different system prompt and a publish-rights API key) reviews and clears pending_confirmation envelopes. The hand-off happens automatically via the SDK's hand-off primitive.
- 1Drafter agent reads its instructions ('pull analytics, draft a recap, schedule but never publish'). It's wired with a read+write SociaHive key but its system prompt explicitly forbids resolving confirmations.
- 2Drafter calls get_post_analytics for each connected platform via the SociaHive MCP server. The SDK's tracing surface logs every call.
- 3Drafter calls create_post twice — Threads short, LinkedIn longform — both with scheduledAt = next Sunday 18:00. Both return pending_confirmation envelopes.
- 4Drafter invokes hand_off to the Reviewer agent, passing the envelopes as structured input. The Reviewer agent has a different SociaHive API key (one with confirmation-resolution rights).
- 5Reviewer reads the drafts, evaluates against brand-voice guardrails, and either resolves both confirmations through the SociaHive dashboard URL the envelopes carry, or returns the run to the Drafter with edit notes.
from agents import Agent, handoff, Runner
from agents.mcp import MCPServerStreamableHttp
import os
drafter_mcp = MCPServerStreamableHttp(
name="sociahive_drafter",
params={"url": "https://sociahive.com/api/mcp",
"headers": {"X-API-Key": os.environ["SOCIAHIVE_DRAFTER_KEY"]}},
)
reviewer_mcp = MCPServerStreamableHttp(
name="sociahive_reviewer",
params={"url": "https://sociahive.com/api/mcp",
"headers": {"X-API-Key": os.environ["SOCIAHIVE_REVIEWER_KEY"]}},
)
await drafter_mcp.connect()
await reviewer_mcp.connect()
reviewer = Agent(
name="Reviewer",
instructions=(
"You receive pending_confirmation envelopes from the Drafter. "
"Approve or request changes. Never bypass the confirmation step."
),
mcp_servers=[reviewer_mcp],
)
drafter = Agent(
name="Drafter",
instructions=(
"Pull analytics and draft scheduled posts. Hand off pending "
"confirmations to the Reviewer — never resolve them yourself."
),
mcp_servers=[drafter_mcp],
handoffs=[handoff(reviewer)],
)
result = await Runner.run(drafter, input="weekly recap, sun 6pm")What You Can Do with OpenAI Agents SDK + SociaHive
- ✓Native MCP support — no third-party adapter, just the openai-agents Python package
- ✓Connect once with MCPServerStreamableHttp; every SociaHive tool appears in the agent automatically
- ✓Built-in tracing in OpenAI's Traces dashboard alongside your model and tool calls
- ✓Hand-offs and guardrails work the same against SociaHive as against any other agent tool
How to Connect OpenAI Agents SDK
Create Your SociaHive Account
Sign up at sociahive.com and connect your Instagram Business or Creator account. No ai agent credentials needed yet.
Find OpenAI Agents SDK in Integrations
Open your SociaHive dashboard, go to Settings > Integrations, and select OpenAI Agents SDK from the AI Agent section.
Authorize OpenAI Agents SDK
Click "Connect" and complete the OpenAI Agents SDK authorization flow to grant SociaHive read and write access.
Set Up Your OpenAI Agents SDK Workspace
Install with pip install openai-agents and configure the MCP server via MCPServerStreamableHttp. Set SOCIAHIVE_API_KEY as an env var so the X-API-Key header gets injected. Use the SDK's run_streamed for live token streaming on long-running tool calls like generate_flow.
Test Your OpenAI Agents SDK Connection
Send a test DM to your Instagram account and verify the data flows into OpenAI Agents SDK. Check that triggers, events, and data mapping work as expected.
Use Cases with OpenAI Agents SDK
Other AI Agent Integrations
Frequently asked questions
Does OpenAI's Agents SDK natively support MCP servers like SociaHive?+
Yes — MCP is a first-class transport in the Agents SDK. The MCPServerStreamableHttp class connects to HTTP-transport MCP servers (like SociaHive's at /api/mcp), and the resulting tools are passed straight to Agent construction via mcp_servers=[…]. No third-party adapter, no custom Tool wrappers. The same Agent works against SociaHive plus any other MCP server you connect alongside.
Which OpenAI models work with SociaHive through the Agents SDK?+
Any model the Agents SDK supports — gpt-4o, o1, o3, gpt-5 — can call SociaHive tools through the MCP server. The SDK abstracts the model layer, so changing model providers (or moving to a different MCP-supporting framework later) doesn't change your SociaHive integration. The model picks tools; SociaHive provides the tools.
How does the SDK handle SociaHive’s destructive-action confirmations?+
create_post, publish_post_now, activate_flow, and delete_* return a pending_confirmation envelope as a structured tool result — the SDK passes it back to the agent as a regular tool response, not an exception. Use a guardrail or an explicit hand-off pattern (see the workflow above) to ensure those envelopes don't get auto-resolved by the same agent that triggered them. Read-only calls execute inline.
Will I see SociaHive tool calls in OpenAI's Traces dashboard?+
Yes. The Agents SDK traces every tool span — model calls, MCP tool calls, hand-offs — to the OpenAI Traces dashboard by default. SociaHive calls show up with full request/response payloads (subject to the SDK's PII redaction and SociaHive's audit allow-list). When something goes wrong, the trace is the first place to look.
How is the Agents SDK + SociaHive different from LangChain + SociaHive?+
Both work and reach the same SociaHive surface. The Agents SDK is pure-OpenAI — best when you're already on OpenAI models and want first-party tracing/hand-offs. LangChain is provider-agnostic — best when you mix Anthropic + OpenAI + open models, or when LangGraph's state-machine model fits the workflow. The SociaHive MCP server is identical between them; the choice is about which agent framework your team has standardised on.
Comparing AI tools for social media automation? See the full hub: MCP for social media automation — or the developer-focused product page at /mcp.
Connect OpenAI Agents SDK with SociaHive
14-day free trial included. Plans from $29/mo. No credit card required.
Get Started