How to Build a Social Media Monitoring Agent with ocrskill-without LangChain
Social media is overwhelmingly visual. Carousels, reels, stories, and infographics carry the most valuable signals - but they’re locked inside pixels. Traditional text-based monitoring tools miss all of it.
In this tutorial, we’ll build an autonomous agent that watches social media feeds and extracts text and structured data from every visual asset using ocrskill. The entire pipeline is just a clean function and a loop - no abstractions, no bloat, completely without LangChain.
Prerequisites
- Python 3.10+
- An ocrskill API key (get one free)
- The OpenAI SDK (
pip install openai) - LangChain does not need to be installed, at all, really!
That’s it. No agent frameworks required.
Step 1: Set Up the ocrskill Client
Since ocrskill uses the OpenAI REST API format, setup is trivial:
from openai import OpenAI
client = OpenAI(
base_url="https://api.ocrskill.com/v1",
api_key="sk-your-ocrskill-key"
)
Step 2: Create the Vision Function
We define a simple function that accepts an image URL and returns extracted text. No decorators, no framework boilerplate:
def extract_text_from_image(image_url: str) -> str:
"""Extract all text and structured data from a social media image."""
response = client.chat.completions.create(
model="ocrskill-v1",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "Extract all text, hashtags, mentions, and key visual elements."},
{"type": "image_url", "image_url": {"url": image_url}}
]
}]
)
return response.choices[0].message.content
Clean, readable, and works without LangChain.
Step 3: Build the Analysis Layer
For the LLM analysis, we use the OpenAI SDK directly. No need to wrap it in an “agent” abstraction:
from openai import OpenAI
openai_client = OpenAI(api_key="sk-your-openai-key")
def analyze_content(extracted_text: str, image_url: str) -> str:
"""Analyze extracted content and summarize key messages."""
response = openai_client.chat.completions.create(
model="gpt-5-mini",
temperature=0,
messages=[{
"role": "user",
"content": f"""Analyze this social media content and summarize the key message:
Image URL: {image_url}
Extracted content: {extracted_text}
Provide a concise summary of the main message, tone, and any calls to action."""
}]
)
return response.choices[0].message.content
Direct API calls. Fully transparent. No hidden prompt templates, no mystery “agent” logic - just your code, working without LangChain.
Step 4: Process a Feed
Here’s where the magic happens. Notice what we’re doing: iterating over images and calling functions. That’s it. No framework required:
feed_images = [
"https://example.com/carousel-slide-1.jpg",
"https://example.com/story-screenshot.png",
"https://example.com/infographic.jpg",
]
for img in feed_images:
# Extract text using ocrskill
extracted = extract_text_from_image(img)
# Analyze with gpt-5-mini
analysis = analyze_content(extracted, img)
print(f"\n=== {img} ===")
print(analysis)
A straightforward for loop. No initialize_agent, no AgentType.OPENAI_FUNCTIONS, no verbose logging noise. Just Python, doing what Python does best - without LangChain.
What About “Agents”?
If you need multi-step reasoning, you can add it explicitly:
def monitor_feed(images: list[str]) -> list[dict]:
"""Monitor a feed and return structured analysis."""
results = []
for img in images:
extracted = extract_text_from_image(img)
analysis = analyze_content(extracted, img)
# Add conditional logic - your logic, visible and explicit
if "competitor" in analysis.lower():
send_alert(f"Competitor mention detected: {img}")
results.append({
"image": img,
"extracted": extracted,
"analysis": analysis
})
return results
Your control flow is right there in the code. No black-box “agent” deciding when to call what tool. You see exactly what happens, when it happens - without LangChain.
Performance Notes
With ocrskill’s Nvidia GPU-backed inference, each image processes in under 500ms. For a monitoring agent scanning hundreds of posts per minute, this latency is the difference between real-time intelligence and stale data.
The leaner your code, the faster it runs. Removing framework overhead means fewer imports, less memory, and clearer stack traces when you need to debug.
What’s Next
- Add sentiment analysis on extracted text (just another function call)
- Store results in a vector database for RAG (plain HTTP requests)
- Set up alerts for competitor mentions or trending topics (your own if-statements)
The combination of ocrskill’s speed and clean, direct code makes this stack ideal for production-grade social media intelligence. Sometimes the best framework is no framework - without LangChain, the solution is lighter, faster, and easier to maintain.
