Skip to main content

Traces

Record every step of your agent's reasoning chain as a cryptographic trace. Each step is hash-chained to the previous one. Completed traces are RSA-4096 signed and independently verifiable. Export portable certificates for compliance or auditing.

Base URL: https://novyx-ram-api.fly.dev

Tier: Pro+


Start Trace

POST /v1/traces

Start a new trace session for recording an agent's reasoning chain.

Request body

ParameterTypeRequiredDefaultDescription
agent_idstringYesAgent identifier
descriptionstringNoTrace description
tagsstring[]No[]Tags for filtering

Response fields

FieldTypeDescription
trace_idstringTrace identifier
statusstringTrace status (active)
created_atstringCreation timestamp

Examples

from novyx import Novyx

nx = Novyx(api_key="nram_your_key")

trace = nx.start_trace(
agent_id="agent-001",
description="Customer support conversation",
tags=["support", "billing"],
)
trace_id = trace["trace_id"]

Response

{
"trace_id": "trc_a1b2c3d4e5f6",
"status": "active",
"created_at": "2026-03-09T15:00:00Z"
}

Add Step

POST /v1/traces/{trace_id}/steps

Add a step to an active trace. Each step is integrity-chained — its hash includes the previous step's hash, forming an unbreakable chain.

Path parameters

ParameterTypeDescription
trace_idstringTrace identifier

Request body

ParameterTypeRequiredDefaultDescription
typestringYesStep type (see below)
contentstringYesStep content
metadataobjectNo{}Additional metadata

Step types:

TypeDescription
THOUGHTInternal reasoning or planning
ACTIONExternal action taken (API call, tool use)
OBSERVATIONResult of an action
OUTPUTFinal output to user
ERRORError encountered
POLICY_CHECKSafety or policy validation

Response fields

FieldTypeDescription
step_idstringStep identifier
integrity_chain_hashstringSHA-256 chain hash (includes previous step)

Examples

# Record the agent's reasoning chain
nx.add_trace_step(trace_id, type="THOUGHT", content="User is asking about their billing cycle")
nx.add_trace_step(trace_id, type="ACTION", content="Looking up account billing info")
nx.add_trace_step(trace_id, type="OBSERVATION", content="Account is on Pro plan, billing cycle starts March 1")
nx.add_trace_step(trace_id, type="OUTPUT", content="Your Pro plan renews on March 1st each month.")

Response

{
"step_id": "stp_f6e5d4c3b2a1",
"integrity_chain_hash": "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a"
}

Complete Trace

POST /v1/traces/{trace_id}/complete

Seal and cryptographically sign a trace. After completion, no more steps can be added. The trace is signed with RSA-4096, producing a verifiable signature.

Path parameters

ParameterTypeDescription
trace_idstringTrace identifier

Response fields

FieldTypeDescription
integrity_root_hashstringRoot hash of the integrity chain
signaturestringRSA-4096 signature of the root hash

Examples

result = nx.complete_trace(trace_id)
print(f"Root hash: {result['integrity_root_hash']}")
print(f"Signature: {result['signature'][:40]}...")

Response

{
"integrity_root_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"signature": "MGYCMQDJnGm1LQ3..."
}

List Traces

GET /v1/traces

List traces with optional filters by agent, status, and pagination.

Query parameters

ParameterTypeRequiredDefaultDescription
agent_idstringNoFilter by agent
statusstringNoFilter: active, completed, failed, interrupted
limitnumberNo20Max results (1–100)
offsetnumberNo0Pagination offset

Response fields

FieldTypeDescription
tracesarrayArray of trace objects
totalnumberTotal matching traces

Examples

# List all traces
traces = nx.list_traces(limit=10)

# Filter by agent and status
completed = nx.list_traces(agent_id="agent-001", status="completed")

Get Trace

GET /v1/traces/{trace_id}

Get a trace with all its steps. Returns the full reasoning chain in order.

Path parameters

ParameterTypeDescription
trace_idstringTrace identifier

Response fields

FieldTypeDescription
traceobjectTrace metadata (id, agent_id, status, created_at, completed_at)
stepsarrayOrdered array of step objects
step_countnumberTotal steps in the trace

Examples

trace = nx.get_trace("trc_a1b2c3d4e5f6")
print(f"Status: {trace['trace']['status']}")
print(f"Steps: {trace['step_count']}")
for step in trace["steps"]:
print(f" [{step['type']}] {step['content']}")

Response

{
"trace": {
"trace_id": "trc_a1b2c3d4e5f6",
"agent_id": "agent-001",
"status": "completed",
"description": "Customer support conversation",
"created_at": "2026-03-09T15:00:00Z",
"completed_at": "2026-03-09T15:02:30Z"
},
"steps": [
{
"step_id": "stp_001",
"step_index": 0,
"type": "THOUGHT",
"content": "User is asking about their billing cycle",
"integrity_hash": "e3b0c442...",
"chain_hash": "a7ffc6f8...",
"previous_chain_hash": null,
"created_at": "2026-03-09T15:00:01Z"
},
{
"step_id": "stp_002",
"step_index": 1,
"type": "ACTION",
"content": "Looking up account billing info",
"integrity_hash": "b8c1d553...",
"chain_hash": "c9e2f664...",
"previous_chain_hash": "a7ffc6f8...",
"created_at": "2026-03-09T15:00:02Z"
}
],
"step_count": 4
}

Verify Trace Integrity

POST /v1/traces/{trace_id}/verify

Verify the cryptographic integrity of a completed trace. Checks that the hash chain is intact and the RSA signature is valid.

Path parameters

ParameterTypeDescription
trace_idstringTrace identifier

Response fields

FieldTypeDescription
validbooleanOverall validity (chain + signature)
chain_validbooleanWhether the hash chain is intact
signature_validbooleanWhether the RSA signature is valid
discrepanciesarrayList of any integrity issues (empty if valid)

Examples

result = nx.verify_trace("trc_a1b2c3d4e5f6")
if result["valid"]:
print("Trace integrity verified — chain and signature are valid")
else:
print(f"Integrity issues: {result['discrepancies']}")

Response

{
"valid": true,
"chain_valid": true,
"signature_valid": true,
"discrepancies": []
}

Errors

StatusCodeCause
400TRACE_NOT_COMPLETEDTrace must be completed before verification
404NOT_FOUNDTrace does not exist

Get Trace Certificate

GET /v1/traces/{trace_id}/certificate

Get a portable integrity certificate for a completed trace. The certificate includes the trace metadata, root hash, RSA signature, and the public key needed for independent verification.

Path parameters

ParameterTypeDescription
trace_idstringTrace identifier

Response fields

FieldTypeDescription
trace_idstringTrace identifier
integrity_root_hashstringRoot hash of the integrity chain
signaturestringRSA-4096 signature
public_keystringPublic key (PEM format) for independent verification

Examples

cert = nx.get_trace_certificate("trc_a1b2c3d4e5f6")
print(f"Root hash: {cert['integrity_root_hash']}")
# Save certificate for external verification
import json
with open("trace_certificate.json", "w") as f:
json.dump(cert, f, indent=2)

Get Public Key

GET /v1/traces/public-key

Get the public key used for verifying trace signatures. No authentication required — anyone can verify a trace independently.

Response fields

FieldTypeDescription
public_keystringRSA public key (PEM format)
algorithmstringSigning algorithm (e.g. RSA-SHA256)

Examples

# No auth required
import requests
resp = requests.get("https://novyx-ram-api.fly.dev/v1/traces/public-key")
public_key = resp.json()["public_key"]

End-to-end workflow

A complete trace lifecycle:

1. Start trace        → POST /v1/traces
2. Add steps → POST /v1/traces/{id}/steps (repeat)
3. Complete trace → POST /v1/traces/{id}/complete
4. Verify integrity → POST /v1/traces/{id}/verify
5. Export certificate → GET /v1/traces/{id}/certificate

Independent verification

Anyone can verify a Novyx trace certificate without an API key:

  1. Get the public key from /v1/traces/public-key
  2. Compute the SHA-256 hash of the trace steps in order
  3. Verify the RSA signature against the root hash using the public key

This makes traces suitable for regulatory compliance, legal evidence, and third-party auditing.