Artificial intelligence has moved past simple chatbots and prediction models. In 2026, the two terms every developer, student, and hiring manager is talking about are Generative AI and Agentic AI. Both are built almost entirely on Python, and together they are reshaping how software gets written, how businesses automate work, and how careers in tech are built.
This guide walks you through both fields from the ground up. You will learn what Generative AI and Agentic AI actually mean, how they differ, how to set up a Python environment for building with them, how to write your first generative application, how to build a Retrieval Augmented Generation (RAG) pipeline, how to create your first AI agent, and how to compare and use the leading agentic frameworks such as LangGraph, CrewAI, and AutoGen. Along the way you will find working Python code, practical project ideas, and links to deeper resources including Codegnan’s own Data Science with Agentic AI Course in Hyderabad for readers who want structured, mentor led training.
What Is Generative AI
Generative AI refers to a class of artificial intelligence systems that create new content rather than simply analyzing or classifying existing content. Instead of predicting whether an email is spam or not, a generative model can write the email itself. Instead of labeling an image as a cat, a generative model can create a brand new picture of a cat that has never existed before.
At the core of most modern generative AI systems sits a Large Language Model, commonly called an LLM. These models are trained on enormous datasets of text, code, and sometimes images or audio. Through this training, they learn statistical patterns in language: which words tend to follow which other words, how ideas are structured, how questions are usually answered, and how code is typically written. Once trained, the model can be given a prompt and it generates a continuation that is statistically likely to be useful, coherent, and relevant.
Generative AI is not limited to text. The same underlying principles power:
- Text generation and summarization (GPT style models, Claude, Gemini, Llama)
- Image generation (diffusion models such as Stable Diffusion and Midjourney)
- Code generation (Codex style models built into IDEs and coding assistants)
- Audio and voice synthesis (text to speech and voice cloning models)
- Video generation (emerging diffusion and transformer based video models)
For a Python developer, working with generative AI usually means calling an API (such as the OpenAI API, the Anthropic API, or a Hugging Face hosted model), or running an open source model locally using libraries such as Hugging Face Transformers, Ollama, or llama.cpp. Codegnan’s Python Training in Hyderabad starts learners at exactly this foundation, teaching the Python skills needed before moving into generative model integration.
What Is Agentic AI
Agentic AI takes the generation capability of an LLM and wraps it inside a loop that can plan, decide, act, observe the result of that action, and decide again. In other words, an agent does not just answer a question in one shot. It breaks a goal into steps, chooses tools to use, executes those tools, looks at what happened, and adjusts its next move.
A simple way to remember the distinction: Generative AI produces an output. Agentic AI pursues a goal. A generative model given the prompt “book me a flight to Delhi” can only describe what booking a flight would look like. An agentic system given the same instruction can search flight databases through an API, compare prices, check your calendar for conflicts, and actually complete the booking, all without a human clicking through each step.
The key components that make a system agentic are:
- Planning – breaking a broad goal into an ordered set of smaller tasks
- Tool use – calling external functions, APIs, databases, or other software to gather information or take action
- Memory – retaining context across multiple steps or even multiple sessions
- Reasoning – deciding what to do next based on the outcome of the previous step
- Autonomy – executing multiple steps without requiring a human to approve every single action
Agentic AI is what powers coding assistants that can open files, run tests, and fix bugs on their own; customer support systems that can look up an order, issue a refund, and send a confirmation email; and research assistants that can search the web, read multiple sources, and compile a report.
Generative AI vs Agentic AI: The Real Difference
| Aspect | Generative AI | Agentic AI |
|---|---|---|
| Core behavior | Produces content from a prompt | Pursues a goal through multiple steps |
| Output | Text, image, audio, code | Completed tasks, real world actions |
| Decision making | Single pass, one response | Iterative loop of plan, act, observe |
| Tool access | Usually none by default | Calls APIs, databases, files, other agents |
| Human involvement | Human reviews each output | Human sets a goal, agent executes autonomously or semi autonomously |
| Example | ChatGPT writing a blog post | An agent that researches a topic, writes the post, checks it for plagiarism, and publishes it |
It is worth noting that Agentic AI is built on top of Generative AI. Every agent still relies on an LLM to reason and decide, but the agent framework adds the orchestration layer around that model. This is why almost every agentic system you build in Python will still involve prompt engineering, context management, and LLM API calls, just with additional logic layered on top.
Why Python Is the Language of Choice
Python dominates the Generative AI and Agentic AI space for several concrete reasons.
Rich ecosystem of libraries. Nearly every major AI lab, including OpenAI, Anthropic, Google, and Meta, ships an official Python SDK first. Frameworks such as LangChain, LlamaIndex, CrewAI, AutoGen, and Hugging Face Transformers are Python native.
Readable syntax for rapid prototyping. AI development is experimental by nature. You are constantly testing prompts, swapping models, and adjusting logic. Python’s simple syntax lets you iterate fast without fighting the language.
Strong data science foundation. Generative AI does not exist in isolation. It sits on top of decades of numerical computing and machine learning tooling: NumPy, Pandas, scikit learn, PyTorch, and TensorFlow are all Python first, which means the same language takes you from data cleaning to model training to deployment.
Massive community and documentation. Because so many practitioners use Python, tutorials, Stack Overflow answers, GitHub repositories, and open source examples exist for nearly every problem you will encounter.
If you are starting from zero, building a solid Python foundation is the single most important first step. Codegnan’s Python Syllabus and Python Career Path resources are useful references for structuring that foundation before moving into AI specific tooling.
Setting Up Your Python Environment
Before writing any generative or agentic code, set up a clean, isolated Python environment. This avoids dependency conflicts between different AI libraries, which can be surprisingly heavy and version sensitive.
# Check your Python version (3.10 or higher is recommended)
python --version
# Create a virtual environment
python -m venv genai-env
# Activate it (Linux/Mac)
source genai-env/bin/activate
# Activate it (Windows)
genai-env\Scripts\activate
# Upgrade pip
pip install --upgrade pip
Once your environment is active, install the core libraries you will use throughout this guide:
pip install openai anthropic langchain langchain-community langgraph
pip install chromadb sentence-transformers
pip install crewai crewai-tools
pip install python-dotenv fastapi uvicorn streamlit
Store your API keys in a .env file rather than hardcoding them into scripts:
OPENAI_API_KEY=your_key_here
ANTHROPIC_API_KEY=your_key_here
Load them safely in Python using the python-dotenv package:
from dotenv import load_dotenv
import os
load_dotenv()
api_key = os.getenv("OPENAI_API_KEY")
Never commit .env files to version control. Add .env to your .gitignore file before your first commit.
Understanding Large Language Models
To build effectively with generative and agentic systems, you need a working mental model of how an LLM processes text, even if you never train one yourself.
Tokens. Models do not read words directly. Text is broken into tokens, which are chunks of characters roughly the size of a syllable or short word. “Generative” might be split into two or three tokens. Every API call you make is billed and limited by token count, both for the input you send and the output the model returns.
Context window. This is the maximum number of tokens a model can consider at once, including your prompt, any conversation history, and the response it generates. A larger context window lets you paste in more documents or maintain longer conversations, but it also increases cost and latency.
Transformer architecture. Most modern LLMs are built on the transformer architecture, which uses a mechanism called self attention to weigh the importance of different words relative to each other when generating the next token. This is what allows the model to understand that in the sentence “the trophy did not fit in the suitcase because it was too big,” the word “it” refers to the trophy, not the suitcase.
Hallucination. Because LLMs generate the statistically likely next token rather than looking up verified facts, they can produce confident sounding but incorrect information. This is one of the most important limitations to design around, and it is the main reason techniques like Retrieval Augmented Generation exist, which we cover later in this guide.
Temperature and sampling. Most APIs let you control how random or deterministic the output is through a temperature parameter. A low temperature (close to 0) produces focused, repeatable answers, useful for factual tasks. A higher temperature produces more varied and creative output, useful for brainstorming or fiction.
Prompt Engineering Fundamentals
Prompt engineering is the practice of designing the input you send to an LLM so that it produces the output you actually want. It is a core skill for both generative and agentic development.
Be specific about format. Instead of “summarize this article,” try “summarize this article in three bullet points, each under 20 words, written for a non technical reader.”
Provide examples (few shot prompting). Showing the model one or two examples of the input and output you want dramatically improves consistency.
prompt = """
Classify the sentiment of the review as Positive, Negative, or Neutral.
Review: "The delivery was fast and the product works great."
Sentiment: Positive
Review: "It broke after two days and support never replied."
Sentiment: Negative
Review: "{user_review}"
Sentiment:
"""
Use system prompts to set behavior. Most chat based APIs accept a system message that defines the assistant’s role, tone, and constraints separately from the user’s actual question.
Ask for step by step reasoning when the task is complex. Phrases like “think through this step by step before giving your final answer” often improve accuracy on multi step logic or math problems.
Request structured output for downstream use. If your Python code needs to parse the model’s response, ask explicitly for JSON and specify the exact keys you expect.
prompt = """
Extract the following details from the job posting below and return only valid JSON with keys: title, company, location, salary_range.
Job posting:
{job_text}
"""
Building Your First Generative AI Application
Let’s build something concrete: a Python command line tool that generates a short product description from a few input keywords, using an LLM API.
import os
from dotenv import load_dotenv
from openai import OpenAI
load_dotenv()
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
def generate_product_description(product_name: str, features: list[str]) -> str:
feature_text = ", ".join(features)
prompt = (
f"Write a two paragraph, persuasive e commerce product description "
f"for a product called '{product_name}'. "
f"Highlight these features naturally: {feature_text}. "
f"Keep the tone friendly and avoid exaggerated claims."
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": "You are an expert e commerce copywriter."},
{"role": "user", "content": prompt},
],
temperature=0.7,
max_tokens=300,
)
return response.choices[0].message.content
if __name__ == "__main__":
description = generate_product_description(
"AeroFlex Running Shoes",
["breathable mesh upper", "lightweight foam sole", "reflective night strips"],
)
print(description)
This same pattern, sending a well structured prompt to a chat completion endpoint and reading the response, is the foundation of nearly every generative AI application, whether it is writing emails, generating code, summarizing documents, or producing marketing copy. Once you are comfortable with this pattern, wrapping it in a small web interface using Streamlit or FastAPI turns it into a shareable tool.
import streamlit as st
st.title("Product Description Generator")
name = st.text_input("Product name")
features_input = st.text_area("Features (comma separated)")
if st.button("Generate"):
features = [f.strip() for f in features_input.split(",") if f.strip()]
result = generate_product_description(name, features)
st.write(result)
Retrieval Augmented Generation (RAG) Explained
RAG solves one of the biggest limitations of generative AI: LLMs only know what they were trained on, and that training data has a cutoff date. RAG allows a model to answer questions using your own, current, private documents by retrieving relevant information at query time and inserting it into the prompt before the model generates a response.
The RAG pipeline generally works in four stages:
- Ingestion. Your documents (PDFs, web pages, support tickets, internal wikis) are split into smaller chunks.
- Embedding. Each chunk is converted into a numerical vector using an embedding model. Vectors that are semantically similar end up close to each other in this numerical space.
- Storage and retrieval. These vectors are stored in a vector database such as ChromaDB, Pinecone, or FAISS. When a user asks a question, the question itself is embedded and the database returns the chunks whose vectors are closest to it.
- Generation. The retrieved chunks are inserted into the prompt as context, and the LLM generates an answer grounded in that specific information, dramatically reducing hallucination.
RAG is one of the most in demand practical skills in the current job market because most companies do not want a generic chatbot. They want an assistant that can answer questions about their own product manuals, HR policies, or codebase.
Building a RAG Pipeline with LangChain and ChromaDB
Here is a working example that loads a text document, splits it, embeds it, stores it in ChromaDB, and answers questions using retrieved context.
import os
from dotenv import load_dotenv
from langchain_community.document_loaders import TextLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_community.vectorstores import Chroma
from langchain_community.embeddings import HuggingFaceEmbeddings
from langchain_openai import ChatOpenAI
from langchain.chains import RetrievalQA
load_dotenv()
# Step 1: Load the document
loader = TextLoader("company_policy.txt")
documents = loader.load()
# Step 2: Split into chunks
splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50)
chunks = splitter.split_documents(documents)
# Step 3: Create embeddings and store them in ChromaDB
embedding_model = HuggingFaceEmbeddings(model_name="all-MiniLM-L6-v2")
vectorstore = Chroma.from_documents(
documents=chunks,
embedding=embedding_model,
persist_directory="./chroma_db",
)
# Step 4: Build a retrieval based question answering chain
retriever = vectorstore.as_retriever(search_kwargs={"k": 3})
llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)
qa_chain = RetrievalQA.from_chain_type(
llm=llm,
retriever=retriever,
return_source_documents=True,
)
# Step 5: Ask a question
result = qa_chain.invoke({"query": "What is the company's remote work policy?"})
print(result["result"])
A few practical notes for production use. Chunk size and overlap significantly affect answer quality; too small and you lose context, too large and irrelevant text dilutes the retrieved chunk. Metadata filtering lets you narrow retrieval to specific document types, dates, or departments before the similarity search runs. Distance metrics such as cosine similarity, dot product, or Euclidean distance determine how “closeness” is calculated, and the right choice depends on your embedding model. These exact topics, including metadata filtering and distance metrics, are covered hands on inside Codegnan’s Data Science with Agentic AI Course curriculum.
Introduction to AI Agents
An AI agent is a program that uses an LLM as its decision making core and can autonomously choose which action to take next in order to achieve a goal, rather than following a fixed, hardcoded sequence of steps.
The most common pattern for building a basic agent is called ReAct, short for Reason and Act. On each turn, the agent:
- Reasons about the current state of the task in plain language
- Decides on an action, which is usually a call to a tool such as a search function, calculator, or database query
- Observes the result returned by that tool
- Repeats the loop, reasoning again with the new information, until it decides the task is complete
Tools are simply Python functions the agent is allowed to call. You describe each tool to the LLM (its name, what it does, and what parameters it expects), and the model decides when calling that tool is the right move based on the user’s request.
Memory in an agent context comes in two forms. Short term memory holds the current conversation or task state and usually lives in the context window itself. Long term memory persists across sessions and is often implemented using a vector database, similar to the retrieval step in RAG, so the agent can recall facts from previous interactions.
Building Your First AI Agent in Python
Below is a minimal but complete agent built using LangChain’s tool calling pattern. The agent has access to two tools: a calculator and a simple weather lookup function, and it decides on its own which tool, if any, to use.
import os
from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
from langchain.agents import create_tool_calling_agent, AgentExecutor
from langchain.tools import tool
from langchain_core.prompts import ChatPromptTemplate
load_dotenv()
@tool
def calculator(expression: str) -> str:
"""Evaluate a basic math expression, e.g. '12 * 7 + 3'."""
try:
return str(eval(expression, {"__builtins__": {}}))
except Exception as e:
return f"Error evaluating expression: {e}"
@tool
def get_weather(city: str) -> str:
"""Return a mock current weather report for a given city."""
mock_data = {
"hyderabad": "32°C, partly cloudy",
"vijayawada": "34°C, sunny",
"visakhapatnam": "29°C, humid with light rain",
}
return mock_data.get(city.lower(), "Weather data not available for this city.")
tools = [calculator, get_weather]
llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)
prompt = ChatPromptTemplate.from_messages([
("system", "You are a helpful assistant. Use tools when they help answer the question accurately."),
("human", "{input}"),
("placeholder", "{agent_scratchpad}"),
])
agent = create_tool_calling_agent(llm, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
response = agent_executor.invoke({
"input": "What is the weather in Vijayawada, and what is 245 multiplied by 8?"
})
print(response["output"])
When you run this, you will see the agent reason internally, decide it needs both tools, call get_weather and calculator, observe each result, and combine them into one final natural language answer. This loop of reasoning, tool calling, and observing is the essence of agentic behavior, and everything more advanced (multi agent orchestration, memory, planning) is built on top of this same foundation.
Agentic AI Frameworks Compared
As agentic AI matured through 2026, a handful of Python frameworks became the standard choices for production and learning. Each has a different philosophy for how agents coordinate.
| Framework | Best For | Orchestration Style | Learning Curve |
|---|---|---|---|
| LangGraph | Complex, stateful workflows that need branching, retries, and human approval steps | Directed graph with nodes and conditional edges | Moderate to high |
| CrewAI | Fast prototyping of role based teams of agents | Role based “crew” with sequential or hierarchical task flow | Low |
| AutoGen (Microsoft Agent Framework) | Conversational multi agent systems, Azure heavy environments | Agents communicate through structured group chat | Moderate |
| Google ADK | Hierarchical agent trees with a root agent delegating to sub agents | Org chart style delegation, tight Gemini integration | Moderate |
| OpenAI Agents SDK | Simple, fast single agent or handoff based systems | Explicit handoffs between agents | Low |
| LlamaIndex Agents | RAG heavy applications where retrieval is the core capability | Tool calling agents built around data indexing | Low to moderate |
A practical rule many teams follow: start with CrewAI if you are learning agent concepts for the first time because its role based mental model (a “crew” of specialist agents each with a job) is intuitive. Move to LangGraph once you need precise control over state, retries, branching logic, or a human in the loop checkpoint before an agent takes a sensitive action. This same progression, from CrewAI style prototyping to LangGraph style production control, is exactly how Codegnan structures the Agentic AI modules inside its Data Science with Agentic AI Course in Visakhapatnam, moving learners from single agents to multi agent design patterns and route agents.
Building a Multi Agent System with LangGraph
LangGraph models an agentic workflow as a graph, where each node is a function (often an LLM call or tool call) and edges define what happens next based on the current state. This example builds a two node research and writing workflow.
from typing import TypedDict
from langgraph.graph import StateGraph, END
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o-mini", temperature=0.3)
class WorkflowState(TypedDict):
topic: str
research_notes: str
final_article: str
def research_node(state: WorkflowState) -> WorkflowState:
prompt = f"List five key facts about: {state['topic']}. Be concise and factual."
response = llm.invoke(prompt)
return {"research_notes": response.content}
def writing_node(state: WorkflowState) -> WorkflowState:
prompt = (
f"Using these research notes, write a short 200 word article on '{state['topic']}':\n\n"
f"{state['research_notes']}"
)
response = llm.invoke(prompt)
return {"final_article": response.content}
graph = StateGraph(WorkflowState)
graph.add_node("researcher", research_node)
graph.add_node("writer", writing_node)
graph.set_entry_point("researcher")
graph.add_edge("researcher", "writer")
graph.add_edge("writer", END)
workflow = graph.compile()
result = workflow.invoke({"topic": "the impact of agentic AI on customer support"})
print(result["final_article"])
Notice how each node only receives and returns pieces of a shared state dictionary. This makes the workflow easy to reason about, checkpoint, and resume, which is exactly why LangGraph is favored for production grade agents where you need to pause for human approval or recover cleanly from a failure partway through a task.
Building a Role Based Crew with CrewAI
CrewAI takes a different approach: you define agents with roles, goals, and backstories, then assign them tasks, and CrewAI handles the coordination between them.
from crewai import Agent, Task, Crew, Process
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o-mini", temperature=0.4)
researcher = Agent(
role="Market Researcher",
goal="Find and summarize the latest trends in agentic AI adoption",
backstory="An analyst who specializes in tracking enterprise AI adoption patterns.",
llm=llm,
verbose=True,
)
writer = Agent(
role="Content Writer",
goal="Turn research into a clear, engaging blog post",
backstory="A technical writer known for simplifying complex AI topics for a general audience.",
llm=llm,
verbose=True,
)
research_task = Task(
description="Research current adoption trends of agentic AI among mid sized companies.",
expected_output="A bulleted list of five clear trends with brief explanations.",
agent=researcher,
)
writing_task = Task(
description="Write a 300 word blog post based on the research findings.",
expected_output="A polished, engaging blog post in plain text.",
agent=writer,
context=[research_task],
)
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, writing_task],
process=Process.sequential,
verbose=True,
)
result = crew.kickoff()
print(result)
The context=[research_task] line is what lets the writer agent see the researcher’s output automatically. CrewAI also supports a hierarchical process, where a manager agent assigns and reviews work from other agents, which is useful when a workflow genuinely resembles a small team with a lead rather than a fixed pipeline.
Understanding Model Context Protocol (MCP)
Model Context Protocol, usually shortened to MCP, is an open standard that defines how an AI model or agent connects to external tools, data sources, and other agents in a consistent way. Before MCP, every framework had its own bespoke way of defining tools, which meant a tool built for LangChain could not easily be reused in CrewAI or a custom agent.
MCP solves this by defining a standard client server interface. An MCP server exposes a set of tools, resources, or prompts. Any MCP compatible client, whether it is Claude, a custom Python agent, or another framework, can discover and call those tools using the same protocol. This is similar in spirit to how a REST API standardizes how web services talk to each other, except MCP is purpose built for AI models and agents.
A minimal MCP server in Python looks like this using the official mcp SDK:
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("CompanyToolsServer")
@mcp.tool()
def lookup_order_status(order_id: str) -> str:
"""Look up the shipping status of an order by its ID."""
mock_orders = {"ORD1001": "Shipped, arriving in 2 days", "ORD1002": "Processing"}
return mock_orders.get(order_id, "Order not found")
if __name__ == "__main__":
mcp.run()
Once running, any MCP compatible agent can call lookup_order_status without needing custom integration code written specifically for that agent’s framework. Related to MCP is the Agent to Agent protocol (A2A), which standardizes how agents built on different frameworks can discover and call each other, letting a LangGraph agent hand off work to a CrewAI agent through a shared, standardized interface rather than custom glue code.
Fine Tuning and LoRA Basics
Most Generative AI and Agentic AI applications do not require training a model from scratch, or even fully fine tuning one. Instead, developers use parameter efficient fine tuning techniques, the most popular of which is LoRA, short for Low Rank Adaptation.
Full fine tuning updates every weight in a model, which for a large model can mean adjusting billions of parameters, requiring significant GPU memory and cost. LoRA instead freezes the original model weights and injects small, trainable low rank matrices into specific layers. During training, only these small matrices are updated. This reduces the number of trainable parameters by orders of magnitude while still meaningfully adapting the model’s behavior to a specific domain or tone.
A simplified LoRA fine tuning setup using Hugging Face’s peft library looks like this:
from transformers import AutoModelForCausalLM, AutoTokenizer, TrainingArguments, Trainer
from peft import LoraConfig, get_peft_model
model_name = "meta-llama/Llama-3.1-8B"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
lora_config = LoraConfig(
r=8,
lora_alpha=16,
target_modules=["q_proj", "v_proj"],
lora_dropout=0.05,
bias="none",
task_type="CAUSAL_LM",
)
model = get_peft_model(model, lora_config)
model.print_trainable_parameters()
# From here, you would prepare a tokenized dataset and pass it,
# along with the model and TrainingArguments, into a Trainer object to run fine tuning.
Two related concepts often paired with LoRA are quantization and QLoRA. Quantization reduces the numerical precision used to store model weights (for example from 16 bit to 4 bit), which shrinks memory usage dramatically with a small accuracy trade off. QLoRA combines quantization with LoRA, allowing fine tuning of very large models on a single consumer GPU. These techniques are what make it realistic for individual developers and small teams to customize open models such as Llama without enterprise scale infrastructure.
Evaluating and Securing Your AI Agents
Building an agent is only half the work. Before putting one in front of real users, especially one that can take real actions like sending emails or modifying records, you need a way to evaluate its behavior and guard against failure.
Functional evaluation checks whether the agent actually completes the task correctly, using a labeled set of test cases with known correct outcomes. This is similar to unit testing, but the “assertions” often compare semantic meaning rather than exact string matches, since LLM outputs vary in wording.
Operational metrics track things that matter in production: average number of tool calls per task, latency, token cost per completed task, and failure or retry rate. LangGraph’s explicit node structure makes these metrics easier to measure because each step in the workflow is a discrete, traceable unit.
Safety and guardrails include input validation (filtering malicious or manipulative prompts before they reach the model), output validation (checking that generated content or actions meet policy before execution), and scoped permissions (giving an agent access only to the specific tools and data it needs for its task, never broad, unrestricted access).
Human in the loop checkpoints are one of the most important safety patterns for any agent that can take a consequential action, such as sending money, deleting data, or messaging a customer. Rather than letting the agent act fully autonomously, the workflow pauses at a defined point and waits for a human to approve or reject the proposed action before continuing.
A simple guardrail pattern in Python might look like this before executing a sensitive tool call:
def confirm_before_execution(action_description: str) -> bool:
response = input(f"Agent wants to: {action_description}\nApprove? (y/n): ")
return response.strip().lower() == "y"
if confirm_before_execution("send a refund of ₹1,200 to order ORD1002"):
process_refund("ORD1002", 1200)
else:
print("Action cancelled by human reviewer.")
In production systems this check is usually built into the agent’s graph itself rather than a blocking terminal prompt, but the underlying principle, pause and require approval before an irreversible action, remains the same.
Real World Use Cases Across Industries
Generative and Agentic AI are already in production across a wide range of sectors.
Retail and e-commerce. Product description generation, personalized recommendation copy, and agents that monitor inventory levels and automatically reorder stock or flag pricing anomalies.
Banking, Financial Services, and Insurance (BFSI). Document summarization for loan applications, fraud pattern explanation, and agents that triage support tickets, gather account context, and draft responses for a human agent to approve.
Healthcare. Clinical note summarization, patient intake chatbots that gather symptoms before a doctor visit, and research agents that scan medical literature for relevant studies.
Manufacturing. Predictive maintenance report generation and agents that monitor sensor data streams, flag anomalies, and open maintenance tickets automatically.
Software development. Code generation, automated code review agents, and agents that can read a bug report, locate the relevant file, propose a fix, and open a pull request.
Customer support. Multi agent systems where one agent classifies the incoming ticket, a second retrieves relevant knowledge base articles using RAG, and a third drafts a response, with a human reviewing before it is sent.
For hands on practice with these kinds of applications, Codegnan’s Python Projects and Data Science Projects pages list beginner friendly project ideas that map closely to these real world patterns.
Career Paths in Generative AI and Agentic AI
The rise of Generative AI and Agentic AI has created several distinct, in demand job roles.
- Generative AI Engineer builds applications on top of LLMs, focusing on prompt design, API integration, and RAG pipelines.
- AI Agent Developer / AI Automation Engineer designs and builds multi step, tool using agents and automation workflows for business processes.
- AI Application Developer builds the surrounding product, including backend APIs, frontend interfaces, and deployment pipelines, around AI capabilities.
- Machine Learning Engineer focuses more on training, fine tuning, and deploying models, including LoRA based customization.
- Data Scientist with AI specialization combines traditional data analysis and modeling with generative AI powered insights and reporting.
Nearly all of these roles share a common foundation: strong Python skills, comfort with APIs, and an understanding of how LLMs and agent frameworks work. This is why most structured learning paths, including Codegnan’s Data Science Career Path and Machine Learning Career Path, start with Python fundamentals and data science basics before introducing generative and agentic tooling.
Learning Roadmap: From Python Basics to Agentic AI
If you are starting from zero, here is a practical order to learn in.
Stage 1: Python fundamentals. Variables, control flow, functions, object oriented programming, file handling, and working with libraries like Pandas and NumPy. Codegnan’s Python Syllabus covers this stage in detail.
Stage 2: APIs and backend basics. Learn to call and build REST APIs using requests and FastAPI. Nearly every generative AI integration starts with an API call, so comfort here is essential.
Stage 3: Data science and machine learning fundamentals. Understand exploratory data analysis, basic statistics, and core machine learning algorithms. This builds the intuition you need to evaluate whether an AI system is actually working well.
Stage 4: Generative AI foundations. Learn how LLMs work, practice prompt engineering, and build small applications that call an LLM API directly.
Stage 5: RAG and vector databases. Learn to chunk documents, generate embeddings, and query a vector database such as ChromaDB to ground LLM answers in real data.
Stage 6: Agentic AI. Start with a single tool calling agent, then move into multi agent systems using CrewAI or LangGraph. Learn the ReAct pattern, memory design, and orchestration patterns like route agents and hierarchical crews.
Stage 7: Advanced topics. Model Context Protocol for standardized tool access, agent evaluation and safety guardrails, and fine tuning with LoRA or QLoRA for domain specific customization.
Stage 8: Deployment and portfolio building. Package your projects behind a FastAPI backend or a Streamlit interface, deploy them to the cloud, and document them clearly for your resume or portfolio.
Following this order mirrors how Codegnan structures its own Data Science with Agentic AI curriculum, which moves learners from Python basics through Pandas, NumPy, and machine learning, into Generative AI, RAG architecture, Agentic AI, MCP, and finally LoRA based fine tuning, all backed by real time projects at each stage.
How Codegnan Can Help You Get There
Reading about Generative AI and Agentic AI is useful, but building real projects under guided mentorship is what actually prepares you for a job in this field. Codegnan’s Data Science with Agentic AI Course is a 100 day, industry focused program available in Hyderabad, Vijayawada, and Visakhapatnam, covering exactly the roadmap described above: Python fundamentals, Pandas and NumPy, machine learning, Generative AI, LangChain, RAG architecture with ChromaDB, AI agents, Model Context Protocol, multi agent design patterns, and LoRA based fine tuning.
The program includes hands on projects such as a GenAI voice assistant, RAG based AI applications, multi agent AI systems, and AI automation workflows, along with placement support, mock interviews, and mentorship from working industry professionals. If you are earlier in your journey and want to strengthen Python first, Codegnan’s Python Training and Python Full Stack programs are natural starting points, and the Machine Learning Course is a strong bridge for learners who want deeper modeling fundamentals before moving into Generative AI and Agentic AI specifically. You can also browse ongoing tutorials and updates on the Codegnan Blogs page.
FAQs
Do I need a machine learning background to learn Generative AI and Agentic AI?
No. A solid grasp of Python and basic programming concepts is enough to start building with LLM APIs and agent frameworks. A machine learning background helps when you move into fine tuning or model evaluation, but it is not a prerequisite for building applications.
Which framework should I learn first, LangChain, LangGraph, or CrewAI?
Start with basic LLM API calls and prompt engineering, then learn CrewAI for its intuitive role based mental model, and move to LangGraph once you need precise control over state, branching, and human approval steps in production workflows.
Is Agentic AI just a marketing term for chatbots with extra steps?
No. The defining difference is autonomous, multi step decision making with tool use. A chatbot answers a question. An agent can look up information, take an action such as updating a record or sending a message, observe the result, and decide what to do next, all without a human directing each step.
How much Python do I need before starting RAG or agent development?
You should be comfortable with functions, classes, working with external libraries, handling JSON data, and making basic API calls using the requests library. Everything beyond that, including LangChain, vector databases, and agent frameworks, can be learned alongside your first project.
What is the difference between fine tuning and RAG, and when should I use each?
RAG is generally the better first choice when you need a model to answer questions using specific, current, or frequently changing information, since it does not require retraining and is easy to update. Fine tuning, including LoRA based fine tuning, is better suited to changing how a model behaves, its tone, format, or domain specific reasoning style, rather than what facts it knows.
Can I build production ready AI agents without a GPU?
Yes, as long as you are calling hosted LLM APIs rather than running your own model locally. A GPU becomes necessary mainly when you want to fine tune an open source model yourself or run large open models locally for cost or privacy reasons.
Generative AI and Agentic AI are no longer experimental technologies confined to research labs. They are practical, Python driven skills that are already changing how software gets built and how businesses operate. The path from writing your first prompt to deploying a multi agent system that plans, reasons, and acts is very learnable, one project at a time. Start with the fundamentals, build small, working examples like the ones in this guide, and progressively layer in RAG, tool use, multi agent orchestration, and evaluation as your projects demand it.