Orazaka
Pages of the documentation

Automation & the local agent

The protocol of the local executing agent and the automation worker.

Decoupled background execution service (orazaka-automation-service) and the NAT-bypassing Local Agent Protocol.


1. Architectural Setup

Architecture · orazaka-automation-service

Automation service — connector execution, CLI-agent dispatch and scheduling (own database)

Repository
orazaka-automation-service
Role
service
Owner
orazaka

Calls

  • orazaka-studio-service (amqp: orazaka.events.studio.connector)
  • krizaka-billing-service (http: krizaka-billing-client)

Called by

  • orazaka-conversation-service (amqp: orazaka.jobs.automation)
  • orazaka-job-service (amqp: krizaka.billing.settlements)
  • orazaka-studio-service (amqp: orazaka.jobs.automation)
  • Hexagonal Isolation: The worker is fully isolated. It has zero dependency on orazaka-conversation-service.
  • Communication Invariant: Inter-module sync is handled via the RabbitMQ broker.
  • Zero Inbound Ports: The worker runs in a secure cluster mesh; the local CLI agent connects outbound to the gateway to fetch requests.

2. Quartz Scheduler

Automation scheduling states are persisted in the PostgreSQL database:

  • Quartz config: spring.quartz.job-store-type = jdbc with postgres driver delegate.
  • Flyway Integration: Flyway migrations are disabled on the worker.

3. Connectors & Log Stubs

The worker does not integrate with actual cloud APIs or Apache Camel routing. Instead:

  • Connector Dispatcher: Outbound actions (Jira, Slack, Messenger, WhatsApp) are implemented as log-stubs in ConnectorDispatcher.java (orazaka-apps/workers/external-services/).
  • Execution Logs: Dispatching acts as a stub simulation logging payload metadata.
  • CLI Agent Routing: If the type is CLI_AGENT, it correctly serializes and dispatches to RabbitMQ under the cli.{userId}.dispatch routing key for remote CLI execution.

4. Local Agent Protocol (Reverse SSE Tunneling)

Sequence — text version

Participants

  • orazaka-cli
  • orazaka-conversation-service
  • RabbitMQ · orazaka.jobs / orazaka.events
  • orazaka-automation-service
  1. Phase 1 — secure reverse registration
  2. Step 1orazaka-cli → orazaka-conversation-service: GET /api/v1/agent/stream (Bearer token)
  3. Step 2orazaka-conversation-service → orazaka-conversation-service: validate the session JWT (krizaka-security)
  4. Step 3orazaka-conversation-service → RabbitMQ · orazaka.jobs / orazaka.events: publish evt.agent.presence
  5. Step 4orazaka-conversation-service replies to orazaka-cli: SSE tunnel established
  6. Phase 2 — job dispatch
  7. Step 5orazaka-automation-service → RabbitMQ · orazaka.jobs / orazaka.events: publish job.agent.dispatch.{userId}
  8. Step 6RabbitMQ · orazaka.jobs / orazaka.events replies to orazaka-conversation-service: deliver the job of this user
  9. Step 7orazaka-conversation-service replies to orazaka-cli: SSE event automation_payload
  10. Phase 3 — local consent and execution
  11. Step 8orazaka-cli → orazaka-cli: ask the user: Execute this action? [Y/n]
  12. Step 9orazaka-cli → orazaka-cli: run the approved script locally
  13. Step 10orazaka-cli → orazaka-conversation-service: POST /api/v1/agent/report (result JSON)
  14. Step 11orazaka-conversation-service → RabbitMQ · orazaka.jobs / orazaka.events: publish evt.agent.result.{jobId}
  • Phase 1 (Registration): The CLI opens an SSE channel (GET /api/v1/agent/stream). Gateway registers the channel and broadcasts metadata.
  • Phase 2 (Dispatch): The automation worker posts a job payload (containing script and directory limits) to RabbitMQ. The Gateway consumes and proxies it via the SSE stream.
  • Phase 3 (Consent & Execution): The CLI agent prompts the user in the terminal (Execute this action? [Y/n]). If approved, the command runs and output is reported via POST /api/v1/agent/report.

5. Security & Isolation Matrix

  • NAT Bypassing: SSE pulls commands outbound; no firewall inbound rules needed.
  • User Verification: Interactive prompt confirmation [Y/n] blocks unapproved command runs.
  • Sandboxing: Script actions restricted to user-configured directory lists.
  • Transport: Secured with TLS. Timeout limits (default 300s) evict hung scripts.

6. RabbitMQ Topology

ExchangeTypeRouting KeyQueueConsumer
orazaka.automation.exchangeTopicjob.approvedorazaka.automation.jobsWorker (AutomationJobListener)
orazaka.automation.exchangeTopiccli.{userId}.dispatchPer-User DispatchGateway
orazaka.automation.exchangeTopiccli.{userId}.resultPer-User ResultWorker (AutomationJobListener)
orazaka.cli.exchangeFanoutcli.onlineorazaka.cli.heartbeatGateway
orazaka.identity.eventsTopicuser.registeredorazaka.workers.identity.registrationWorker (IdentityNotificationListener)
orazaka.identity.eventsTopicpassword.resetorazaka.workers.identity.passwordWorker (PasswordNotificationListener)

Edit this page on GitHub