Skip to content
reelspanDocs

Integrations

smolagents

Load Reelspan's publishing tools into a Hugging Face smolagents agent with MCPClient and the hosted MCP server, to post and check social media results.

smolagents loads tools from MCP servers with MCPClient, so an agent can use Reelspan's hosted MCP server to publish, schedule and read results. There is no separate Reelspan package to install.

Install

pip install "smolagents[mcp]"

API key

Create a key under Developers → API keys and export it, along with your Hugging Face token for the model. Start with a test key (rs_test_…): every check runs, but nothing is posted.

export REELSPAN_API_KEY=rs_test_...
export HF_TOKEN=hf_...

Example

This agent publishes a text post to the sandbox network, which needs no connected account, and then checks the result.

import os

from smolagents import CodeAgent, InferenceClientModel, MCPClient

# the key goes in the path: /mcp/<key>
reelspan = {"url": f"https://api.reelspan.com/mcp/{os.environ['REELSPAN_API_KEY']}", "transport": "streamable-http"}

with MCPClient(reelspan, structured_output=False) as tools:
    agent = CodeAgent(tools=tools, model=InferenceClientModel())
    agent.run(
        "Publish 'Hello from my smolagents agent' as a text post to the sandbox network for the profile my-brand, "
        "then check its status and tell me the result."
    )

Replace my-brand with one of your profiles (the agent can find them with list_profiles).

Notes

  • Why the key is in the URL: MCPClient takes a plain dict of connection settings, and Reelspan accepts the key in the path (/mcp/<key>) for clients like this. Treat that URL like the key itself, and keep it out of logs and shared code.
  • structured_output is set explicitly because smolagents warns when it is left out; Reelspan's tools return JSON as text either way.
  • Posting runs in the background. The publish tools return a request_id; the agent calls upload_status to read each network's result.
  • Media goes in as URLs. upload_video and upload_photos take public https URLs, not local files.
  • Going live: swap the test key for a live one (rs_live_…) and use real networks instead of sandbox.

The full tool list is on the MCP server page. smolagents' own guide: huggingface.co/docs/smolagents/tutorials/tools.

Something unclear or missing? Write to [email protected] and we’ll fix the page.