Agentic AI Foundations

1. AI application vs AI model — difference ఏంటి?

సింపుల్‌గా చెప్పాలి అంటే, Gemini/ChatGPT లాంటి products are AI applications. వాటి లోపల ఒకటి లేదా ఎక్కువ AI models ఉంటాయి. Model answer generate చేయగలదు, కానీ complete application అవ్వడానికి UI, backend, login, payment, database, monitoring, rate limits, security, user history, file uploads, APIs — ఇవన్నీ కావాలి.

Model ని “brain” అనుకుంటే, application అనేది “brain + body + workflow + rules”. Brain ఒక్కటే ఉంటే user కి usable product రాదు.

ఎందుకు ఈ separation వచ్చింది?
Early software mostly rule-based. Developer every behavior code లో రాస్తారు. కానీ natural language questions కి fixed rules సరిపోవు. అందుకే AI model ని application లో ఒక intelligent component లాగా integrate చేయడం మొదలైంది.

ఎలా build చేస్తారు?

  1. Frontend user question తీసుకుంటుంది
  2. Backend ఆ request ని receive చేస్తుంది
  3. అవసరమైతే database/tools/RAG నుంచి context తెస్తుంది
  4. AI model కి prompt పంపుతుంది
  5. Model response ఇస్తుంది
  6. Application response ని format చేసి user కి చూపిస్తుంది

Use case:
Telusko chatbot లో user “AI course ఏది start చేయాలి?” అని అడిగితే, application user question తీసుకుని, Telusko course data fetch చేసి, model ద్వారా natural answer generate చేయాలి. Model alone random answer ఇవ్వచ్చు; application logic దాన్ని controlled answer గా మార్చుతుంది.

Real-world point:
Production AI app లో model quality మాత్రమే కాదు — latency, cost, privacy, fallback, logging, evaluation ఇవన్నీ equally important.

2. LLM prediction చేస్తుంది, database lookup కాదు

LLM అంటే Large Language Model. ఇది normal database లాగా exact row fetch చేయదు. ఇది text patterns నేర్చుకుని next token prediction చేస్తుంది. మన keyboard suggestions చిన్న scale లో ఎలా work అవుతాయో, LLM huge scale లో అలాగే but much more advanced గా work చేస్తుంది.

ఎందుకు develop చేయాల్సి వచ్చింది?
Human language చాలా flexible. “Python explain చేయి”, “Python అంటే ఏంటి?”, “Python beginner కి ఎలా చెప్తావు?” — meaning దగ్గరగా ఉన్నా wording different. ప్రతి possible wording కి code రాయడం impossible. అందుకే model ని huge examples మీద train చేసి language patterns నేర్పిస్తారు.

ఎలా చేస్తారు?

  1. Huge text corpus collect చేస్తారు
  2. Text ని tokens గా split చేస్తారు
  3. Model కి “given previous tokens, next token ఏమై ఉండొచ్చు?” అనే task మీద train చేస్తారు
  4. Training లో billions/trillions parameters adjust అవుతాయి
  5. Inference time లో user prompt చూసి next tokens generate చేస్తుంది

Important reasoning:
Model “understanding” అనేది human understanding లాంటిదా కాదా అనేది philosophical debate. Practical engineering view లో మాత్రం model patterns capture చేసి useful outputs ఇస్తుంది.

Use case:
User “resume summary improve చేయి” అంటే model grammar, tone, professional wording patterns use చేసి better summary generate చేస్తుంది.

3. Hallucination — confident గా wrong answer ఇవ్వడం

Hallucination అంటే AI confident గా wrong/fake answer ఇవ్వడం. ఇది “model bad” అని మాత్రమే కాదు; model design nature వల్ల వచ్చే limitation. Model truth verify చేయకుండా likely text generate చేస్తుంది.

ఎందుకు జరుగుతుంది?

  • Prompt లో enough context లేకపోవడం
  • Model training data లో fact లేకపోవడం
  • User question ambiguous గా ఉండడం
  • Model కి “answer తప్పనిసరిగా ఇవ్వాలి” అన్న pressure ఉండడం
  • External verification లేకపోవడం

ఎందుకు dangerous?

  • Medical/legal/finance domains లో wrong answer big risk
  • Company policy chatbot wrong policy చెప్పొచ్చు
  • Developer కి fake library/function suggest చేయొచ్చు
  • Student కి wrong concept confidently నేర్పొచ్చు

ఎలా handle చేస్తారు?

  • RAG: trusted documents నుంచి context ఇచ్చి answer చేయించడం
  • Tool calling: live API/database నుంచి facts తెప్పించడం
  • Prompt constraints: “Context లో లేకపోతే తెలియదు అని చెప్పు”
  • Citations: answer ఏ document మీద based ఉందో చూపించడం
  • Human review: high-risk outputs manual review చేయించడం
  • Validation: output schema, business rules, factual checks apply చేయడం

Use case:
Company HR bot “paid leave policy” గురించి answer ఇవ్వాలి. Base LLM మీద depend అయితే hallucination risk. HR policy PDF నుంచి RAG context retrieve చేసి answer చేస్తే grounded response వస్తుంది.

4. Knowledge cutoff and tool calling

Model ఒక time వరకు train అవుతుంది. ఆ తర్వాత జరిగిన events model memory లో ఉండవు. దీనినే knowledge cutoff అంటారు. కానీ tools ఉంటే model live information తీసుకోగలదు.

Tool calling అంటే ఏంటి?
LLM కి outside systems ని call చేసే ability ఇవ్వడం. Model “నాకు current date కావాలి”, “calendar check చేయాలి”, “database query చేయాలి”, “calculator use చేయాలి” అని decide చేసి tool call చేస్తుంది.

ఎందుకు develop చేయాల్సి వచ్చింది?

  • World data changes every second
  • Model retrain చేయడం costly and slow
  • Company private data model training లో ఉండదు
  • Some tasks require action, not just answer

ఎలా works?

  1. User request వస్తుంది
  2. Model intent అర్థం చేసుకుంటుంది
  3. Available tools list చూస్తుంది
  4. సరైన tool choose చేస్తుంది
  5. Tool కి structured input ఇస్తుంది
  6. Tool result తిరిగి model కి వస్తుంది
  7. Model final answer/action చేస్తుంది

Use cases:

  • “నా next meeting ఎప్పుడు?” → Calendar tool
  • “ఈ order status ఏంటి?” → Database/API tool
  • “ఈ calculation correct ఆ?” → Calculator tool
  • “GitHub లో issue create చేయి” → GitHub tool

Important point:
Tool calling వల్ల model “knowledge source” కాకుండా “reasoning + orchestration layer” అవుతుంది.

5. Tokens, token IDs, vectors/embeddings — language ని numbers గా మార్చడం

LLM text ని direct గా process చేయదు. Text first tokens గా split అవుతుంది. Token word కావచ్చు, word part కావచ్చు, punctuation కూడా కావచ్చు.

Example:

  • “unbelievable” ఒక token కావచ్చు లేదా “un”, “believ”, “able” లా multiple tokens కావచ్చు
  • “Explain Java collections” multiple tokens అవుతుంది

Flow:

  1. Text → tokens
  2. Tokens → token IDs
  3. Token IDs → embeddings/vectors
  4. Vectors → Transformer layers
  5. Output tokens → final text

Embedding అంటే ఏంటి?
Embedding అంటే word/sentence meaning ని numbers list గా represent చేయడం. Similar meaning ఉన్న words vectors space లో దగ్గరగా ఉంటాయి.

Example:

  • “car” and “automobile” meanings similar, vectors close
  • “king” and “queen” relation meaningful గా capture అవుతుంది
  • “bank” meaning context బట్టి river/finance వైపు shift అవుతుంది

ఎందుకు develop చేయాల్సి వచ్చింది?
Computers numbers మీద operate చేస్తాయి. Language meaning ని mathematical form లోకి convert చేస్తే machine similarity, context, relationship analyze చేయగలదు.

Use case:
Search system లో user exact keyword use చేయకపోయినా similar meaning documents retrieve చేయగలము. ఇది RAG కి base.

6. Transformer architecture — modern LLMs కి core engine

Transformer architecture 2017 “Attention is All You Need” paper వల్ల popular అయింది. ChatGPT, Gemini, Claude లాంటి systems Transformer family మీద based.

Old problem ఏంటి?
Older sequence models long context handle చేయడం లో weak. Sentence లో earlier word later meaning ని affect చేస్తే capture చేయడం difficult.

Example:

“The trophy doesn’t fit in the suitcase because it is too small.”
ఇక్కడ “it” suitcase ని refer చేస్తుంది. Context understand చేయాలి.

Attention mechanism అంటే?
Model ప్రతి token processing సమయంలో, sentence లోని other tokens లో ఏవి important అనేది weight చేస్తుంది. దీనివల్ల context relationships capture అవుతాయి.

ఎలా high level లో work చేస్తుంది?

  1. Tokens embeddings గా convert అవుతాయి
  2. Positional information add చేస్తారు — word order తెలియాలి కాబట్టి
  3. Attention layers relevant tokens మీద focus చేస్తాయి
  4. Feed-forward layers meaning refine చేస్తాయి
  5. Multiple layers repeat అవుతాయి
  6. Final layer next token probabilities ఇస్తుంది

Use case:
Long prompt లో “answer Telugu-English mix లో ఇవ్వు” అని beginning లో చెప్పినా, later answer అంతా ఆ style follow చేయడానికి context tracking ఉపయోగపడుతుంది.

7. Token cost — AI app economics

LLM APIs tokens basis లో charge చేస్తాయి. Input tokens + output tokens cost. Long conversation, large documents, verbose outputs — ఇవన్నీ cost increase చేస్తాయి.

ఎందుకు important?
Prototype లో cost small గా కనిపిస్తుంది. But 10,000 users daily use చేస్తే cost suddenly huge అవుతుంది.

Cost పెరగడానికి reasons:

  • Long chat history repeatedly send చేయడం
  • Unnecessary full documents prompt లో పెట్టడం
  • Very large output generate చేయించడం
  • Expensive model simple tasks కి use చేయడం
  • RAG retrieval too many chunks పంపించడం

How to manage?

  • Conversation summary maintain చేయడం
  • Relevant chunks only send చేయడం
  • Small model for simple tasks, big model for complex tasks
  • Max tokens limit పెట్టడం
  • Caching use చేయడం
  • Prompt concise గా design చేయడం
  • Evaluation ద్వారా unnecessary steps remove చేయడం

Use case:
Customer support bot లో greeting, simple FAQ కి cheaper model. Complex escalation కి stronger model. ఇలా routing చేస్తే cost control అవుతుంది.

8. RAG — company/private data తో grounded answers

RAG full form Retrieval-Augmented Generation. ఇది LLM ని company knowledge తో connect చేసే practical pattern.

Problem:
Base LLM కి company internal docs తెలియవు. Also model guess చేస్తే hallucination. Company-specific answers కి trusted source కావాలి.

RAG pipeline:

  1. Documents collect చేస్తారు — PDFs, Notion pages, website docs, DB records
  2. Text clean చేస్తారు
  3. Text ని chunks గా split చేస్తారు
  4. ప్రతి chunk కి embedding generate చేస్తారు
  5. Vector DB లో embeddings + metadata store చేస్తారు
  6. User query embedding generate చేస్తారు
  7. Similar chunks retrieve చేస్తారు
  8. Retrieved context prompt లో model కి ఇస్తారు
  9. Model context ఆధారంగా answer generate చేస్తుంది

Chunking ఎందుకు important?
Full document model కి పంపితే costly and noisy. చిన్న meaningful chunks అయితే relevant information retrieve అవుతుంది.

Metadata ఎందుకు?
Document title, date, department, access permissions వంటి metadata filtering కి ఉపయోగపడుతుంది.

Use case:
Telusko chatbot: “Agentic AI course లో MCP ఎప్పుడు వస్తుంది?” అని అడిగితే, course notes/docs నుంచి MCP related chunks retrieve చేసి answer ఇవ్వాలి.

Limitation:
RAG కూడా perfect కాదు. Bad chunking, old documents, wrong retrieval, missing permissions ఉంటే answer quality పడిపోతుంది.

9. Vector DB — meaning-based search engine

Vector DB embeddings store చేసి similarity search చేస్తుంది. Traditional DB exact match కి strong; Vector DB semantic match కి strong.

ఎందుకు కావాలి?
User language and document language same ఉండకపోవచ్చు.

Example:

  • Document: “refund eligibility”
  • User: “money back rules”
  • Keyword search miss అవ్వచ్చు
  • Vector search meaning match చేయగలదు

Vector DB లో usually ఏమి store చేస్తారు?

  • embedding vector
  • original text chunk
  • source document URL/id
  • metadata
  • permissions info
  • timestamps/version info

Search ఎలా జరుగుతుంది?

  1. User query embedding అవుతుంది
  2. Vector DB nearest vectors find చేస్తుంది
  3. Top K chunks return చేస్తుంది
  4. Model వాటిని context గా use చేస్తుంది

Use cases:

  • Internal knowledge assistant
  • Product documentation search
  • Legal document Q&A
  • Course recommendation bot
  • Support ticket similarity search

10. MCP — tools integration కి common standard

MCP అంటే Model Context Protocol. ఇది agents/tools మధ్య communication కి standard interface ఇవ్వడానికి useful.

Problem before MCP:
ప్రతి tool integration custom. GitHub కి ఒక style, Slack కి ఒక style, database కి ఇంకొక style. Agent developers కి integration maintenance burden.

MCP idea:
Tools ని standardized way లో expose చేయాలి. Agent tools list తెలుసుకుని, required tool call చేయాలి.

ఎలా use చేస్తారు?

  1. MCP server tools provide చేస్తుంది
  2. Agent available tools discover చేస్తుంది
  3. User intent బట్టి right tool select చేస్తుంది
  4. Tool input structured గా పంపుతుంది
  5. Tool output తీసుకుని reasoning continue చేస్తుంది

Use cases:

  • GitHub repo read/write
  • Slack messages search/post
  • Database records query/update
  • File system read/write
  • CRM data fetch
  • Calendar scheduling

Important caution:
Tool calling actions dangerous కావచ్చు. Delete, send email, update database వంటి actions కి permissions, confirmations, audit logs అవసరం.

11. Prompt engineering — model behavior ని shape చేయడం

Prompt engineering అంటే model కి task, role, constraints, context, output format clearly చెప్పడం.

Bad prompt:
“Explain RAG.”

Better prompt:
“You are teaching a beginner. Explain RAG in Telugu-English mix, include why it was developed, how it works, one real company chatbot use case, and limitations. Use bullets.”

ఎందుకు important?
LLM flexible. Good prompts లేకపోతే output inconsistent. Application లో consistency కావాలి.

Good prompt components:

  • Role: “You are a senior AI engineer”
  • Audience: “Beginner software developers”
  • Context: “Based on these course notes”
  • Task: “Explain concepts”
  • Constraints: “Don’t invent facts”
  • Format: “Use headings and bullets”
  • Examples: one-shot/few-shot
  • Tone: “Colloquial Telugu-English mix”

Prompt techniques:

  • Zero-shot: example లేకుండా direct task
  • One-shot: ఒక example తో
  • Few-shot: multiple examples తో
  • Structured prompting: fixed JSON/table/bullets format
  • Constraint prompting: do/don’t rules
  • Contextual prompting: extra background ఇవ్వడం

Use case:
YouTube script generator లో title generation, title selection, script generation, script evaluation — ప్రతి step కి different prompt and role ఇవ్వడం వల్ల pipeline controlled అవుతుంది.

12. Agents — chatbot కంటే next level

Agent అంటే LLM + reasoning + memory/context + tools + goal-oriented workflow.

Chatbot vs Agent:

  • Chatbot mostly answer ఇస్తుంది
  • Agent task plan చేసి tools use చేసి action complete చేస్తుంది

Agent high-level loop:

  1. User goal understand చేస్తుంది
  2. Task ని steps గా break చేస్తుంది
  3. అవసరమైన data/tools identify చేస్తుంది
  4. Tool calls చేస్తుంది
  5. Results evaluate చేస్తుంది
  6. అవసరమైతే next step decide చేస్తుంది
  7. Final answer/action complete చేస్తుంది

Use case:
“నా meeting transcript నుంచి action items తీసుకుని task tracker లో create చేయి.”
Agent transcript read చేస్తుంది, action items extract చేస్తుంది, assignee/due date infer లేదా ask చేస్తుంది, task database లో rows create చేస్తుంది.

Important caution:
Agents autonomous కాబట్టి guardrails must: permissions, confirmations, rate limits, logging, rollback, user approval.

Leave a comment