Persistence Schema
Agentwerke uses EF Core migrations in src/Agentwerke.Infrastructure with the default PostgreSQL schema agentwerke.
The model stores timestamps as ISO-8601 strings in text columns and uses jsonb for list-valued fields.
Core tables
workflows
Stores workflow definitions, status, metadata, tags, and BPMN XML.
Important fields:
IdNameVersionStatusOwnerValidationStateTagsBpmnXml
workflow_runs
Stores one workflow execution.
Important fields:
IdWorkflowIdWorkflowNameWorkflowVersionStatusRiskLevelCurrentStepRequestedByStartedAtCompletedAtPendingApprovalsTags
workflow_run_steps
Stores step-level execution state, output, and policy decision details.
Important fields:
RunIdNameTypeStatusAgentNameOutputPolicyDecision_*
workflow_events
Stores run-scoped event messages and timestamps.
workflow_run_context
Stores run-scoped key/value context such as:
input.bodyinput.titleoutput.WriteRequirements
Writes upsert by (RunId, Key).
approval_requests
Stores approval task state, risk information, decision comment, decision timestamp, and approver identity.
agent_interactions
Stores run-scoped agent communications:
- coordination-bus posts
- questions
- choices
- notifications
agent.request- approval-adjacent interaction records
This table backs the run Conversation view.
Notes
PolicyDecisionis an owned type onworkflow_run_steps.approval_requests,agent_interactions, andworkflow_run_contextare standalone tables keyed by run id in the current model.- Approvals still live in
approval_requests; folding them intoagent_interactionsis a possible future consolidation.
Migration commands
Add a migration:
dotnet ef migrations add <Name> \
--project src/Agentwerke.Infrastructure \
--startup-project src/Agentwerke.ApiList migrations:
dotnet ef migrations list \
--project src/Agentwerke.Infrastructure \
--startup-project src/Agentwerke.ApiGenerate an idempotent SQL script:
dotnet ef migrations script --idempotent \
--project src/Agentwerke.Infrastructure \
--startup-project src/Agentwerke.Api