Skip to content

Events API

Moxxy provides real-time observability through Server-Sent Events (SSE) and a queryable audit log.

SSE Event Stream

GET /v1/events/stream

Query Parameters

ParameterTypeDescription
agent_idstringFilter events by agent
run_idstringFilter events by run
event_typestringFilter by event type (comma-separated)

Example

bash
curl -N -H "Authorization: Bearer mox_token" \
  "http://127.0.0.1:3000/v1/events/stream?agent_id=agent_abc123"

JavaScript

javascript
const eventSource = new EventSource(
  'http://127.0.0.1:3000/v1/events/stream?agent_id=agent_abc123',
);

eventSource.onmessage = (event) => {
  const envelope = JSON.parse(event.data);
  console.log(envelope.event_type, envelope.payload);
};

Event Envelope

Every event is wrapped in a standard envelope:

json
{
  "event_id": "evt_7f3a2b1c-...",
  "timestamp": "2025-01-15T10:00:00.123Z",
  "agent_id": "agent_abc123",
  "run_id": "run_def456",
  "sequence": 42,
  "event_type": "primitive.called",
  "payload": { ... }
}
FieldDescription
event_idUUID v7 unique identifier
timestampISO 8601 timestamp
agent_idAgent that generated the event
run_idRun context (null for system events)
sequenceMonotonically increasing counter per run
event_typeEvent category and type
payloadEvent-specific data

Event Types

Moxxy emits 60+ event types across these categories:

Run Events

EventDescription
run.startedAgent run initiated
run.completedRun finished successfully
run.failedRun terminated with error

Message Events

EventDescription
message.userUser message received
message.assistantAssistant response generated
message.systemSystem message injected

Model Events

EventDescription
model.requestLLM API call initiated
model.responseLLM response received
model.streamStreaming token received

Primitive Events

EventDescription
primitive.calledPrimitive invocation started
primitive.resultPrimitive execution completed

Skill Events

EventDescription
skill.invokedSkill execution started
skill.completedSkill execution finished

Memory Events

EventDescription
memory.storedMemory entry persisted
memory.recalledMemory search executed

Vault Events

EventDescription
vault.accessedSecret retrieved
vault.deniedSecret access denied (no grant)

Heartbeat Events

EventDescription
heartbeat.firedScheduled heartbeat triggered
heartbeat.createdNew heartbeat registered

Sub-Agent Events

EventDescription
subagent.spawnedSub-agent created
subagent.completedSub-agent finished

Security Events

EventDescription
security.violationSecurity policy violated
security.redactedSecret redacted from output

Channel Events

EventDescription
channel.message_receivedMessage from external channel
channel.message_sentMessage sent to external channel

Secret Redaction

All events pass through the RedactionEngine before being emitted. Any vault secret values that appear in event payloads are automatically replaced with [REDACTED]. This ensures secrets are never leaked through the event stream or audit log.

Audit Log

Query persisted events for historical analysis.

GET /v1/audit

Query Parameters

ParameterTypeDescription
agent_idstringFilter by agent
event_typestringFilter by type
sincestringISO timestamp start
untilstringISO timestamp end
limitnumberMax results (default: 100)

Response

json
{
  "events": [
    {
      "event_id": "evt_7f3a2b1c-...",
      "timestamp": "2025-01-15T10:00:00.123Z",
      "agent_id": "agent_abc123",
      "run_id": "run_def456",
      "event_type": "primitive.called",
      "payload": { "name": "fs.read", "args": { "path": "README.md" } }
    }
  ]
}

Required Scopes

EndpointScope
GET /v1/events/streamevents:read
GET /v1/auditevents:read

Open source · Self-hosted · Data sovereign