Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungWe Built a CLI to Find Out If You’re Overpaying for Claude(24.09.2026 um 04:35 Uhr)
Sichere ProgrammierungMy own sandbox was killing my agent's shell, and the exit code hid it(24.09.2026 um 04:38 Uhr)
Sichere ProgrammierungHow three OSLabs engineers built a CLI to catch you overpaying Claude(24.09.2026 um 04:45 Uhr)
Sichere ProgrammierungBreaking CI Guards on Purpose to Prove They Can Fail(24.09.2026 um 05:00 Uhr)
IT Security NachrichtenLangfristige Updatefähigkeit als Pflicht(24.09.2026 um 05:03 Uhr)
Sichere ProgrammierungWe Built a CLI to Find Out If You’re Overpaying for Claude(24.09.2026 um 04:35 Uhr)
Sichere ProgrammierungMy own sandbox was killing my agent's shell, and the exit code hid it(24.09.2026 um 04:38 Uhr)
Sichere ProgrammierungHow three OSLabs engineers built a CLI to catch you overpaying Claude(24.09.2026 um 04:45 Uhr)
Sichere ProgrammierungBreaking CI Guards on Purpose to Prove They Can Fail(24.09.2026 um 05:00 Uhr)
IT Security NachrichtenLangfristige Updatefähigkeit als Pflicht(24.09.2026 um 05:03 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

A resumable, human-in-the-loop AI agent in ~200 lines with zero dependencies

Most "AI agent" libraries fall into one of two buckets. Either they're a big framework you spend an afternoon configuring, or they're a tiny toy that drops the one feature you actually need in production: the ability to stop and ask…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Most "AI agent" libraries fall into one of two buckets. Either they're a big

framework you spend an afternoon configuring, or they're a tiny toy that drops

the one feature you actually need in production: the ability to stop and ask a

human before the agent does something you can't undo.



I wanted the middle. So I wrote yieldagent:

a small agent loop you can read end to end, with human-in-the-loop pause/resume

built in, and no runtime dependencies. This post walks through how it works and

why it's built the way it is.





What an agent loop actually is



Strip away the branding and an "agent" is a loop:




  1. Send the conversation to the model, along with the tools it's allowed to call.

  2. If the model asks to call a tool, run it and append the result.

  3. Repeat until the model answers without asking for a tool.



That's it. The model decides the control flow at runtime; your job is to run the

tools and feed the results back. Here's the core, lightly trimmed:




for (let step = 0; step < maxSteps; step++) {
const reply = await call(messages, toolSpecs);
messages.push(reply);

if (!reply.tool_calls?.length) {
yield { type: "final", text: reply.content, messages };
return;
}

for (const tc of reply.tool_calls) {
const args = JSON.parse(tc.function.arguments);
const result = await tools[tc.function.name].run(args);
messages.push({ role: "tool", tool_call_id: tc.id, content: JSON.stringify(result) });
}
}






Everything else in the library is in service of making this loop observable,

testable, and safe to run against the real world.





Why an async generator



Notice the yield. The loop is an async generator, so the caller drives it:




for await (const step of agent({ call, tools, messages })) {
if (step.type === "tool-start") console.log("->", step.tool, step.args);
if (step.type === "final") console.log(step.text);
}






Every step (each tool call, each result, and the final answer) is handed back to

you as a plain object. Nothing is hidden inside the framework. You can log it,

render it, or assert on it in a test. Which brings us to the nicest side effect.





Testing without an LLM



The model call is just a function: (messages, tools) => Promise<Message>. In

tests, you pass one that returns canned replies. No API key, no network, and the

result is deterministic:




const replies = [
{ role: "assistant", content: null, tool_calls: [{ id: "1", function: { name: "getWeather", arguments: '{"city":"Delhi"}' } }] },
{ role: "assistant", content: "It's 31°C.", tool_calls: [] },
];
let i = 0;
const call = async () => replies[i++];

const steps = [];
for await (const s of agent({ call, tools, messages })) steps.push(s);

expect(steps.map(s => s.type)).toEqual(["tool-start", "tool-end", "final"]);






The whole library is tested this way. Agent logic you can unit-test without an

LLM is worth a lot when you're iterating.





The feature that's actually hard to find: pause and resume



Real agents do risky things, send emails, spend money, delete files. You want a

human in the loop before that happens, and often you want to pause a run and

continue it later, in a different request or after a restart.



yieldagent does this with an approve callback. Return false for a tool and

the loop stops before running it, handing back a serializable resumeState:




const cfg = {
call, tools,
messages: [{ role: "user", content: "Email the Delhi weather to my boss" }],
approve: (tool) => tool !== "sendEmail",
};

let paused;
for await (const step of agent(cfg)) {
if (step.type === "paused") paused = step.resumeState; // a plain object
if (step.type === "final") console.log(step.text);
}






Because resumeState is just data, you can write it to a database or a job

queue, wait for a human to click "approve" somewhere else entirely, then pick up

where you left off:




import { resume } from "yieldagent";
for await (const step of resume(cfg, paused)) {
if (step.type === "final") console.log(step.text);
}






This is the part most minimal agents skip and most big frameworks turn into a

whole subsystem. Keeping it small and explicit was the main reason I wrote this.





Provider-agnostic by default



The core knows nothing about any specific provider. The included adapter talks

to anything that speaks the OpenAI /chat/completions shape, OpenAI, Anthropic's

compatible endpoint, Groq, Together, or a local model via Ollama or vLLM:




const call = openaiCompatible({
baseURL: "http://localhost:11434/v1", // Ollama
apiKey: "ollama",
model: "llama3.1",
});






Or skip the adapter and write your own call, it's about a dozen lines.






A couple of nice extras





  • Streaming: pass stream instead of call and you get token steps as the
    model produces text. Tools and pause/resume still work.


  • Zod tools: the optional yieldagent/zod entry derives the JSON Schema from
    a Zod schema and validates the model's arguments, feeding errors back so the
    model can correct itself.


  • Cancellation: pass an AbortSignal to stop a run on a timeout or user cancel.






When not to use it



If you need streaming UI helpers, a big prebuilt tool ecosystem, or multi-agent

orchestration out of the box, reach for the Vercel AI SDK or LangGraph. yieldagent

is for when you'd rather own a loop you can read in a few minutes than adopt a

framework. If you outgrow it, you'll know exactly what you're replacing.






Try it






npm install yieldagent






There's a browser demo of the approval flow (no API key needed):

https://rahul1368.github.io/yieldagent/



Code and docs: https://github.com/rahul1368/yieldagent



If you build something with it, or the pause/resume API breaks down for your use

case, I'd like to hear about it.

CTI Threat Relationship Graph2 Knoten / 1 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
SOC Incident Playbook: Remote Code Execution (RCE) Defense
title: Detect Exploitation - A resumable, human-in-the-loop AI agent in ~200 lines with zero dependencies
id: 506b4ba4-4d14-4273-bc90-37995746416e
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-24
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-24"
        description = "YARA Signature for "
    strings:
        $str = "A resumable, human-in-the-loop" ascii wide
    condition:
        any of them
}
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich A resumable, human-in-the-loop AI agent .... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten A resumable, human-in-the-loop AI agent in ~200 lines with zero dependencies

Thematisch verwandte Begriffe: resumable, humanintheloop, agent, lines · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-96676 | A vulnerability was identified in Fast FAC1900R 20190827_2.0.2. The impa…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick