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:
MCPClienttakes 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_outputis 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 callsupload_statusto read each network's result. - Media goes in as URLs.
upload_videoandupload_photostake publichttpsURLs, not local files. - Going live: swap the test key for a live one (
rs_live_…) and use real networks instead ofsandbox.
The full tool list is on the MCP server page. smolagents' own guide: huggingface.co/docs/smolagents/tutorials/tools.