AI درسي
  • Home
  • Artificial Intelligence
  • Cybersecurity
  • Tech Careers
  • Bookmarks
  • About
  • Contact
HomeArtificial IntelligenceCybersecurityTech CareersBookmarksAboutContact

AI درسي

A blog specializing in AI and cybersecurity. We deliver high-quality educational content.

Quick Links

  • Home
  • Artificial Intelligence
  • Cybersecurity
  • Tech Careers
  • Bookmarks
  • About
  • Contact

Contact Us

We welcome your feedback via email

[email protected]
Privacy PolicyTerms & Conditions

© 2026 AI درسي. All rights reserved.

  1. AI درسي
  2. ‹Artificial Intelligence
  3. ‹AI Agents: Your Practical Guide from Zero
AI Agents: Your Practical Guide from Zero
Artificial Intelligence

AI Agents: Your Practical Guide from Zero

AI Agents explained: what they are, how they work, and how to build your first agent with Python. A step-by-step practical guide with code examples and free tools.

AI درسي·February 16, 2026·9 min read·Intermediate
AI agentsautomationPythonAI tools
Share:

What you will learn

  • You will understand what an AI agent is and how it differs from chatbots like ChatGPT
  • You will learn the Perception-Reasoning-Action loop and how agents work internally
  • You will discover how to build your first agent in Python with practical code examples

In November 2025, Cognition launched an agent called Devin -- claiming it was the first fully AI-powered software engineer. Within hours, Devin completed a project that would have taken a human developer two weeks: it read the documentation, wrote the code, tested it, and fixed bugs -- all without a single human intervention.

This isn't ChatGPT. This is something entirely different. This is an AI agent -- and the gap between it and the chat tools you know is like the gap between a regular car and a self-driving one.

What Exactly Is an AI Agent?

An AI agent is a software system that can think, make decisions, and execute tasks independently -- without you telling it every step. You give it a goal, and it plans, executes, monitors results, and adjusts its course until it reaches the objective.

The fundamental difference from ChatGPT or regular AI tools:

FeatureChatbot (ChatGPT)AI Agent
InteractionQuestion -> answer -> waitGoal -> plan -> independent execution
ToolsText only (mostly)Browses the web, writes code, sends email
MemoryLimited to the conversationRemembers previous projects
AutonomyWaits for your commandTakes initiative and completes on its own
ℹ️

According to Gartner's 2026 report, 40% of enterprise applications will include custom AI agents by the end of the year -- up from less than 1% in 2024.

How Does an Agent Work Internally?

An agent operates in an iterative loop of four steps: it receives the task and understands it, breaks it into small steps, executes each step using its tools, then evaluates the result and retries if unsatisfied. This loop is known as the Perception-Reasoning-Action Loop:

Step 1: Perception

The agent receives the task and analyzes the inputs. If you ask it to "write a report on network security" -- it understands it needs to gather information, organize it, and write a coherent text.

Step 2: Planning

It breaks the large task into smaller steps. For example:

  1. Search for the latest network security statistics
  2. Read 5 reliable sources
  3. Write the draft
  4. Review for errors
  5. Format the final report

Step 3: Execution

It executes each step using its tools -- opens a browser, reads websites, writes in a text editor. If it encounters an error, it steps back and tries a different approach.

Step 4: Evaluation

It reviews the result of each step. Does the report contain enough statistics? Is the writing clear? If not -- it retries.

# Simplified agent work loop
# This model illustrates the core logic

class SimpleAgent:
    def __init__(self, goal):
        self.goal = goal
        self.memory = []
        self.tools = ['web_search', 'write_file', 'run_code']

    def plan(self):
        """Break the goal into steps"""
        # The agent uses a language model for planning
        steps = llm.generate(f"Break this goal into steps: {self.goal}")
        return steps

    def execute(self, step):
        """Execute a single step using available tools"""
        tool = self.choose_tool(step)
        result = tool.run(step)
        self.memory.append(result)
        return result

    def evaluate(self, result):
        """Is the result acceptable?"""
        score = llm.evaluate(f"Does this result achieve the goal? {result}")
        return score > 0.7

    def run(self):
        """Main loop"""
        steps = self.plan()
        for step in steps:
            result = self.execute(step)
            if not self.evaluate(result):
                result = self.execute(step)  # Retry
        return self.memory
ℹ️

According to McKinsey's 2026 report, companies using AI agents achieved a 35% productivity increase compared to companies relying solely on chat tools.

What Tools Are Available to Build Your First Agent?

Three main tools let you build AI agents in Python without deep expertise: CrewAI for beginners (the easiest), LangChain for complex projects (the most flexible), and AutoGen from Microsoft for building agents that converse with each other. You don't need years of experience to start with any of them.

CrewAI -- Easiest to Start With

CrewAI is a Python framework that lets you build a "crew" of agents, each with a specific role. Think of it as building a small team: researcher + writer + reviewer.

# Building an agent crew with CrewAI
# pip install crewai

from crewai import Agent, Task, Crew

# Define agents — each has a role
researcher = Agent(
    role="Tech Researcher",
    goal="Gather the latest information about cybersecurity",
    backstory="Expert in researching and analyzing technical sources",
    tools=[search_tool, web_reader]
)

writer = Agent(
    role="Content Writer",
    goal="Write a clear and engaging article from the gathered information",
    backstory="Professional writer who simplifies technical concepts",
    tools=[text_editor]
)

# Define tasks
research_task = Task(
    description="Research the top 5 cyber threats in 2026",
    agent=researcher
)

writing_task = Task(
    description="Write a 1000-word article based on the research results",
    agent=writer
)

# Run the crew
crew = Crew(agents=[researcher, writer], tasks=[research_task, writing_task])
result = crew.kickoff()

LangChain -- Most Flexible

LangChain is the most popular framework for building AI applications. It supports dozens of models and tools. More complex than CrewAI but far more powerful.

AutoGen (Microsoft) -- For Agent Conversations

AutoGen from Microsoft focuses on building agents that "talk" to each other. One agent writes code, another reviews it -- like two developers working together.

ToolDifficultyBest ForLanguage
CrewAIBeginnerSimple agent crewsPython
LangChainIntermediateComplex custom appsPython/JS
AutoGenIntermediateAgent conversationsPython

How to Build Your First Agent Step by Step

You'll build an agent that searches for cybersecurity news and summarizes it automatically -- using CrewAI and Python. The project requires only three steps: install the libraries, define the agent and its task, then run it and watch the result.

Requirements

  • Python 3.10+
  • An API key from OpenAI or any other model
  • CrewAI library

Step 1: Install Libraries

# Install required packages
# pip install crewai crewai-tools openai

import os
os.environ["OPENAI_API_KEY"] = "your-key-here"

Step 2: Define the Agent and Tools

from crewai import Agent, Task, Crew
from crewai_tools import SerperDevTool

# Search tool — uses Google
search = SerperDevTool()

# News agent
news_agent = Agent(
    role="Cybersecurity news analyst",
    goal="Search for the top 3 cybersecurity news items today and summarize them",
    backstory="Security analyst who follows tech news daily and delivers clear summaries",
    tools=[search],
    verbose=True  # To watch the thinking steps
)

# Task
daily_summary = Task(
    description="""
    1. Search for the most important cybersecurity news today
    2. Select the top 3 stories
    3. Summarize each story in 3 sentences
    4. Add the source link for each story
    """,
    agent=news_agent,
    expected_output="Daily summary of the top 3 cybersecurity news items"
)

# Run
crew = Crew(agents=[news_agent], tasks=[daily_summary])
result = crew.kickoff()
print(result)

Step 3: Run and See the Result

When you run the code, you'll watch the agent think:

  1. "I'll search for cybersecurity news today..."
  2. "Found 10 results, selecting the most important..."
  3. "Summarizing..."

Result: a clean summary of three news stories with sources -- without any intervention from you.

ℹ️

According to Oracle's 2026 report, companies that invested in AI agents in 2025 started seeing tangible returns in Q1 2026.

Where Are AI Agents Actually Used Today?

AI agents are currently operating in four major areas: customer service (where Klarna replaced hundreds of employees with a single agent), programming (through tools like Copilot and Devin), digital marketing (for campaign automation), and scientific research (for analyzing papers and suggesting new experiments).

Customer Service -- Klarna replaced 700 employees with an AI agent handling 2.3 million conversations monthly. Average resolution time dropped from 11 minutes to 2 minutes.

Programming -- GitHub Copilot evolved from a code completion tool to an agent that understands the entire project. It reads errors, suggests fixes, and implements them. Cursor and Devin go further -- building complete projects.

Marketing -- Agents analyze customer data, write email campaigns, test different headlines, and automatically select the best performers.

Scientific Research -- Google DeepMind launched agents that read research papers, extract findings, and suggest new experiments.

Want to know how you can profit from these tools? The opportunities are expanding daily.

5 Mistakes Beginners Make

The five most common mistakes when building agents: giving vague tasks instead of specific ones, granting unlimited tool access, ignoring output monitoring, starting with complex projects before mastering the basics, and not setting API call limits that burn through your budget fast.

1. Giving the agent vague tasks -- "Write something useful" won't work. Be specific: "Write a 500-word report on the latest WordPress vulnerabilities with solutions for each."

2. Not restricting allowed tools -- An agent with open permissions might send emails or delete files. Define its tools precisely.

3. Ignoring monitoring -- Agents aren't perfect. Monitor their output initially before fully trusting them.

4. Starting with complex projects -- Start with a simple agent (like the news summarizer above) then scale up.

5. Not managing costs -- Every model call costs money. An agent running in a loop can drain your budget fast. Set a maximum call limit.

Are You Ready?

AI agents aren't a distant future -- they're a tool available right now to anyone who knows basic Python. The first step is simple:

  1. Install CrewAI: pip install crewai
  2. Copy the news agent code from this article
  3. Run it and see the result
  4. Modify the task to fit your needs

Don't wait until everyone becomes an expert. Those who learn to build agents today are the ones who will lead technical teams tomorrow. The fundamentals you need are in our AI Basics guide -- start there if you're completely new.

المصادر والمراجع

  1. OpenAI Blog
  2. Anthropic Research
  3. Hugging Face Blog
Share:

AI Department — AI Darsi

Specialists in AI and machine learning

Published: February 16, 2026
›
Previous ArticleTop 10 Highest-Paying Tech Jobs in 2026: Salaries and Roadmaps
Next ArticleFrontend vs Backend in 2026: Which Programming Path Should You Choose?
‹

Related Articles

How Companies Use AI to Boost Profits — Real Examples
←
Artificial Intelligence

How Companies Use AI to Boost Profits — Real Examples

Discover how companies use AI in marketing, predictive analytics, and customer service to increase revenue by up to 25%, with real examples and practical code.

February 3, 20269 min read
Prompt Engineering: How to Use ChatGPT Effectively
←
Artificial Intelligence

Prompt Engineering: How to Use ChatGPT Effectively

Learn prompt engineering techniques step by step to get the best results from ChatGPT, Claude, and Gemini with practical examples and ready-to-use templates.

January 31, 202616 min read
Top 20 AI Tools in 2026: A Complete, Up-to-Date Guide
←
Artificial Intelligence

Top 20 AI Tools in 2026: A Complete, Up-to-Date Guide

A comprehensive, updated list of the 20 best AI tools in 2026 for writing, coding, design, video, audio, and productivity with pricing and use cases.

January 29, 20269 min read