Skip to content

agent-software

The agent-software worked example.

Run it from sema/:

Terminal window
sema check examples/agent-software
SEMA_STRICT=1 sema run examples/agent-software
sema assure examples/agent-software --grade silver
"""Explorer→engineer→hardener delivery circuit with owned task handoff."""
assure silver
struct ChangeRequest:
goal: str
struct PatchArtifact:
summary: str
verified: bool
def inspect(query: str) -> str !{}:
return "project evidence for " + query
agent explorer(request: ChangeRequest) -> str by explorer_model:
sem "Inspect read-only context and return a bounded evidence packet"
use tools [inspect]
budget model_calls=2, tokens=512
agent engineer(evidence: str) -> PatchArtifact by engineer_model:
sem "Produce one isolated patch artifact; do not change unassigned files"
budget model_calls=2, tokens=1024
ensure result.verified == true
agent hardener(patch: PatchArtifact) -> PatchArtifact by reviewer_model:
sem "Review correctness, security, recovery, and acceptance evidence"
budget model_calls=2, tokens=768
ensure result.verified == true
circuit deliver(request: ChangeRequest) -> PatchArtifact !{agent.spawn, model.invoke}:
budget agents=4, spawn_depth=1, model_calls=8, tokens=6000
evidence = explorer(request)
implementation = spawn engineer(evidence)
patch = implementation.join()?
return hardener(patch)
def main() -> PatchArtifact !{agent.spawn, model.invoke}:
result = deliver(ChangeRequest(goal="add bounded retry handling"))
print(result.summary)
return result

Explorer→engineer→hardener delivery circuit with owned task handoff.

Fields

fieldtypedescriptor
goalstr

Fields

fieldtypedescriptor
summarystr
verifiedbool
def inspect(query: str) -> str !{}

Parameters

nametype
querystr

Returns str

Effects !{}

agent explorer(request: ChangeRequest) -> str

Parameters

nametype
requestChangeRequest

Returns str

agent engineer(evidence: str) -> PatchArtifact

Parameters

nametype
evidencestr

Returns PatchArtifact

agent hardener(patch: PatchArtifact) -> PatchArtifact

Parameters

nametype
patchPatchArtifact

Returns PatchArtifact

circuit deliver(request: ChangeRequest) -> PatchArtifact !{agent.spawn, model.invoke}

Parameters

nametype
requestChangeRequest

Returns PatchArtifact

Effects !{agent.spawn, model.invoke}

def main() -> PatchArtifact !{agent.spawn, model.invoke}

Returns PatchArtifact

Effects !{agent.spawn, model.invoke}