Prerequisites
You will need the following before starting:
- PodClaw API key — free at podclaw.io/signup
- Python 3.9+
- pyautogen and requests packages installed
pip install pyautogen requests
Quick Start
The pattern for AutoGen is to define plain Python functions for each PodClaw operation, then declare them in the llm_config functions list so the AssistantAgent knows they exist. The UserProxyAgent's function_map routes calls to the actual implementations.
python — autogen_podclaw.py
import requests
import autogen
PODCLAW_API_KEY = "pc_your_api_key_here"
# Define PodClaw tool functions
def create_show(title: str, description: str, category: str = "Technology") -> dict:
"""Create a new podcast show on PodClaw."""
response = requests.post(
"https://podclaw.io/api/shows",
headers={"Authorization": f"Bearer {PODCLAW_API_KEY}"},
json={"title": title, "description": description, "category": category}
)
return response.json()
def publish_episode(show_id: str, title: str, audio_url: str, description: str = "") -> dict:
"""Publish an episode to Apple Podcasts, Spotify, and 20+ platforms."""
response = requests.post(
f"https://podclaw.io/api/shows/{show_id}/episodes",
headers={"Authorization": f"Bearer {PODCLAW_API_KEY}"},
json={
"title": title,
"description": description,
"audio_url": audio_url,
"status": "published"
}
)
return response.json()
def get_show_analytics(show_id: str) -> dict:
"""Get download analytics for a podcast show."""
response = requests.get(
f"https://podclaw.io/api/shows/{show_id}/analytics",
headers={"Authorization": f"Bearer {PODCLAW_API_KEY}"}
)
return response.json()
# AutoGen config
config_list = [{"model": "gpt-4o", "api_key": "your-openai-key"}]
llm_config = {
"config_list": config_list,
"functions": [
{
"name": "create_show",
"description": "Create a new podcast show on PodClaw",
"parameters": {
"type": "object",
"properties": {
"title": {"type": "string"},
"description": {"type": "string"},
"category": {"type": "string", "default": "Technology"}
},
"required": ["title", "description"]
}
},
{
"name": "publish_episode",
"description": "Publish a podcast episode to Apple Podcasts, Spotify, and 20+ platforms",
"parameters": {
"type": "object",
"properties": {
"show_id": {"type": "string"},
"title": {"type": "string"},
"audio_url": {"type": "string"},
"description": {"type": "string"}
},
"required": ["show_id", "title", "audio_url"]
}
}
]
}
# Create agents
assistant = autogen.AssistantAgent(
name="PodcastAssistant",
llm_config=llm_config,
system_message="You are a podcast production assistant. Use the PodClaw API tools to create shows and publish episodes."
)
user_proxy = autogen.UserProxyAgent(
name="UserProxy",
human_input_mode="NEVER",
max_consecutive_auto_reply=10,
function_map={
"create_show": create_show,
"publish_episode": publish_episode,
"get_show_analytics": get_show_analytics
}
)
# Start the conversation
user_proxy.initiate_chat(
assistant,
message="Create a podcast show called 'Startup Stories' about founder interviews. Then publish the first episode titled 'Building in Public' using audio from https://example.com/ep1.mp3"
)
Closing the analytics loop
One of the most powerful patterns with AutoGen and PodClaw is using the analytics endpoint to give your agents feedback on what content resonates with listeners. After publishing, the AssistantAgent can be prompted to check download stats and use that data to inform future episode topics.
- After publishing, call
get_show_analytics(show_id) to retrieve per-episode download counts
- Pass the analytics summary back to the AssistantAgent in the next turn
- The agent can then recommend whether to double down on a topic or pivot to something new
- Schedule a recurring AutoGen conversation daily or weekly to run the full research-publish-analyze cycle autonomously
AutoGen 0.4 note: The example above uses the AutoGen 0.2 API (pyautogen). If you are using the new AutoGen 0.4 AgentChat API, register your PodClaw functions using the FunctionTool class and pass them to the agent's tools list. The PodClaw API calls remain identical.