Video summary

🧠 ساخت AI Agent در پایتون! 🚀 جستجو، خلاصه‌سازی و ترجمه خودکار!

Main summary

Key takeaways

Technology

Overview

This video is a Python tutorial for building a simple AI-agent “framework” from scratch (without LangChain/CrewAI/AutoGPT-style agent frameworks). The key idea is to implement multiple specialized components (“agents”) that run sequentially and pass outputs to each other:

search → summarize → translate → save to file


What the tutorial builds (4-agent project structure)

  1. Search Agent

    • Inputs: a topic and max_results (default 3).
    • Uses DoctaGo Search to retrieve web results.
    • Builds a single combined string containing, for each result:
      • title
      • url
      • snippet/text content
    • Returns the combined search results as a string.
  2. Summarizer Agent

    • Input: the search-result text.
    • Uses an LM (cloud models via API) through an OpenAI/compatible client-style call.
    • Includes:
      • a system prompt (e.g., “you are a useful summarizer”)
      • a user prompt requesting summarization of the provided search results
    • Returns a summary string.
  3. Translator Agent

    • Input: the summary text.
    • Prompts the LM to translate into natural/clear Persian.
    • Returns a translated string.
  4. Writer / File-Saving Agent

    • Inputs:
      • the translated text
      • an output filename
    • Writes content using UTF-8 encoding (important for Persian/Unicode).
    • Confirms success with print statements.

Orchestrator / workflow coordination

A main function runs the agents in order:

  1. Get topic from user input
  2. search_agent(topic)
  3. summarizer_agent(search_result)
  4. translator_agent(summary)
  5. writer_agent(translated_text, "result.txt")

The tutorial frames this as agents acting like an orchestra/manager, where each component performs a role and passes data forward.


Environment setup and model configuration

  • Uses a virtual environment.
  • Installs dependencies from a requirements.txt.
  • Mentions libraries/packages such as:
    • Ulama (LM/Ollama-style integration; script also mentions cloud models)
    • DoctaGo search engine
    • a python-dotenv-style package for environment variables
  • Uses environment variables for:
    • API key
    • model name (example mentioned: “GPT-… 20B cloud parameters”)
  • Mentions alternative model providers:
    • OpenRouter
  • Emphasizes choosing between Ollama vs cloud models.

Model flexibility / evaluation idea

The tutorial suggests using different models for different roles (e.g., one model for summarization and another like DeepSeek/Dipsic for translation) to compare accuracy.


Output example / expected behavior

It demonstrates the full pipeline with the topic “Tesla”:

  • search results are combined
  • summarized
  • translated to Persian
  • written into a text file (e.g., result.txt)

Future extensions suggested

  • Add memory to agents.
  • Build a coordinator that dynamically selects which agents to run based on the user’s request (more advanced orchestration).
  • Create more complex multi-agent workflows in future videos.

Main speaker/source

  • Naeem (introducing and teaching the tutorial)

Original video