We are building a content creation agent that turns a one-line topic brief into a blog post, a social thread, and a newsletter draft. If you are a technical writer or content marketer, this removes the blank-page problem and gives you a structured first draft in seconds.
What you'll need
- Python 3.10 or newer
- The OpenAI SDK:
pip install openai - An Oxlo.ai API key from https://portal.oxlo.ai
Step 1: Connect to Oxlo.ai
First we instantiate the client. Oxlo.ai is fully OpenAI SDK compatible, so we only need to swap the base URL and plug in our key. We will use Llama 3.3 70B for general-purpose writing, but the same code works for any model on the platform.
from openai import OpenAI
client = OpenAI(base_url="https://api.oxlo.ai/v1", api_key="YOUR_OXLO_API_KEY")
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[{"role": "user", "content": "Say hello"}],
)
print(response.choices[0].message.content)
Step 2: Build the blog generator
The blog generator takes a topic and returns a Markdown article with a title, summary, and three body sections. We keep the system prompt separate so it is easy to tweak tone and length without touching business logic.
BLOG_SYSTEM_PROMPT = """You are a senior technical writer.
Given a topic brief, write a short blog post in Markdown.
Use this structure:
- H1 title
- One-paragraph summary
- Three H2 sections with concrete examples
- A short conclusion
Tone is clear, practical, and free of hype."""
def generate_blog(topic: str) -> str:
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[
{"role": "system", "content": BLOG_SYSTEM_PROMPT},
{"role": "user", "content": f"Topic: {topic}"},
],
temperature=0.7,
max_tokens=1500,
)
return response.choices[0].message.content
Step 3: Add a social thread writer
Social posts need a different voice. We switch to a concise system prompt and cap the output length so the model focuses on punchy takeaways rather than long explanations.
THREAD_SYSTEM_PROMPT = """You are a technical content strategist.
Turn the supplied topic into a Twitter / X thread of exactly five posts.
Each post must be under 280 characters.
Start with a strong hook, then four supporting insights.
Do not use hashtags."""
def generate_thread(topic: str) -> str:
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[
{"role": "system", "content": THREAD_SYSTEM_PROMPT},
{"role": "user", "content": f"Topic: {topic}"},
],
temperature=0.8,
max_tokens=800,
)
return response.choices[0].message.content
Step 4: Add a newsletter draft
Newsletters need a personal voice and a clear call to action. We will use Qwen 3 32B here to demonstrate that swapping models on Oxlo.ai is a one-line change, which is useful if you are writing for a multilingual audience.
NEWSLETTER_SYSTEM_PROMPT = """You are a developer advocate writing a weekly newsletter.
Given a topic, produce a newsletter section with:
- A friendly opening sentence
- A 2-paragraph explanation of why the topic matters this week
- One concrete tip the reader can try today
- A closing question to drive replies
Write in first person."""
def generate_newsletter(topic: str) -> str:
response = client.chat.completions.create(
model="qwen-3-32b",
messages=[
{"role": "system", "content": NEWSLETTER_SYSTEM_PROMPT},
{"role": "user", "content": f"Topic: {topic}"},
],
temperature=0.7,
max_tokens=1200,
)
return response.choices[0].message.content
Step 5: Wrap it in a CLI
We combine the three generators into a single script that accepts a topic argument and writes the outputs to files. Because Oxlo.ai uses flat per-request pricing, running three separate calls for one content package is predictable even when the system prompts are long. See https://oxlo.ai/pricing for current rates.
import argparse
def main():
parser = argparse.ArgumentParser(description="Generate content with Oxlo.ai")
parser.add_argument("topic", help="Topic brief, e.g. 'observability in Kubernetes'")
args = parser.parse_args()
print("Writing blog...")
blog = generate_blog(args.topic)
with open("blog.md", "w") as f:
f.write(blog)
print("Writing thread...")
thread = generate_thread(args.topic)
with open("thread.txt", "w") as f:
f.write(thread)
print("Writing newsletter...")
newsletter = generate_newsletter(args.topic)
with open("newsletter.md", "w") as f:
f.write(newsletter)
print("Done. Files written to ./blog.md, ./thread.txt, ./newsletter.md")
if __name__ == "__main__":
main()
Run it
Save the full script as content_agent.py and run it:
export OXLO_API_KEY="sk-oxlo.ai-..."
python content_agent.py "agentic AI workflows"
Example output you can expect:
Writing blog...
Writing thread...
Writing newsletter...
Done. Files written to ./blog.md, ./thread.txt, ./newsletter.md
Inside blog.md:
# Building Reliable Agentic AI Workflows
Summary: Agentic systems promise autonomous task execution, but reliability remains the biggest blocker for production teams.
## Start with a Deterministic Core
Before adding LLM autonomy, lock down the state machine. Every transition should have a validation gate.
## Observability Is Not Optional
If you cannot trace the agent's reasoning, you cannot debug it. Structured logging at each step is the minimum bar.
## Human-in-the-Loop as a Feature, Not a Bug
Design checkpoints where a human reviews high-stakes decisions. This reduces error rates without killing throughput.
## Conclusion
Agentic workflows are ready for production when you treat the LLM as a smart router, not an autonomous operator.
Inside thread.txt:
1/ Agentic AI is the hottest topic in LLM infrastructure right now. Most teams are building it wrong.
2/ The first mistake: giving the agent too much freedom. Start with strict state machines and add autonomy later.
3/ Second mistake: skipping observability. If you cannot trace a decision, you cannot fix a bug.
4/ Third mistake: removing humans entirely. High-stakes decisions still need a review gate.
5/ Build your agent like a smart router, not a black box. Your future self will thank you.
Inside newsletter.md:
Hey everyone,
This week I have been thinking about agentic AI workflows. Every demo looks magical, but production is a different story. The teams I talk to that ship successfully all share one trait: they treat the agent as a stateful service, not a chatbot.
Try this today: add a structured JSON log line after every LLM call in your agent. You will spot failure modes within hours instead of weeks.
What is the hardest part of agent reliability for your team? Hit reply and let me know.
Next steps
Two concrete ways to extend this.
First, add a style consistency layer. Store your best-performing posts in a vector database using Oxlo.ai's embeddings endpoint, then retrieve the top match and inject it into the system prompt as a writing sample. This keeps output on brand without fine-tuning.
Second, wire the agent into a CMS webhook. When the script runs, push the generated Markdown directly to your publishing queue and trigger a human review step. Because Oxlo.ai has no cold starts on popular models, the whole pipeline completes in seconds even at 9 AM on a Monday.
Top comments (0)