In this section, we will show how to quickly instrument your agent code to collect traces and install agent contracts to run offline verification or runtime certification.

1

Install agent contracts

Install agent contracts.

git clone https://github.com/relari-ai/agent-contracts.git
cd agent-contracts
poetry install
2

Install relari-otel in your Agent

In your agent repository, install the relari-otel package to collect traces.

pip install relari-otel[langchain,openai,certification]
3

Option A: Set up Agent Contracts for Offline Verification

In the agent-contracts directory, start the agent contract service for verification. You can come back to this step after you’ve created your first verification specification (more details in Scenarios and Specifications).

make docker-verification

Initialize telemetry code in your agent code

app.py
from relari_otel.otel import Relari

Relari.init(project_name="Your Project Name", batch=False)
4

Option B: Set up Agent Contracts for Runtime Certification

In the agent-contracts directory, start the agent contract service for runtime certification. You can come back to this step after you’ve created your first certification specification (more details in Scenarios and Specifications).

export RUNTIME_VERIFICATION_CONFIG="configs/runtime-certification.yaml" && \
export RUNTIME_VERIFICATION_SPECS="specs.json" && \
make docker-runtime-certification

Initialize telemetry code in your agent code

app.py
from relari_otel.otel import Relari

Relari.init(project_name="Your Project Name", batch=False, certification_enabled=True)

Next Steps

Now that you’ve installed agent contracts:

  1. Learn more about creating contracts and specifications
  2. Learn more about using agent contracts for offline verification and runtime certification