How to define data in class method

TypeError: ScriptGenerator.init() takes 1 positional argument but 2 were given.

result: Iterator[RunResponse] = pd_generator.run(topic = topic)

Hey @Monkey.D.Luffy
Thanks for reaching out and for using Agno! I’ve looped in the right engineers to help with your question. We usually respond within 24 hours, but if this is urgent, just let us know, and we’ll do our best to prioritize it.
Appreciate your patience—we’ll get back to you soon!

Hi @Monkey.D.Luffy can you explain a bit more or give some code snippets?
What’s your Agent config.

Hey kaustubh, sure here’s the code.
CODE:
from typing import List, Iterator

from textwrap import dedent
from dotenv import load_dotenv
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.googlesearch import GoogleSearchTools
from agno.workflow import Workflow, RunEvent, RunResponse
from agno.utils.log import logger
from agno.utils.pprint import pprint_run_response
from pydantic import BaseModel, Field
from rich.prompt import Prompt
import random

load_dotenv()

class PodcastInput(BaseModel):
topic: str

class SearchResults(BaseModel):
urls: List[str]
snippets: List[str]
titles: List[str]

topics = [“Indian Independence Movement”]

class ScriptGenerator(Workflow):
description: str = dedent(“”"
An intelligent podcast script generator that creates engaging, well-researched audio content.
This workflow orchestrates multiple AI agents to research, analyze, and craft
compelling podcast scripts that combine journalistic rigor with captivating storytelling.
“”")

def init(self):
self.searcher = Agent(
model=OpenAIChat(id=“gpt-4o-mini”),
tools=[GoogleSearchTools()],
description=dedent(“”"
You are PodcastResearch-X, an elite research assistant specializing in discovering high-quality sources for engaging podcast content. Your expertise includes:

  • Finding authoritative and trending sources
  • Evaluating content credibility and relevance
  • Identifying diverse perspectives and expert opinions
  • Discovering unique angles and compelling narratives
  • Ensuring comprehensive topic coverage for captivating episodes
    “”“),
    instructions=dedent(”“”
  1. Search Strategy
  • Find 10-15 relevant sources and select the 5-7 best ones
  • Prioritize recent, authoritative content suitable for audio storytelling
  • Look for unique angles, expert insights, and narrative-driven content
  1. Source Evaluation
  • Verify source credibility and expertise
  • Check publication dates for timeliness
  • Assess content depth, uniqueness, and suitability for podcast discussions
  1. Diversity of Perspectives
  • Include different viewpoints to enrich episode discussions
  • Gather both mainstream and expert opinions for balanced narratives
  • Find supporting data, statistics, or anecdotes to enhance storytelling
    “”"),
    response_model=SearchResults
    )

self.writer = Agent(
model=OpenAIChat(id=“gpt-4o-mini”),
description=dedent(“”"
You are PodcastScript-X, an elite scriptwriting assistant specializing in crafting engaging and dynamic podcast scripts based on research provided by PodcastResearch-X. Your expertise includes:

  • Creating compelling, conversational narratives for audio formats
  • Structuring scripts with clear introductions, segments, and conclusions
  • Incorporating diverse perspectives and expert insights
  • Weaving unique angles and storytelling elements to captivate listeners
  • Ensuring scripts are concise, engaging, and suitable for podcast audiences
    “”“),
    instructions=dedent(”“”
  1. Script Development
  • Use the 5-7 sources provided by PodcastResearch-X to craft a podcast script
  • Develop a narrative arc with an engaging introduction, main discussion segments, and a strong conclusion
  • Incorporate unique angles, anecdotes, and insights to make the script compelling
  1. Content Integration
  • Seamlessly weave in authoritative data, statistics, and expert opinions
  • Ensure all referenced content is credited appropriately within the script
  • Maintain conversational tone suitable for podcast delivery
  1. Audience Engagement
  • Include diverse perspectives to appeal to a broad audience
  • Use storytelling techniques to maintain listener interest
  • Keep the script concise, aiming for clarity and impact within a typical podcast episode length
    “”"),
    markdown=True
    )

def run(self, topic: str) → Iterator[RunResponse]:
search_results = self.searcher.run(topic, stream=True)

if not isinstance(search_results, Iterator):
search_results = iter([search_results])

search_results_text = “”
for resp in search_results:
if hasattr(resp, “output”) and resp.output:
logger.info(f"Searcher output chunk: {resp.output}")
search_results_text += resp.output

script_text = “”
for resp in self.writer.run(search_results_text, stream=True):
if hasattr(resp, “output”) and resp.output:
logger.info(f"Writer output chunk: {resp.output}")
script_text += resp.output
if not script_text:
script_text = “No script generated.”
yield RunResponse(content=script_text)

if name == “main”:
topic = Prompt.ask(“Enter a topic for the podcast”)

logger.info(f"Generating podcast script for topic: {topic}")

pd_generator = ScriptGenerator()

result = pd_generator.run(topic)

pprint_run_response(result)

Error is the same, mentioned in the message.

The last output i got was this,
INFO Generating podcast script for topic: Indian Independence Movement

│ No script generated. │