agent-contracts-backend-runtime
Installation
SKILL.md
agent-contracts Backend Runtime
Use this skill when you are implementing an AI agent as a backend service (HTTP API, jobs, or SSE streaming).
Target Shape
- Input:
RequestContext(session_id, action, params, message, image, resume_session) - Output:
response.response_type+response.response_data(+ optionalresponse.response_message) - State slices:
request,response,_internal+ domain slices (e.g.,ticket,orders,workflow)
Recommended Workflow
- Start from
examples/05_backend_runtime.py. - Define your domain slices and register them:
NodeRegistry.add_valid_slice("your_slice"). - Implement nodes with
NodeContract(keepreads/writesminimal). - Build graph with
build_graph_from_registry(...)and compile. - Wrap with
AgentRuntimefor request/response execution. - If you need progressive updates, use
StreamingRuntimeand emit SSE viaStreamEvent.to_sse().