सहायक से स्वायत्त एजेंट तक
चैटबॉट से पूर्णतः स्वायत्त एजेंट तक का विस्तार: हर चरण में क्या बदलता है।
सहायक से स्वायत्त एजेंट तक, CoddyKit पर AI एजेंट का एक निःशुल्क पाठ है। यह 4 में से 1वाँ पाठ है। आप नीचे पूरा पाठ निःशुल्क पढ़ सकते हैं—फिर अंतर्निहित कोड संपादक और 24/7 एआई ट्यूटर के साथ ब्राउज़र में इसका व्यावहारिक अभ्यास कर सकते हैं। यह AI एजेंट सीखने के मार्ग का हिस्सा है और आपकी प्रगति वेब तथा CoddyKit ऐप पर सिंक होती रहती है। AI एजेंट पाठ्यक्रम में कुल 4 पाठ शामिल हैं।
स्वायत्तता का स्पेक्ट्रम
एआई प्रणालियाँ पूरी तरह प्रतिक्रियाशील से लेकर पूरी तरह स्वायत्त तक के स्पेक्ट्रम पर स्थित होती हैं। इस स्पेक्ट्रम पर आपका एजेंट कहाँ स्थित है, यह समझने से तय होता है कि उसे किन स्थापत्य घटकों की आवश्यकता है, कितनी मानवीय निगरानी चाहिए और किन विफलता-स्थितियों की आशंका रखनी चाहिए।
स्तर 1: शुद्ध चैटबॉट
एक शुद्ध चैटबॉट संदेशों का उत्तर पाठ के साथ देता है। वर्तमान संदर्भ विंडो से आगे उसकी कोई स्मृति नहीं होती, उसके पास कोई टूल या लक्ष्य नहीं होता और वह दुनिया में कोई कार्रवाई नहीं कर सकता। हर संवाद स्थिति-रहित होता है। मानवीय निगरानी की आवश्यकता: न्यूनतम — यह केवल पाठ तैयार कर सकता है, कार्रवाई नहीं।
import anthropic
# Level 1: Pure chatbot — single turn, no memory, no tools
def pure_chatbot(user_message: str) -> str:
client = anthropic.Anthropic(api_key='YOUR_API_KEY')
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=512,
messages=[{'role': 'user', 'content': user_message}]
)
return response.content[0].text
# What it has:
# - Language understanding
# - Knowledge from training
# What it lacks:
# - Memory (no history between sessions)
# - Tools (cannot access external data)
# - Goals (no objective to pursue)
# - Proactivity (only responds, never initiates)
response = pure_chatbot('What is the capital of Australia?')
print(response)स्तर 2: टूल-संवर्धित एजेंट
टूल-संवर्धित एजेंट बाहरी क्षमताएँ जोड़ता है: वेब खोज, डेटाबेस क्वेरी, कोड निष्पादन और एपीआई कॉल। यह ऐसे प्रश्नों के उत्तर दे सकता है जिनके लिए ताज़ा डेटा आवश्यक हो। स्मृति किसी सत्र के भीतर बनी रह सकती है। मानवीय निगरानी की आवश्यकता: मध्यम — यह डेटा पढ़ सकता है, लेकिन कार्रवाइयाँ आम तौर पर केवल-पठन या कम-जोखिम वाली होती हैं।
import anthropic
# Level 2: Tool-augmented agent
def tool_augmented_agent(user_message: str, conversation_history: list) -> str:
client = anthropic.Anthropic(api_key='YOUR_API_KEY')
tools = [
{
'name': 'search_web',
'description': 'Search the web for current information',
'input_schema': {'type': 'object',
'properties': {'query': {'type': 'string'}},
'required': ['query']}
}
]
conversation_history.append({'role': 'user', 'content': user_message})
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=1024,
tools=tools,
messages=conversation_history
)
# Handle tool use...
return response.content[-1].text if response.stop_reason == 'end_turn' else '[tool called]'
# What changed vs Level 1:
# + Tools (external data access)
# + Session memory (conversation history)
# Still lacking:
# - Persistent cross-session memory
# - Goals (still reactive)
# - Proactivityस्तर 3: लक्ष्य-निर्देशित एजेंट
लक्ष्य-निर्देशित एजेंट कई चरणों में किसी निर्धारित उद्देश्य को पूरा करता है और टूल कॉल के बीच स्थिति बनाए रखता है। उसके पास एक योजनाकार होता है, जो लक्ष्य को उप-कार्यों में विभाजित करता है। मानवीय निगरानी की आवश्यकता: महत्वपूर्ण — यह कई चरणों वाली कार्रवाइयाँ करता है, जिनका वास्तविक दुनिया पर संचयी प्रभाव पड़ सकता है।
# Level 3: Goal-directed agent
class GoalDirectedAgent:
def __init__(self, goal: str, tools: list, client):
self.goal = goal
self.tools = tools
self.client = client
self.memory = [] # persistent across steps
self.plan = self._make_plan()
def _make_plan(self) -> list:
response = self.client.messages.create(
model='claude-opus-4-5', max_tokens=512,
messages=[{'role': 'user', 'content':
f'Goal: {self.goal}\n'
'Create a numbered list of steps to achieve this goal. '
'Each step should be a single tool call or reasoning step.'
}]
)
return response.content[0].text
def step(self) -> str:
# Execute next planned step
return 'step executed'
# What changed vs Level 2:
# + Goal: has an objective to pursue
# + Planning: decomposes goal into sub-tasks
# + Persistent memory across steps
# Still lacking:
# - Self-directed (still initiated by human)
# - Self-improvement
if __name__ == '__main__':
class FakeContent:
def __init__(self, text):
self.text = text
class FakeResponse:
def __init__(self, text):
self.content = [FakeContent(text)]
class FakeMessages:
def create(self, **kwargs):
return FakeResponse('1. Search web for topic\n2. Summarize findings\n3. Draft report')
class FakeClient:
def __init__(self):
self.messages = FakeMessages()
agent = GoalDirectedAgent(goal='Write a market report', tools=[], client=FakeClient())
print('Goal:', agent.goal)
print('Plan:')
print(agent.plan)
स्तर 4: स्व-निर्देशित एजेंट
स्व-निर्देशित एजेंट अपने उप-लक्ष्य स्वयं तय करता है, प्रासंगिक घटनाओं के लिए अपने परिवेश की निगरानी करता है और मानवीय निर्देश के बिना कार्रवाइयाँ शुरू करता है। उसके पास दीर्घकालिक स्मृति और विश्व मॉडल होता है तथा परिस्थितियाँ बदलने पर वह नई योजना बना सकता है। मानवीय निगरानी की आवश्यकता: उच्च — यह स्वायत्त रूप से कार्रवाइयाँ शुरू करता है।
import time
# Level 4: Self-directed agent (simplified sketch)
class SelfDirectedAgent:
def __init__(self, mission: str, client):
self.mission = mission
self.client = client
self.goals_queue = []
self.long_term_memory = []
self.running = False
def start(self):
self.running = True
self._generate_initial_goals()
while self.running:
self._observe_environment()
self._prioritise_goals()
if self.goals_queue:
goal = self.goals_queue.pop(0)
self._pursue_goal(goal)
time.sleep(60) # autonomous monitoring loop
def _observe_environment(self):
# Agent monitors for events without being asked
print('Observing environment...')
def _generate_initial_goals(self):
# Agent decomposes its mission into actionable goals
self.goals_queue = ['Monitor inbox', 'Check project status']
def _prioritise_goals(self):
# Agent re-orders goals based on new observations
pass
def _pursue_goal(self, goal: str):
print(f'Pursuing: {goal}')
if __name__ == '__main__':
agent = SelfDirectedAgent(mission='Manage my inbox proactively', client=None)
agent._generate_initial_goals()
print('Initial goals:', agent.goals_queue)
agent._observe_environment()
goal = agent.goals_queue.pop(0)
agent._pursue_goal(goal)
हर स्तर पर क्या बदलता है: स्मृति
स्वायत्तता के स्तर के साथ स्मृति की आवश्यकताएँ बढ़ती हैं। स्तर 1 केवल संदर्भ विंडो (सत्र स्मृति) का उपयोग करता है। स्तर 2 स्थायी सत्र इतिहास जोड़ता है। स्तर 3 संरचित कार्य स्थिति जोड़ता है। स्तर 4 के लिए प्रासंगिक स्मृति (क्या हुआ), अर्थगत स्मृति (एजेंट क्या जानता है) और प्रक्रियात्मक स्मृति (काम कैसे करने हैं) आवश्यक होती है।
MEMORY_BY_LEVEL = {
'L1_chatbot': {
'scope': 'context_window_only',
'persistence': 'none',
'implementation': 'messages list in current API call'
},
'L2_tool_augmented': {
'scope': 'session',
'persistence': 'in-memory (lost on restart)',
'implementation': 'conversation_history list'
},
'L3_goal_directed': {
'scope': 'task',
'persistence': 'persists for task duration',
'implementation': 'SQLite or Redis with task state'
},
'L4_self_directed': {
'scope': 'long_term',
'persistence': 'indefinite',
'implementation': 'vector DB (episodic) + structured DB (semantic) + prompt cache (procedural)'
}
}
for level, info in MEMORY_BY_LEVEL.items():
print(f'{level}: {info["implementation"]}')हर स्तर पर क्या बदलता है: योजना
स्वायत्तता के साथ योजना की आवश्यकताएँ भी बढ़ती हैं। स्तर 1 में कोई योजना नहीं होती। स्तर 2 एक-चरणीय तर्क कर सकता है। स्तर 3 बहु-चरणीय योजना (विचार-श्रृंखला, ReAct) का उपयोग करता है। स्तर 4 के लिए विफलता पर पुनः-योजना बनाने वाली पदानुक्रमित योजना आवश्यक होती है।
PLANNING_BY_LEVEL = {
'L1': 'None — single response',
'L2': 'Single-step tool selection (which tool to call now)',
'L3': 'Multi-step plan (goal -> ordered sub-tasks -> tool calls)',
'L4': 'Hierarchical plan (mission -> goals -> tasks -> actions) + replan on failure'
}
# L3 multi-step planning example:
def plan_goal(goal: str, client) -> list:
import anthropic
response = client.messages.create(
model='claude-opus-4-5', max_tokens=512,
messages=[{'role': 'user', 'content':
f'Break this goal into 3-5 concrete steps:\nGoal: {goal}\n'
'Return JSON: {"steps": [{"step": int, "action": str, "tool": str}]}'
}]
)
import json
return json.loads(response.content[0].text)
for lvl, desc in PLANNING_BY_LEVEL.items():
print(f'{lvl}: {desc}')स्तर के अनुसार मानवीय निगरानी की आवश्यकताएँ
जैसे-जैसे स्वायत्तता बढ़ती है, वैसे-वैसे मानवीय निगरानी तंत्रों की आवश्यकता भी बढ़ती है। स्तर 1 को लगभग किसी निगरानी की आवश्यकता नहीं होती। स्तर 4 के लिए स्पष्ट निगरानी संरचना आवश्यक है: अनुमोदन द्वार, कार्रवाई लॉग, व्यवधान तंत्र और असामान्यता पहचान।
OVERSIGHT_BY_LEVEL = {
'L1_chatbot': [
'None required (output only)'
],
'L2_tool_augmented': [
'Review tool permissions (read-only vs write)',
'Audit logs of tool calls'
],
'L3_goal_directed': [
'Human approval before irreversible actions',
'Plan review before execution starts',
'Progress checkpoints',
'Full audit trail'
],
'L4_self_directed': [
'Human approval before high-impact actions',
'Real-time action streaming to oversight dashboard',
'Emergency stop mechanism',
'Anomaly detection on goal drift',
'Regular review of long-term memory state',
'Corrigibility: agent must accept shutdown'
]
}
for level, requirements in OVERSIGHT_BY_LEVEL.items():
print(f'{level}:')
for req in requirements:
print(f' - {req}')सक्रिय पहल: मुख्य बदलाव
सहायक से स्वायत्त एजेंट बनने की सबसे बुनियादी दिशा-परिवर्तन सक्रिय पहल है। सहायक प्रतीक्षा करता है। एजेंट पहल करता है। इसका अर्थ है कि एजेंट को अपने परिवेश की निगरानी करनी होगी, प्रासंगिक घटनाओं को पहचानना होगा और बिना निर्देश के कार्रवाई करने का निर्णय लेना होगा।
# Proactive monitoring pattern
import asyncio
from datetime import datetime
class ProactiveMonitor:
def __init__(self, agent_fn, check_fn, interval_seconds: int = 60):
self.agent_fn = agent_fn
self.check_fn = check_fn
self.interval = interval_seconds
async def run(self):
print(f'Proactive monitor started, checking every {self.interval}s')
while True:
try:
events = await self.check_fn()
for event in events:
print(f'[{datetime.utcnow().isoformat()}] Event: {event}')
await self.agent_fn(event)
except Exception as e:
print(f'Monitor error: {e}')
await asyncio.sleep(self.interval)
# Example: agent monitors for new emails every 5 minutes
# and proactively drafts replies or flags urgent ones
async def example_setup():
monitor = ProactiveMonitor(
agent_fn=lambda e: print(f'Agent handling: {e}'),
check_fn=lambda: [], # replace with real inbox check
interval_seconds=300
)
# await monitor.run()
if __name__ == '__main__':
import asyncio
async def demo():
async def check_fn():
return ['New email from boss@example.com']
async def agent_fn(event):
print(f'Agent drafting reply for: {event}')
monitor = ProactiveMonitor(agent_fn=agent_fn, check_fn=check_fn, interval_seconds=1)
try:
await asyncio.wait_for(monitor.run(), timeout=0.3)
except asyncio.TimeoutError:
pass
asyncio.run(demo())
स्तर के अनुसार त्रुटि-सुधार
त्रुटि-सुधार की आवश्यकताएँ भी स्तर के साथ बढ़ती हैं। चैटबॉट केवल क्षमा माँगता है। टूल एजेंट टूल कॉल का फिर से प्रयास करता है। लक्ष्य एजेंट विफल चरण के आसपास नई योजना बनाता है। स्व-निर्देशित एजेंट स्वायत्त रूप से त्रुटियों का पता लगाता है, उनका वर्गीकरण करता है और उन्हें उच्च स्तर तक भेजता है तथा भविष्य में उसी विफलता से बचने के लिए अपने विश्व मॉडल को अद्यतित करता है।
# Error recovery strategies by autonomy level
def chatbot_error_recovery(error: Exception) -> str:
return 'I\'m sorry, I encountered an error. Please try again.'
def tool_agent_error_recovery(tool_name: str, error: Exception, retries: int) -> str:
if retries < 3:
return f'Retrying {tool_name} ({retries+1}/3)'
return f'Tool {tool_name} unavailable after 3 retries, skipping'
def goal_agent_error_recovery(failed_step: dict, plan: list, client) -> list:
import anthropic, json
client_obj = anthropic.Anthropic(api_key='YOUR_API_KEY')
response = client_obj.messages.create(
model='claude-opus-4-5', max_tokens=256,
messages=[{'role': 'user', 'content':
f'Step failed: {failed_step}\nRemaining plan: {plan}\n'
'Revise the remaining plan to work around the failure. Return JSON plan.'
}]
)
return json.loads(response.content[0].text)
print('Error recovery patterns defined for each autonomy level')सही स्तर चुनना
हर उपयोग-स्थिति के लिए स्तर 4 आवश्यक नहीं होता। अपनी आवश्यकताएँ पूरी करने वाले सबसे निचले स्तर से शुरुआत करें और आवश्यकता पड़ने पर ही जटिलता बढ़ाएँ। अधिक स्वायत्तता का अर्थ है अधिक जटिलता, अधिक निगरानी-भार और अनपेक्षित व्यवहार की अधिक संभावना।
def recommend_autonomy_level(requirements: dict) -> str:
needs_realtime = requirements.get('realtime_data', False)
needs_multistep = requirements.get('multi_step_tasks', False)
needs_unsupervised = requirements.get('runs_unsupervised', False)
needs_initiative = requirements.get('initiates_actions', False)
if needs_initiative and needs_unsupervised:
return 'L4_self_directed (high oversight required)'
if needs_multistep:
return 'L3_goal_directed (plan review recommended)'
if needs_realtime:
return 'L2_tool_augmented (audit logs required)'
return 'L1_chatbot (minimal oversight)'
# Examples:
print(recommend_autonomy_level({
'realtime_data': True, 'multi_step_tasks': False,
'runs_unsupervised': False, 'initiates_actions': False
}))
print(recommend_autonomy_level({
'realtime_data': True, 'multi_step_tasks': True,
'runs_unsupervised': True, 'initiates_actions': True
}))ज्ञान जाँच
लक्ष्य-निर्देशित एजेंट (स्तर 3) और स्व-निर्देशित एजेंट (स्तर 4) के बीच सबसे बुनियादी क्षमता का अंतर क्या है?
पुनरावलोकन: सहायक से स्वायत्त एजेंट तक
बहुत बढ़िया! आपने यह सीखा:
- L1 चैटबॉट: प्रतिक्रियाशील, केवल पाठ, कोई स्मृति नहीं, निगरानी की आवश्यकता नहीं
- L2 टूल-संवर्धित: सत्र स्मृति, टूल कॉल, मध्यम निगरानी
- L3 लक्ष्य-निर्देशित: बहु-चरणीय योजना, कार्य-सीमित स्मृति, अनुमोदन द्वार
- L4 स्व-निर्देशित: सक्रिय पहल, दीर्घकालिक स्मृति, पदानुक्रमित योजना, उच्च निगरानी
- सामान्य नियम: आवश्यकताएँ पूरी करने वाले सबसे निचले स्तर से शुरुआत करें
अगला पाठ: विश्व मॉडल और पूर्वानुमानात्मक योजना — एजेंट कार्रवाई से पहले अनुकरण कैसे करते हैं।
एआई शिक्षक के साथ AI एजेंट सीखें — निःशुल्क
अपने ब्राउज़र में वास्तविक कोड लिखें और चलाएँ, चौबीसों घंटे एआई शिक्षक से तुरंत सहायता पाएँ, और वेब या ऐप पर वहीं से शुरू करें जहाँ आपने छोड़ा था।
- पाठ्यक्रम
- 60
- पाठ
- 239
अक्सर पूछे जाने वाले प्रश्न
क्या “सहायक से स्वायत्त एजेंट तक” पाठ निःशुल्क है?
हाँ—“सहायक से स्वायत्त एजेंट तक” का पूरा पाठ यहाँ वेब पर निःशुल्क पढ़ा जा सकता है। इंटरैक्टिव अभ्यास (अंतर्निहित कोड संपादक और 24/7 एआई ट्यूटर) करने और AI एजेंट पाठ्यक्रम का बाकी हिस्सा अनलॉक करने के लिए CoddyKit PRO लें। AI एजेंट पाठ्यक्रम में कुल 4 पाठ शामिल हैं।
“सहायक से स्वायत्त एजेंट तक” में मैं क्या सीखूँगा?
चैटबॉट से पूर्णतः स्वायत्त एजेंट तक का विस्तार: हर चरण में क्या बदलता है। आप ब्राउज़र में सीधे चलाए जाने वाले व्यावहारिक कोड के साथ AI एजेंट का अभ्यास करते हैं, और पाठ पूरा करते समय 24/7 एआई ट्यूटर आपके प्रश्नों के उत्तर देता है।
क्या AI एजेंट शुरू करने के लिए मुझे किसी अनुभव की आवश्यकता है?
पहले के अनुभव की आवश्यकता नहीं है। CoddyKit पर AI एजेंट शुरुआती से लेकर उन्नत शिक्षार्थियों तक सभी के लिए व्यवस्थित किया गया है, इसलिए आप यहीं से या शुरुआत से सीखना शुरू कर सकते हैं और अपनी गति से आगे बढ़ सकते हैं। यह 4 में से 1वाँ पाठ है।
“सहायक से स्वायत्त एजेंट तक” पाठ पूरा करने में कितना समय लगता है?
CoddyKit का अधिकांश पाठ लगभग 5–10 मिनट में पूरा हो जाता है। हर पाठ छोटा और संवादात्मक है, इसलिए आप लगातार प्रगति करते हैं और वेब या ऐप पर वहीं से सीखना जारी रख सकते हैं जहाँ आपने छोड़ा था।
क्या मैं इस AI एजेंट पाठ में कोड लिख और चला सकता हूँ?
हाँ। हर AI एजेंट पाठ में एक अंतर्निर्मित कोड संपादक शामिल है, जिससे आप सीधे अपने ब्राउज़र में वास्तविक कोड लिख और चला सकते हैं और तुरंत एआई प्रतिक्रिया पा सकते हैं—स्थानीय सेटअप की आवश्यकता नहीं है।
इस पाठ्यक्रम के सभी पाठ
- सहायक से स्वायत्त एजेंट तक
- विश्व मॉडल और पूर्वानुमानित योजना
- स्वायत्त एजेंटों में संरेखण की चुनौतियाँ
- शोध की सीमाएँ: AGI और उससे आगे