In this article
July 10, 2025
July 10, 2025

Agentic AI Examples

These agentic AI examples in Python show the difference between systems that can reason and make decisions autonomously, and traditional more deterministic programming paradigms.

Over the past twelve months Google Trends has logged a five‑fold jump in searches for agentic AI examples.

Developers are leaving branch‑laden scripts behind and building systems that accept a goal, form a plan, and adapt when reality wanders off the happy path.

Backed by large‑language models (LLMs), a handful of type‑safe tool APIs, and a memory store, modern agents feel less like vending machines and more like junior colleagues you can delegate to.

In this post, we'll explore some example agents written in Python solving real-world problems to illustrate the difference between needing a code path for every edge case and calling on intelligence to make decisions as needed.

Determinism vs Agency — A Hands‑On Comparison

The job: “Find a 30‑minute slot next week when Alex (NYC), Priya (Bangalore), and Rui (Lisbon) can all meet, then send the invite.”

# schedule_meeting.py  — deterministic script
import googleapiclient.discovery as gcal
from datetime import datetime, timedelta, timezone

def find_slot(participants, duration=30):
    tz_offsets = {"Alex": -4, "Priya": +5.5, "Rui": +1}
    start = datetime.utcnow().replace(hour=13, minute=0, tzinfo=timezone.utc)
    end   = start + timedelta(days=5)

    while start < end:
        if all(9 <= (start + timedelta(hours=tz)).hour <= 18 for tz in tz_offsets.values()):
            return start
        start += timedelta(minutes=30)
    raise RuntimeError("No slot found")

Every rule—working hours, search window, escalation policy—lives in code you must redeploy whenever requirements move. This is the traditional deterministic approach.

In contrast, how would an agent handle this same assignment?

# agentic_scheduler.py  — goal‑driven agent
from langgraph import Agent, Graph
from company_tools import gcal_tool, slack_tool, json_store

class MeetingPlanner(Agent):
    """
    Fivepillar anatomy inside the docstring
      1. Goal input……provided by caller
      2. Memory………  json_store (persists across runs)
      3. Tool interface gcal_tool / slack_tool
      4. Reasoning loop planactobserverefine
      5. Fallback……   try/except on tool failure + timeout guard
    """
    tools = [gcal_tool, slack_tool]

    def plan(self, goal: str, state: dict):
        try:
            # Plan → Act
            slot = gcal_tool.find_slots(
                participants=["Alex", "Priya", "Rui"],
                duration_minutes=30,
                window_days=5,
            )
            slack_tool.send_message(
                channel="#calendar",
                text=f"Booked! {slot.isoformat()}  🎉",
            )
            # Observe → Persist memory
            state["slot"] = slot.isoformat()
            json_store.save("last_meeting.json", state)
            # Success criterion met
            state["done"] = True
        except gcal_tool.NoSlotError:
            # Refine: widen window and retry once
            if state.get("retry", 0) < 1:
                state["retry"] = 1
                state["window_days"] = 10
                return self.plan(goal, state)
            slack_tool.send_message("#calendar", "Could not find a slot 😞")
            state["done"] = True  # guardrail: stop after fallback

The planner queries calendars, reasons over constraints, widens the search once if no slot appears, and notifies the team—no code redeploy required.

It doesn't need to be told about every single new team member's onboarding or departure - it queries the systems it needs to get the requisite data to perform its task, just as a human engineer would.

So what actually constitutes an agentic system as opposed to a traditional deterministic one?

The Five Pillars of an Agentic System

Component Purpose
Goal input “Reduce MTTR for service X” rather than “call /alerts/close”
Memory/state JSON blobs, vector stores, or graph nodes persisted across steps
Tool interface Thin wrappers around privileged actions (APIs, shell, DB) with validation
Reasoning loop Plan → Act → Observe → Refine until the success criterion or a guardrail triggers
Fallback & limits Timeouts, cost ceilings, policy checks for hallucinated calls

Frameworks such as LangGraph (deterministic edges, LLM‑reasoning nodes) and Microsoft AutoGen (chat transcripts among cooperating agents) surface every step for debugging and audit.

Ten Real‑World Agentic AI Examples — All in Python

Each agent below is runnable and labelled to show exactly where the five pillars live.

1 · Customer‑Support Automation Agent

A help‑desk agent watches Zendesk webhooks, answers from a vector store, refunds when policy allows, and escalates low‑confidence cases.

from autogen import Agent
from tools import zendesk, vector_kb, shipping, refunds, json_store

class SupportBot(Agent):
    """
    Pillars
      goal……“triage open tickets      memoryjson_store('support_state.json')
      toolszendesk / vector_kb / refunds / shipping
      loopfor ticketplan & act
      fallbackconfidence < 0.6 ⇒ escalate
    """
    tools = [zendesk.fetch_ticket, vector_kb.answer,
             shipping.refund, refunds.issue_credit, zendesk.post_reply]

    def plan(self, goal, state):
        for t in zendesk.fetch_ticket(status="open", limit=20):
            answered_ids = state.setdefault("done", [])
            if t.id in answered_ids:
                continue
            answer, score = vector_kb.answer(t.question)
            if score > 0.85:
                zendesk.post_reply(t.id, answer)
            elif "refund" in t.text.lower():
                refunds.issue_credit(t.user_id, t.order_id)
                zendesk.post_reply(t.id, "Refund processed ✅")
            else:                                # <‑‑ fallback
                zendesk.post_reply(t.id, "Escalating to a human. Sit tight!")
            answered_ids.append(t.id)
        json_store.save("support_state.json", state)

2 · DevOps Roll‑Back Copilot

Triggered by a PagerDuty webhook, this agent rolls back a failed canary, waits for green health checks, and posts a summary.

from autogen import Agent
from tools import kubectl, grafana, slack, limiter

class Rollbacker(Agent):
    tools = [kubectl.undo, grafana.health, slack.post, limiter.cost_guard]

    def plan(self, goal, state):
        limiter.cost_guard(max_tokens=3_000)       # Fallback & limits
        kubectl.undo("deployment/myservice", to_revision="previous")
        grafana.health.wait_for_green("myservice", timeout=300)
        slack.post("#ops", "Canary rolled back automatically ✅")
        state["done"] = True

3 · Content‑Ops Pipeline

The agent localises a Markdown draft, generates artwork, publishes the article, and schedules social posts—tracking progress through persisted state.

from autogen import Agent
from tools import cms, translate, openai, git, social, json_store

class LocaliseBot(Agent):
    tools = [cms.fetch_draft, translate.to_locales,
             openai.image_gen, git.commit, cms.publish, social.schedule]

    def plan(self, goal, state):
        draft = cms.fetch_draft(goal)
        locales = translate.to_locales(draft.body, ["fr", "de", "es"])
        hero   = openai.image_gen(f"Hero image for {draft.title}")
        git.commit(files={"index.md": draft.body, "hero.png": hero})
        cms.publish(draft.slug, locales=locales)
        social.schedule(message=draft.title, url=draft.url)
        state["slug"] = draft.slug
        json_store.save("content_state.json", state)
        state["done"] = True

4 · GitHub Issue‑Triage Bot

Labels new issues, asks for missing details, and remembers what it has already processed via SQLite.

from autogen import Agent
from tools import github
import sqlite3

db = sqlite3.connect("triage.db")
db.execute("CREATE TABLE IF NOT EXISTS done(id INTEGER PRIMARY KEY)")

class TriageBot(Agent):
    tools = [github.list_issues, github.add_label, github.comment]

    def plan(self, goal, state):
        for issue in github.list_issues("owner/repo", state="open"):
            if db.execute("SELECT 1 FROM done WHERE id=?", (issue.id,)).fetchone():
                continue
            label = ("bug" if "error" in issue.title.lower()
                     else "feature" if "feature" in issue.title.lower()
                     else "question")
            github.add_label(issue.id, label)
            if not issue.body.strip():
                github.comment(issue.id, "Could you add more details so we can help?")
            db.execute("INSERT INTO done(id) VALUES(?)", (issue.id,))
            db.commit()
        state["done"] = True

5 · Sales‑Prospecting Autopilot

Clusters new leads, drafts outreach, and records contact history.

from autogen import Agent
from tools import hubspot, openai, gmail, json_store

class Prospector(Agent):
    tools = [hubspot.new_leads, openai.chat, gmail.send]

    def plan(self, goal, state):
        leads = hubspot.new_leads(filters={"ICP": True})
        contacted = state.setdefault("contacted", [])
        for lead in leads:
            if lead.id in contacted:
                continue
            email = openai.chat(f"Write a friendly intro email to {lead.name}")
            gmail.send(to=lead.email, subject="Quick intro", body=email)
            contacted.append(lead.id)
        json_store.save("sales_state.json", state)
        state["done"] = True

6 · Finance‑Reconciliation Clerk

Matches Stripe payouts to the ledger and files variance tickets.

from autogen import Agent
from tools import stripe, ledger, jira, json_store

class Reconciler(Agent):
    tools = [stripe.fetch_payouts, ledger.fetch_report, jira.create_ticket]

    def plan(self, goal, state):
        payouts = stripe.fetch_payouts(month="last")
        report  = ledger.fetch_report(month="last")
        missing = [p for p in payouts if p.id not in {r.id for r in report}]
        if not missing:
            state["done"] = True
            return
        for p in missing:
            jira.create_ticket(title=f"Unmatched payout {p.id}", data=p.dict())
        state["variances"] = [p.id for p in missing]
        json_store.save("finance_state.json", state)
        state["done"] = True

7 · Threat‑Hunting SOC Analyst

Streams security logs, runs containment playbooks, and writes a root‑cause summary.

from autogen import Agent
from tools import cloudtrail, crowdstrike, playbooks, confluence

class Hunter(Agent):
    tools = [cloudtrail.stream, crowdstrike.stream, playbooks.contain, confluence.post]

    def plan(self, goal, state):
        alerts = cloudtrail.stream().merge(crowdstrike.stream()).filter_anomalies()
        resolved = []
        for alert in alerts:
            playbooks.contain(alert)
            confluence.post(space="Incidents", page=alert.id, body=alert.report())
            resolved.append(alert.id)
        state["incidents_resolved"] = resolved
        state["done"] = True

8 · Data‑Quality Sentry for ETL Pipelines

Guards a nightly dbt run and rolls back on schema drift.

from autogen import Agent
from tools import dbt, gitlab, slack

class Sentry(Agent):
    tools = [dbt.run, dbt.sample, slack.post, gitlab.comment]

    def plan(self, goal, state):
        result = dbt.run(target="prod", warn_error=True)
        if "SchemaChange" in result.events:
            drift = dbt.sample(table=result.table, rows=100)
            gitlab.comment(mr=state["mr"], text=f"Drift detected:\n{drift.head()}")
            slack.post("#analytics", "dbt rollback due to drift 🚨")
            state["done"] = True
            return
        slack.post("#analytics", "dbt run succeeded 🎉")
        state["done"] = True

9 · Legal‑Document Summariser & Risk Filter

Reviews a folder of contracts, flags indemnity clauses, and posts summaries.

from autogen import Agent
from tools import fs, openai, slack

class CounselAid(Agent):
    tools = [fs.read_dir, fs.read_file, openai.chat, slack.post]

    def plan(self, goal, state):
        for path in fs.read_dir("./contracts"):
            text = fs.read_file(path)
            summary = openai.chat(f"Summarise and flag indemnity risk:\n{text}")
            slack.post("#legal", f"*{path}* summary:\n{summary}")
        state["done"] = True

10 · Personal Research Concierge

Searches external sources, stores citations, drafts a memo, and schedules a review.

from autogen import Agent
from tools import arxiv, crunchbase, openai, calendly, duckdb

db = duckdb.connect("research.duckdb")

class Concierge(Agent):
    tools = [arxiv.search, crunchbase.search, openai.chat, calendly.schedule]

    def plan(self, goal, state):
        papers   = arxiv.search(goal)
        startups = crunchbase.search(goal)
        db.execute("CREATE TABLE IF NOT EXISTS refs AS SELECT * FROM papers")
        memo = openai.chat(f"Write a 1‑pager on '{goal}'. Use citations.")
        state["memo"] = memo
        calendly.schedule(15, topic=goal)
        state["done"] = True

When Deterministic Code Is Still Better

Agents introduce latency and probabilistic ambiguity. Choose fixed logic when you need sub‑100 ms responses, when auditors demand line‑by‑line traceability, or when the job is purely mechanical—say, CSV → Parquet without branching.

If the happy path and all error cases fit on a single whiteboard, an agent is overkill.

Frameworks to Watch

  • LangGraph – Graph‑structured, auditable workflows where edges are deterministic and nodes are “thinking” steps.
  • Microsoft AutoGen – Asynchronous, cooperative chat agents that can self‑reflect.
  • CrewAI – Role‑based multi‑agent orchestration with a no‑code studio.

Others worth exploring: DSPy, Agno, Dust, and Semantic Kernel, each optimized for a different slice of planning versus execution.

The Future Is Goal‑Driven

Moving from deterministic scripts to autonomous, goal‑seeking software is as disruptive as the jump from assembly to Python.

As more agentic AI examples graduate from GitHub demos to production workloads, developers will spend less time coding edge cases and more time articulating outcomes.

Learn the anatomy, master the guardrails, and you’ll ship software that not only runs, but reasons.

This site uses cookies to improve your experience. Please accept the use of cookies on this site. You can review our cookie policy here and our privacy policy here. If you choose to refuse, functionality of this site will be limited.