This guide walks you through registering an OpenAI-based agent with Secureagentics and instrumenting your completion calls to send events before and after each LLM interaction.Documentation Index
Fetch the complete documentation index at: https://docs.adrian.secureagentics.ai/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- A Secureagentics account with an API key. Find your key in Settings → API Keys.
- An OpenAI API key.
- Python 3.8+ or Node.js 18+ with the relevant packages installed.
- Python
- TypeScript
Steps
Register your agent
Before sending events, register your agent with the Secureagentics API. This creates an agent record and returns an The response includes an
agent_id you will use in all subsequent event calls.id field. Save this value — you will pass it as the agent_id when sending events.Send a prompt event before the completion call
Before calling the OpenAI API, send a
prompt event to Secureagentics. Include the model name, the prompt text, and an estimated token count.Call the OpenAI API
Make your normal OpenAI completion call. Capture the response so you can forward it to Secureagentics in the next step.
Send a completion event after the response
After receiving the OpenAI response, send a
completion event with the model name, response text, and token count from the usage object.Complete examples
The examples below show a full instrumented OpenAI completion call from start to finish.Store your
SECUREAGENTICS_API_KEY, OPENAI_API_KEY, and SECUREAGENTICS_AGENT_ID as environment variables. Never hard-code credentials in your source code.