69 lines
2.6 KiB
Text
69 lines
2.6 KiB
Text
|
|
let s = import "reflection/schema.ncl" in
|
||
|
|
|
||
|
|
{
|
||
|
|
id = "create_agent_task",
|
||
|
|
trigger = "manual | NATS:ecosystem.reflection.request",
|
||
|
|
|
||
|
|
preconditions = [
|
||
|
|
"vapora-agents service is running",
|
||
|
|
"budget-boundary axiom enforced (BudgetEnforcer middleware active)",
|
||
|
|
"provider-abstraction: LLMClient trait in use at all call sites",
|
||
|
|
],
|
||
|
|
|
||
|
|
steps = [
|
||
|
|
{
|
||
|
|
id = "validate_task_params",
|
||
|
|
action = "Validate task parameters against agent capability schema",
|
||
|
|
cmd = "nickel export --format json {vapora_dir}/schemas/agent-task.ncl | jq --exit-status '.capabilities | contains([{capability}])'",
|
||
|
|
actor = 'Agent,
|
||
|
|
on_error = { strategy = 'Stop },
|
||
|
|
depends_on = [],
|
||
|
|
},
|
||
|
|
|
||
|
|
{
|
||
|
|
id = "check_budget",
|
||
|
|
action = "Verify current budget balance allows this task execution",
|
||
|
|
cmd = "curl -sf http://localhost:8080/api/v1/budget/{tenant_id}/check?estimate=true | jq --exit-status '.allowed == true'",
|
||
|
|
actor = 'Agent,
|
||
|
|
on_error = { strategy = 'Stop },
|
||
|
|
depends_on = [{ step = "validate_task_params", kind = 'OnSuccess }],
|
||
|
|
},
|
||
|
|
|
||
|
|
{
|
||
|
|
id = "check_gate",
|
||
|
|
action = "Verify the agent capability gate is open for this signal type",
|
||
|
|
cmd = "nu {vapora_dir}/scripts/check-gate.nu --ontology {vapora_dir}/.ontology --signal {signal_type}",
|
||
|
|
actor = 'Agent,
|
||
|
|
on_error = { strategy = 'Stop },
|
||
|
|
depends_on = [{ step = "validate_task_params", kind = 'OnSuccess }],
|
||
|
|
},
|
||
|
|
|
||
|
|
{
|
||
|
|
id = "dispatch_task",
|
||
|
|
action = "Dispatch validated task to the agent dispatcher",
|
||
|
|
cmd = "curl -sf -X POST http://localhost:8080/api/v1/tasks -H 'Content-Type: application/json' -d '{\"capability\": \"{capability}\", \"tenant_id\": \"{tenant_id}\", \"payload\": {task_payload}}'",
|
||
|
|
actor = 'Agent,
|
||
|
|
on_error = { strategy = 'Stop },
|
||
|
|
depends_on = [
|
||
|
|
{ step = "check_budget", kind = 'OnSuccess },
|
||
|
|
{ step = "check_gate", kind = 'OnSuccess },
|
||
|
|
],
|
||
|
|
},
|
||
|
|
|
||
|
|
{
|
||
|
|
id = "capture_to_kogral",
|
||
|
|
action = "Record task dispatch as an Execution node in the knowledge graph",
|
||
|
|
cmd = "nu {stratumiops_dir}/scripts/kogral-bridge.nu --mode create_agent_task --project {project_name} --file /dev/stdin",
|
||
|
|
actor = 'Agent,
|
||
|
|
on_error = { strategy = 'Continue },
|
||
|
|
depends_on = [{ step = "dispatch_task", kind = 'OnSuccess }],
|
||
|
|
},
|
||
|
|
],
|
||
|
|
|
||
|
|
postconditions = [
|
||
|
|
"Task is visible in syntaxis-core task tracker",
|
||
|
|
"Budget ledger updated with estimated cost",
|
||
|
|
"Execution node created in kogral shared graph",
|
||
|
|
],
|
||
|
|
} | (s.Mode String)
|