Projeto do Agent Contas ORACLE

This commit is contained in:
2026-08-19 09:35:50 -03:00
commit 950a2bcd33
1366 changed files with 177217 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
from agent_framework.runtime.agent_runtime import AgentRuntimeMixin
class Runtime(AgentRuntimeMixin):
pass
def _envelope(status: str, name: str = "invoice_explanation"):
return {
"result": {
"result": {
"status": status,
"execution_id": "exec-1",
"metadata": {
"workflow_name": name,
"workflow_execution_id": "exec-1",
"resume_tool": "retomar_workflow",
},
"pause": {"message": "Sanei sua dúvida?"} if status == "PAUSED" else None,
}
}
}
def test_workflow_pausado_ja_e_registrado_como_executado():
runtime = Runtime()
state = {}
runtime._capture_pending_domain_workflow(state, _envelope("PAUSED"))
assert state["business_workflows_executed"] == ["invoice_explanation"]
assert state["pending_domain_workflow"]["workflow_name"] == "invoice_explanation"
def test_workflow_completo_e_registrado_sem_pending():
runtime = Runtime()
state = {}
runtime._capture_pending_domain_workflow(state, _envelope("COMPLETED", "pro_rata"))
assert state["business_workflows_executed"] == ["pro_rata"]
assert "pending_domain_workflow" not in state
def test_latch_nao_duplica_workflow():
runtime = Runtime()
state = {}
runtime._capture_pending_domain_workflow(state, _envelope("PAUSED"))
runtime._capture_pending_domain_workflow(state, _envelope("COMPLETED"))
assert state["business_workflows_executed"] == ["invoice_explanation"]
def test_transaction_state_patch_preserva_latch():
runtime = Runtime()
patch = runtime.transaction_state_patch({"business_workflows_executed": ["invoice_explanation"]})
assert patch["business_workflows_executed"] == ["invoice_explanation"]