Exemples de base (2)
oGBad = new stzAgentGraph("mailer-bad")
oGBad.AddLLMActor("writer")
oGBad.AddEffect("send")
oGBad.Proposes("writer", "send")
? oGBad.IsSound()
? oGBad.Violations()[1][:message]0 effect 'send' has no guardian edge into it -- every effect passes a pi-gate
exécuté le 2026-10-02 04:24 dans la bibliothèque au commit 0e72e2e2c ; tiré de 14-an-agent-that-cannot-hurt.en.md(s'ouvre dans un nouvel onglet)
oGOk = new stzAgentGraph("mailer")
oGOk.AddLLMActor("writer")
oGOk.AddGuardian("gate")
oGOk.AddEffect("send")
oGOk.AddTraceSink("audit")
oGOk.Proposes("writer", "gate")
oGOk.Guards("gate", "send")
oGOk.Feeds("gate", "send")
oGOk.Traces("send", "audit")
? oGOk.IsSound()1
exécuté le 2026-10-02 04:24 dans la bibliothèque au commit 0e72e2e2c ; tiré de 14-an-agent-that-cannot-hurt.en.md(s'ouvre dans un nouvel onglet)
Portée (2)
oRep = new stzRuleReport("clean")
oAG = new stzAgentGraph("ok")
oAG.AddLLMActor("writer")
oAG.AddGuardian("gate")
oAG.AddEffect("send")
oAG.AddTraceSink("audit")
oAG.Proposes("writer", "gate")
oAG.Guards("gate", "send")
oAG.Feeds("gate", "send")
oAG.Traces("send", "audit")
oRep.Collect(oAG)
oCG = new stzRingCodeGraph("")
oCG.ScanSource("class Bag" + nl + "def Count()" + nl + " return 1" + nl, "s")
oRep.Collect(oCG)
# no findings
? oRep.NumberOfFindings()
# ...the gate is sound
? oRep.IsSound()0 1
exécuté le 2026-10-02 04:22 dans la bibliothèque au commit 0e72e2e2c ; tiré de rulereport_narrated.ring(s'ouvre dans un nouvel onglet)
oAG = new stzAgentGraph("bad")
oAG.AddLLMActor("writer")
oAG.AddEffect("send")
oAG.Proposes("writer", "send")
aLegacyAgent = StzCheckAgentGraph(oAG.GraphQ()) # [ :invariant, :node, ... ]
aLegacyCode = StzCheckCode("class Bag" + nl + "def Len()" + nl + " return 1" + nl) # [ :line, ... ]
oRep = new stzRuleReport("mixed")
oRep.IngestLegacy(aLegacyAgent, "agentic")
oRep.IngestLegacy(aLegacyCode, "code")
# legacy findings are normalized into the unified shape
? HasKey(oRep.Findings()[1], :rule) and HasKey(oRep.Findings()[1], :subject) and
HasKey(oRep.Findings()[1], :where)
# ...the invariant name became :rule
? len(oRep.Findings()[1][:rule]) > 0
# ...tagged with the given subject
? len(oRep.FindingsOfSubject("agentic")) >= 1
# ...and the code line landed in :where
? len(oRep.FindingsOfSubject("code")) >= 1
# the one gate spans legacy sources too
? oRep.IsSound()1 1 1 1 0
exécuté le 2026-10-02 04:22 dans la bibliothèque au commit 0e72e2e2c ; tiré de rulereport_narrated.ring(s'ouvre dans un nouvel onglet)
Les extensions de cette méthode
Chaque extension, et si elle existe pour cette méthode ; une extension qui existe se compose avec les autres (FindSTCS).
Chaque exemple est un fichier de test de la bibliothèque, exécuté dans la bibliothèque pour cette page ; seuls ceux dont la sortie a tenu toutes les promesses écrites par leur fichier sont montrés. Les explications, les titres et le code sont ceux de la bibliothèque, en anglais.
Voir aussi
- La classe stzAgentGraph
- La référence du domaine : Agents et conversation
- Les autres méthodes de ces exemples : stzAgentGraph.AddEffect · stzAgentGraph.AddGuardian · stzAgentGraph.AddLLMActor · stzAgentGraph.AddTraceSink · stzAgentGraph.Feeds · stzAgentGraph.Guards · stzAgentGraph.IsSound · stzAgentGraph.Traces · stzAgentGraph.Violations · stzRingCodeGraph.ScanSource · stzRuleReport.Collect · stzRuleReport.Findings

