Skip to main content

Start

Start the agent:

$ osapi agent start

The agent connects to NATS, subscribes to job streams, and processes jobs as they become available. It uses platform-specific providers to execute operations (node status, DNS queries, ping, etc.).

Configuration

Agent behavior is configured via osapi.yaml or CLI flags:

FlagDescriptionDefault
--agent-hostNATS server hostnamelocalhost
--agent-portNATS server port4222
--agent-client-nameNATS client name for identificationosapi-agent
--agent-queue-groupQueue group for load balancingjob-agents
--agent-hostnameAgent hostname for routingsystem hostname
--agent-max-jobsMaximum concurrent jobs10

Consumer Settings

FlagDescriptionDefault
--consumer-max-deliverMax delivery attempts before DLQ5
--consumer-ack-waitTime to wait for acknowledgment2m
--consumer-max-ack-pendingMax unacknowledged messages1000
--consumer-replay-policyReplay policy (instant or original)instant
--consumer-back-offRetry backoff intervals30s,2m,5m,15m,30m

How It Works

  1. Connects to NATS and creates JetStream consumers
  2. Subscribes to query (jobs.query.>) and modify (jobs.modify.>) subjects
  3. Processes jobs by dispatching to the appropriate provider
  4. Writes status events and results back to the KV store
  5. Gracefully shuts down on SIGINT/SIGTERM