How okeson453/sentra-aura works
Purpose and Entry Points
SentraAura is a multi-tenant autonomous media-production platform for operating faceless channels across strategy, generation, publishing, analytics, and optimization. It is a backend/service monorepo, not a web application. Local entry points are Makefile, local/docker-compose.yml, and tools/sentra-cli/src/sentra_cli/main.py. Deployable HTTP/worker service entry points conventionally live in each service’s src/.../main.py, e.g. services/orchestrator/src/orchestrator/main.py.
Contract-First Service Boundary
OpenAPI specifications define service APIs in contracts/openapi/, while versioned event payloads are canonicalized in contracts/events/v1/ and agent envelopes in contracts/agent-messages/envelope.json. Shared Python clients are generated/organized in packages/api-clients/src/api_clients/; event publishing, consumption, replay, and schema validation are centralized in packages/event-bus/src/event_bus/. This separates synchronous service calls from asynchronous, replayable workflow events.
Workflow Orchestration and Agent Runtime
The Orchestrator coordinates durable, recoverable workflows using state machines, sagas, activities, and scheduling: services/orchestrator/src/orchestrator/workflows.py, services/orchestrator/src/orchestrator/saga.py, and services/orchestrator/src/orchestrator/state_machine.py. ADRs identify Temporal as the durability runtime. The Agent Runtime hosts domain agents grouped into clipping, creative, distribution, intelligence, operations, and production; shared enforcement includes approvals, execution policy, tool permissions, durable state, prompt-injection defense, and sandboxing in services/agent-runtime/src/agent_runtime/.
Content Production Pipeline
A typical flow is intelligence/research → strategy/ideation → scripting and verification → scene/voice/visual production → rendering/clipping → packaging/scheduling/publishing. The clipping engine asynchronously extracts audio, transcribes, detects scenes/shots, segments semantically, diarizes speakers, and scores highlights: services/clipping-engine/src/clipping_engine/pipeline/, services/clipping-engine/src/clipping_engine/tasks.py. Media assembly, reframing, captions, FFmpeg encoding, and worker execution are isolated in services/media-renderer/src/media_renderer/assembly/, services/media-renderer/src/media_renderer/encoding/ffmpeg_wrapper.py, and services/media-renderer/src/media_renderer/worker.py.
Governance, Provenance, and Tenant Control
The control plane manages channels, content, decisions, experiments, policies, publishing, and analytics-facing APIs: services/control-plane-api/src/control_plane_api/routes/. The content graph stores content nodes, edges, queries, and lineage; its client exposes traversal and lineage operations: services/content-graph-service/src/content_graph_service/graph_queries.py, packages/content-graph-client/src/content_graph_client/lineage.py. Policy, rights, approvals, budget/quota, and security form control boundaries before irreversible actions: services/policy-engine/src/policy_engine/engine.py, services/rights-registry-service/src/rights_registry_service/content_id_workflow.py, services/agent-runtime/src/agent_runtime/approval_gate.py.
External Providers and Distribution
Provider Gateway normalizes interchangeable LLM, image, search, transcription, TTS, and video vendors and tracks costs: services/provider-gateway/src/provider_gateway/router.py, services/provider-gateway/src/provider_gateway/adapters/, services/provider-gateway/src/provider_gateway/cost_tracker.py. Publishing abstracts platform capabilities and upload state across YouTube, TikTok, and Instagram: services/publishing-service/src/publishing_service/platforms/, services/publishing-service/src/publishing_service/upload_state_machine.py. Analytics ingests YouTube metrics, normalizes them, and writes ClickHouse/warehouse targets: services/analytics-ingestion/src/analytics_ingestion/youtube_analytics_client.py, services/analytics-ingestion/src/analytics_ingestion/clickhouse_writer.py.
Runtime Infrastructure and Operations
Services are containerized and deployed to Kubernetes via reusable Helm charts and per-service releases: infra/helm/charts/sentra-service/, infra/helm/releases/, infra/helm/charts/platform/nats/. Terraform provisions cluster, networking, databases, object storage, cache, event bus, warehouse, secrets, and observability: infra/terraform/modules/. NATS is the event-bus infrastructure; PostgreSQL is implied by migrations and tenant-isolation migrations; ClickHouse supports analytics; object-storage backends support S3, GCS, and Azure. Prometheus/Loki-oriented observability and agent/LLM tracing are defined in infra/terraform/modules/observability/ and packages/observability/src/observability/.
Main entry points: workflows.py Orchestrator · approval_gate.py Approval gate · worker.py Media Renderer · engine.py Policy Engine
Components 21
Contracts
- OpenAPI contracts
- Event contracts
- API clients
- Event bus library · Centralizes schema validation, publishing, consumption, and replay.
Workflow & Agents
- Orchestrator · Coordinates state machines, sagas, activities, and schedules.
services/orchestrator/src/orchestrator/workflows.py - Agent Runtime · Runs domain agents with policy, tools, sandboxing, and durable state.
- Approval gate
services/agent-runtime/src/agent_runtime/approval_gate.py
Production Pipeline
- Clipping Engine · Transcribes, detects scenes, segments, diarizes, and scores highlights.
- Media Renderer · Assembles media, captions, reframes, and FFmpeg encodes output.
services/media-renderer/src/media_renderer/worker.py
Control & Governance
- Control Plane API · Manages channels, content, decisions, experiments, policies, and publishing.
- Content Graph · Stores content relationships, traversal, and provenance.
services/content-graph-service/src/content_graph_service/graph_queries.py - Policy Engine
services/policy-engine/src/policy_engine/engine.py - Rights Registry
services/rights-registry-service/src/rights_registry_service/content_id_workflow.py
Platform Services
- Provider Gateway · Routes AI and media providers while tracking cost.
services/provider-gateway/src/provider_gateway/router.py - Publishing Service · Manages platform capabilities and upload state.
services/publishing-service/src/publishing_service/upload_state_machine.py - Analytics Ingestion · Normalizes YouTube metrics into warehouse targets.
services/analytics-ingestion/src/analytics_ingestion/clickhouse_writer.py
Runtime Infrastructure
- NATS
- Data stores · Supports tenant data, analytics, and media assets.
- Kubernetes deployment
- Observability
Other components
- Sentra CLI
tools/sentra-cli/src/sentra_cli/main.py
Connections 21
- Sentra CLI → Control Plane API: operates
- OpenAPI contracts → API clients: generates contracts
- API clients → Control Plane API: synchronous calls
- Event contracts → Event bus library: validates payloads
- Event bus library → NATS: publishes and consumes
- Orchestrator → Agent Runtime: coordinates agents
- Orchestrator → Event bus library: workflow events
- Agent Runtime → Provider Gateway: invokes providers
- Agent Runtime → Approval gate: requires approval
- Approval gate → Policy Engine: evaluates policy
- Orchestrator → Clipping Engine: dispatches analysis
- Orchestrator → Media Renderer: dispatches rendering
- Clipping Engine → Media Renderer: clips and metadata
- Media Renderer → Data stores: stores media assets
- Control Plane API → Content Graph: records content lineage
- Policy Engine → Rights Registry: checks rights
- Approval gate → Publishing Service: authorizes publishing
- Publishing Service → Analytics Ingestion: published-platform metrics
- Analytics Ingestion → Data stores: writes warehouse
- Kubernetes deployment → Orchestrator: deploys services
- Observability → Orchestrator: traces workflows