Koruyucu Kurallar ve Güvenli Aracı Davranışı
Zararlı veya istenmeyen eylemleri önlemek için giriş ve çıkış doğrulama, içerik filtreleme ve kısıtlı araç erişimi dâhil olmak üzere yapay zeka etmenleri için pratik güvenlik sınırları uygulayın.
Koruyucu Kurallar ve Güvenli Aracı Davranışı, CoddyKit'te ücretsiz bir AI Agents with LangChain & Autonomous Workflows dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, AI Agents with LangChain & Autonomous Workflows öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. AI Agents with LangChain & Autonomous Workflows kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
From Ethics to Engineering
Ethical principles need enforcement in code. Guardrails are the concrete controls that keep an agent within safe, intended boundaries at runtime.
They act on three points: the input, the model's reasoning, and the output or actions.
Input Guardrails
Check user input before it reaches the agent. Catch:
- Prompt-injection attempts
- Requests for disallowed topics
- Personal data that should be redacted
Detecting Prompt Injection
Prompt injection tries to override your instructions (e.g. ignore previous rules). A simple guard flags suspicious phrases before processing.
BAD = ['ignore previous', 'disregard instructions']
if any(p in user_input.lower() for p in BAD):
raise ValueError('Possible prompt injection')Output Guardrails
Validate what the agent produces before showing it. Block unsafe content, leaked secrets, or off-policy answers, replacing them with a safe fallback message.
if contains_sensitive(answer):
answer = 'I cannot share that information.'Structured Output Validation
When an agent must return JSON, validate it against a schema. Reject or repair malformed output so downstream systems never receive bad data.
from pydantic import BaseModel
class Ticket(BaseModel):
priority: str
summary: str
Ticket.model_validate_json(agent_output)Constraining Tool Access
The most dangerous actions come from tools. Give an agent only the tools it needs, and scope each one — read-only where possible, with limits on what it can affect.
Allowlists Over Blocklists
Define what is permitted rather than chasing every bad case. An allowlist of approved domains, tables, or operations is far safer than trying to enumerate everything to forbid.
ALLOWED_DOMAINS = {'docs.company.com'}
if domain not in ALLOWED_DOMAINS:
raise PermissionError('Domain not allowed')Moderation Models
Provider moderation endpoints classify text for harmful categories. Run inputs and outputs through them as an extra safety layer.
result = client.moderations.create(input=text)
if result.results[0].flagged:
block()Limiting Autonomy
Cap how much an agent can do unattended: max iterations, max tool calls, spending limits, and human approval for high-impact actions. Bounded autonomy prevents runaway behavior.
agent = create_agent(llm, tools, max_iterations=8)Fail Safe, Not Open
When a guardrail is uncertain or a check errors, default to the safe choice — refuse or escalate — rather than letting the action through. A blocked safe request is better than an executed harmful one.
Logging and Review
Log every guardrail trigger. Reviewing these reveals attack patterns and false positives, letting you tune rules over time without weakening safety.
Quick Check
Test your guardrails knowledge.
Recap
You learned to engineer safe agent behavior:
- Add input and output guardrails
- Detect prompt injection and validate structured output
- Constrain tool access with allowlists and scoping
- Use moderation, limit autonomy, and fail safe
- Log and review every trigger
Guardrails turn ethical intent into enforced, trustworthy agents.
Yapay zeka eğitmeniyle AI Agents with LangChain & Autonomous Workflows öğren — ücretsiz
Tarayıcında gerçek kod yaz ve çalıştır, 7/24 yapay zeka eğitmeninden anında yardım al; web'de ya da uygulamada kaldığın yerden devam et.
- Kurslar
- 12
- Dersler
- 50
Sıkça Sorulan Sorular
“Koruyucu Kurallar ve Güvenli Aracı Davranışı” dersi ücretsiz mi?
Evet — “Koruyucu Kurallar ve Güvenli Aracı Davranışı” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve AI Agents with LangChain & Autonomous Workflows kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. AI Agents with LangChain & Autonomous Workflows kursu toplamda 4 dersten oluşur.
“Koruyucu Kurallar ve Güvenli Aracı Davranışı” dersinde ne öğreneceğim?
Zararlı veya istenmeyen eylemleri önlemek için giriş ve çıkış doğrulama, içerik filtreleme ve kısıtlı araç erişimi dâhil olmak üzere yapay zeka etmenleri için pratik güvenlik sınırları uygulayın. AI Agents with LangChain & Autonomous Workflows ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
AI Agents with LangChain & Autonomous Workflows öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te AI Agents with LangChain & Autonomous Workflows, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.
“Koruyucu Kurallar ve Güvenli Aracı Davranışı” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu AI Agents with LangChain & Autonomous Workflows dersinde kod yazıp çalıştırabilir miyim?
Evet. Her AI Agents with LangChain & Autonomous Workflows dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Yapay Zeka Ajanlarında Etik Konular
- Önyargı, Adalet ve Şeffaflık
- Yeni Ortaya Çıkan Eğilimler ve Araştırmalar
- Koruyucu Kurallar ve Güvenli Aracı Davranışı