
KI-Agenten sind autonome Softwaresysteme, die ihre Umgebung wahrnehmen, über Ziele nachdenken, Maßnahmen ergreifen und aus Ergebnissen lernen. Im Gegensatz zu herkömmlichen LLM-Anwendungen, die auf eine einzige Eingabeaufforderung reagieren, arbeiten Agenten in Schleifen – sie beobachten, denken, handeln und beobachten erneut –, bis ein Ziel erreicht ist.
KI-Agenten sind autonome Softwaresysteme, die ihre Umgebung wahrnehmen, über Ziele nachdenken, Maßnahmen ergreifen und aus Ergebnissen lernen. Im Gegensatz zu herkömmlichen LLM-Anwendungen, die auf eine einzige Eingabeaufforderung reagieren, arbeiten Agenten in Schleifen – sie beobachten, denken, handeln und beobachten erneut –, bis ein Ziel erreicht ist.
Im Jahr 2026 stellen KI-Agenten die Grenze der angewandten KI dar. Sie automatisieren komplexe mehrstufige Arbeitsabläufe, interagieren mit externen Tools und APIs, arbeiten mit anderen Agenten zusammen und treffen Entscheidungen in dynamischen Umgebungen.
┌──────────────────┐
│ Environment │
│ (APIs, files, │
│ databases, web) │
└────────┬─────────┘
│
Perception (observe) │ Action (effect)
┌───────────────────────┼───────────────────────┐
│ │ │
▼ │ ▼
┌─────────────────┐ │ ┌─────────────────┐
│ Sensors │ │ │ Tools │
│ (read input) │ │ │ (call APIs, │
│ │ │ │ write files) │
└────────┬────────┘ │ └────────▲────────┘
│ │ │
│ ┌──────▼──────────────────────┐ │
└─────────►│ Reasoner (LLM) ├─┘
│ (plan, decide, reflect) │
└─────────────────────────────┘
│
▼
┌──────────────────┐
│ Memory │
│ (history, state, │
│ learnings) │
└──────────────────┘
| Komponente | Beschreibung | Beispiel |
|---|---|---|
| Umwelt | Die Außenwelt, mit der der Agent interagiert | Web, Dateisystem, API, Datenbank |
| Sensoren | Wie der Agent die Umgebung wahrnimmt | Datei lesen, HTTP-Antwort, Benutzereingabe |
| Vernünftiger | Der LLM, der plant und entscheidet | GPT-4, Claude, Open-Source-Modell |
| Werkzeuge | Aktionen, die der Agent ausführen kann | Suche, Rechner, Codeausführung |
| Speicher | Kurzfristig (Konversation) + langfristig (Vektor-DB) | Chatverlauf, gelernte Fakten |
| Planung | Ziele in Schritte aufteilen | ReAct, Plan-and-Lose, Tree-of-Thought |
Das beliebteste Agentenmuster – verschachtelt Argumentationsspuren mit Aktionen:
User: "Book a flight to Paris next Tuesday for under $500"
Thought: I need to search for flights to Paris next Tuesday.
Action: search_flights(destination="Paris", date="2026-05-26")
Observation: Found flights: $450 (direct), $380 (1 stop), $520 (direct)
Thought: The $450 direct flight is under budget. I need to check if
the user has preferences for time.
Action: ask_user("Would you like the 7:00 AM direct for $450 or
the 11:00 AM direct for $520?")
Observation: User prefers morning.
Thought: Booking the 7:00 AM direct flight.
Action: book_flight(flight_id="AF1234", user_id="user_42")
Observation: Booking confirmed. Reference: BK-98765.
Thought: The task is complete. Let me summarize.
Response: I booked flight AF1234 to Paris on May 26 at 7:00 AM.
Total: $450. Booking reference: BK-98765.
class ReActAgent:
def __init__(self, llm, tools: list[Tool]):
self.llm = llm
self.tools = {t.name: t for t in tools}
self.max_steps = 20
def run(self, task: str) -> str:
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": task},
]
for step in range(self.max_steps):
# Reasoning step
response = self.llm.invoke(messages)
thought = response.content
# Check if final answer
if "FINAL ANSWER:" in thought:
return thought.split("FINAL ANSWER:")[-1].strip()
# Parse action
action = self._parse_action(thought)
if not action:
continue
# Execute action
tool = self.tools.get(action['name'])
if not tool:
observation = f"Error: Unknown tool '{action['name']}'"
else:
try:
observation = tool.execute(**action['args'])
except Exception as e:
observation = f"Error: {str(e)}"
# Add to conversation
messages.append({
"role": "assistant",
"content": thought
})
messages.append({
"role": "user",
"content": f"Observation: {observation}"
})
return "Max steps reached without completing task."
User: "Create a monthly sales report with charts"
Plan:
1. Query database for last month's sales data
2. Clean and aggregate data by product category
3. Create bar chart of sales by category
4. Create line chart of daily sales trend
5. Generate PDF report with charts and summary
Step 1: query_database("SELECT ... WHERE month = '2026-04'")
✓ Done: 15,243 records returned
Step 2: aggregate_by_category(data)
✓ Done: 8 categories aggregated
...
Spezialisierte Agenten arbeiten bei komplexen Aufgaben zusammen:
┌─────────────────────────┐
│ Orchestrator Agent │
│ (decomposes tasks, │
│ coordinates agents) │
└────┬──────┬──────┬───────┘
│ │ │
┌──────────┤ │ ├──────────┐
│ │ │ │ │
┌────▼────┐ ┌──▼──┐ ┌─▼───┐ ┌▼────────┐
│Research │ │Code │ │Test │ │Document │
│ Agent │ │Agent│ │Agent│ │ Agent │
│(search, │ │(code│ │(test│ │(docs, │
│ analyze)│ │ gen)│ │ gen)│ │ reports)│
└─────────┘ └─────┘ └─────┘ └─────────┘
Beispiel: Softwareentwicklung mit mehreren Agenten:
# Agent roles
agents = {
'product_manager': Agent(
role="Defines requirements and acceptance criteria",
tools=[search_knowledge_base, ask_user]
),
'architect': Agent(
role="Designs system architecture and data flow",
tools=[draw_diagram, search_documentation]
),
'developer': Agent(
role="Writes and reviews code",
tools=[write_file, read_file, execute_code]
),
'qa_engineer': Agent(
role="Writes tests and validates functionality",
tools=[run_tests, check_coverage, report_bugs]
),
}
# Orchestrator coordinates the workflow
orchestrator = Orchestrator(agents)
result = orchestrator.execute(
"Build a REST API for user authentication"
)
from pydantic import BaseModel, Field
class SearchTool(Tool):
name = "web_search"
description = "Search the web for current information"
class Parameters(BaseModel):
query: str = Field(description="The search query")
def execute(self, query: str) -> str:
response = requests.get(
"https://api.search.example.com",
params={"q": query}
)
return response.text
class CalculatorTool(Tool):
name = "calculator"
description = "Perform mathematical calculations"
class Parameters(BaseModel):
expression: str = Field(
description="Mathematical expression to evaluate"
)
def execute(self, expression: str) -> str:
try:
# Safe evaluation
result = self._safe_eval(expression)
return str(result)
except Exception as e:
return f"Error: {e}"
class DatabaseQueryTool(Tool):
name = "query_database"
description = "Query the sales database"
class Parameters(BaseModel):
sql: str = Field(description="SQL query to execute")
def execute(self, sql: str) -> str:
# Validate SQL (read-only queries only)
if not sql.strip().upper().startswith("SELECT"):
return "Error: Only SELECT queries are allowed"
result = db.execute(sql)
return json.dumps(result, default=str)
class Agent:
def __init__(self, llm, tools: list[Tool]):
self.llm = llm
self.tool_registry = {
t.name: t for t in tools
}
# Create function descriptions for LLM
self.functions = [
{
"type": "function",
"function": {
"name": t.name,
"description": t.description,
"parameters": t.Parameters.model_json_schema()
}
}
for t in tools
]
def think_and_act(self, prompt: str) -> str:
response = self.llm.invoke(
messages=[{"role": "user", "content": prompt}],
tools=self.functions
)
# If LLM wants to call a tool
if response.tool_calls:
for call in response.tool_calls:
tool = self.tool_registry[call.function.name]
args = json.loads(call.function.arguments)
result = tool.execute(**args)
# Feed result back to LLM...
class ConversationMemory:
def __init__(self, max_tokens: int = 4000):
self.messages = []
self.max_tokens = max_tokens
def add(self, role: str, content: str):
self.messages.append({"role": role, "content": content})
self._trim()
def _trim(self):
total = sum(len(m['content']) for m in self.messages)
while total > self.max_tokens and len(self.messages) > 2:
self.messages.pop(1) # Keep system prompt
total = sum(len(m['content']) for m in self.messages)
class LongTermMemory:
def __init__(self, vector_store):
self.store = vector_store
def remember(self, fact: str, metadata: dict = None):
"""Store important facts for future reference"""
embedding = embed_text(fact)
self.store.insert(embedding, payload={
'fact': fact,
**metadata,
'timestamp': datetime.now().isoformat()
})
def recall(self, query: str, k: int = 5) -> list[str]:
"""Retrieve relevant past facts"""
query_vector = embed_text(query)
results = self.store.search(query_vector, k=k)
return [r.payload['fact'] for r in results]
def consolidate(self):
"""Summarize and compress old memories"""
old_memories = self.store.get_older_than(days=30)
summary = summarize_texts([m.payload['fact'] for m in old_memories])
self.remember(f"Summary of past activities: {summary}",
metadata={'type': 'summary'})
self.store.delete(old_memories)
Erkunden Sie mehrere Argumentationspfade gleichzeitig:
Question: "What is the best cloud provider for our startup?"
Branch 1: Cost comparison
├─ AWS: $X/month
└─ GCP: $Y/month (cheaper, but fewer services)
Branch 2: Required services
├─ Need managed Kubernetes → all support
└─ Need specific AI/ML → GCP has TPUs
Branch 3: Team expertise
├─ Team knows AWS → faster ramp-up
└─ learning GCP → 2-3 month delay
Evaluation:
Path AWS: high team skill, moderate cost → score 8/10
Path GCP: lower cost, TPUs, but learning curve → score 7/10
class ReflectiveAgent(Agent):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.mistakes = []
def reflect_on_failure(self, task: str, action: str, error: str):
"""Learn from mistakes"""
reflection = self.llm.invoke(f"""
Task: {task}
Action taken: {action}
Error: {error}
Why did this fail? What should I do differently next time?
""")
self.mistakes.append(reflection.content)
def plan(self, task: str) -> str:
# Consider past mistakes when planning
if self.mistakes:
lessons = "\n".join([f"- {m}" for m in self.mistakes[-5:]])
return self.llm.invoke(f"""
Task: {task}
Lessons from past mistakes:
{lessons}
Plan your approach carefully.
""")
return super().plan(task)
Customer: "My order hasn't arrived and it's been 2 weeks"
Agent tasks:
1. Query order database for status
2. Check tracking API for shipment location
3. If delayed: contact shipping carrier
4. If lost: initiate refund process
5. If delivered: verify with customer
Tools needed: order_lookup, tracking_api, email_send, refund_system
Developer: "Fix the login bug — users get 401 errors after password reset"
Agent workflow:
1. Search codebase for password reset implementation
2. Identify token validation logic
3. Write a unit test reproducing the bug
4. Fix the issue
5. Run existing tests to verify no regression
6. Create PR with description
class ResearchAgent:
async def research(self, topic: str) -> Report:
# Parallel exploration
subtopics = self.decompose(topic)
tasks = [self.explore_subtopic(st) for st in subtopics]
findings = await asyncio.gather(*tasks)
# Synthesize
report = self.synthesize(findings)
return report
async def explore_subtopic(self, subtopic: str) -> Finding:
search_results = await web_search(subtopic)
summaries = await asyncio.gather(*[
summarize_page(url) for url in search_results[:5]
])
return Finding(subtopic=subtopic, summaries=summaries)
Der Agent kann getrost falsche Maßnahmen ergreifen:
Thought: The user asked to delete expired records.
Action: DELETE FROM users -- (Oops, no WHERE clause!)
Schadensbegrenzung:
Agenten können in Endlosschleifen stecken bleiben:
class LoopDetector:
def __init__(self, max_repeated_actions: int = 3):
self.action_history = []
self.max_repeated = max_repeated_actions
def check(self, action: str, observation: str) -> bool:
self.action_history.append({
'action': action,
'observation': observation
})
# Check for repeated patterns
recent = self.action_history[-5:]
if len(recent) >= 3:
patterns = [a['action'] for a in recent]
if len(set(patterns)) <= 2:
print("Loop detected!")
return True
return False
Jeder Agentenschritt kostet Geld (LLM-Aufrufe + API-Aufrufe):
agent_cost_estimation:
per_step:
llm_call: "$0.01" # GPT-4o
tool_call: "$0.001" # Average API call
search: "$0.00" # Web search
typical_session:
steps: 10-30
total: "$0.10 - $0.50"
complex_research:
steps: 50-200
total: "$0.50 - $5.00"
| Rahmen | Sprache | Funktionen |
|---|---|---|
| LangChain | Python | Das beliebteste und umfassendste Tool-Ökosystem |
| AutoGen | Python | Gespräche mit mehreren Agenten, Microsoft |
| CrewAI | Python | Rollenbasierte Agententeams |
| Semantischer Kern | C#/Python | Microsoft AI-Orchestrierung |
| Vercel AI SDK | TypeScript | RSC, Streaming, Tools für Web-Apps |
| LlamaIndex | Python | RAG + Agent, datenzentriert |
| OpenAI Assistants API | API | Verwaltet, Code-Interpreter, Dateisuche |
KI-Agenten stellen die nächste Weiterentwicklung von LLM-Anwendungen dar – von Fragen und Antworten in einer einzigen Runde bis hin zur autonomen, mehrstufigen Aufgabenerledigung.
| Ebene | Typ | Beispiel |
|---|---|---|
| Stufe 1 | Einfacher Chatbot | Fragen und Antworten mit RAG |
| Stufe 2 | Tool-verwendender Agent | Kundenbetreuung mit Ticketerstellung |
| Stufe 3 | Mehrstufig mit Planung | Wissenschaftlicher Mitarbeiter, Codegenerierung |
| Stufe 4 | Multiagentensysteme | Softwareentwicklungsteam aus Agenten |
| Stufe 5 | Autonomes Lernen | Sich selbst verbessern, sich im Laufe der Zeit anpassen |
Wichtige Erkenntnisse:
Die effektivsten Agentensysteme im Jahr 2026 vereinen Autonomie mit Sicherheit – sie geben dem Agenten Handlungsspielraum und behalten gleichzeitig die menschliche Kontrolle über Folgeentscheidungen.
Noch keine freigegebenen Kommentare sichtbar. Neue Antworten können moderiert werden.