Integrate Entelog in 5 minutes
Add compliance logging to any AI agent with a single line of code. Works with LangChain, CrewAI, or any custom agent framework.
Quickstart
Get up and running in three steps:
Install the SDK
npm install @entelog/sdkInitialize with your API key
import { Entelog } from '@entelog/sdk';
const audit = new Entelog('a0_live_xxxxx');Log agent actions
// Add this wherever your agent performs an action
await audit.log({
agent: 'SalesBot',
action: 'data_access',
data: {
query: 'customer lookup',
customer_id: 'cust_123',
fields_accessed: ['name', 'email', 'billing_address'],
result: 'success',
},
});
// Don't forget to flush on shutdown
await audit.shutdown();That's it. Events are automatically batched, retried on failure, and appear in your dashboard with AI-powered summaries.
Authentication
API keys authenticate requests and scope data to a specific workspace.
Key formats
a0_live_*Production keys — logs are stored permanentlya0_test_*Test keys — safe for development (coming soon)Where to get your API key
- Log in to the Entelog dashboard
- Navigate to your organization
- Create a workspace for your project or client
- Click “Generate Key”
- Copy the key — it's only shown once
Security note: API keys are SHA-256 hashed before storage. We never store or log your plaintext key. Treat it like a password.
TypeScript SDK
The recommended way to integrate. Full TypeScript support, automatic batching, and retry logic built in. Zero dependencies.
npm install @entelog/sdkFull example
import { Entelog } from '@entelog/sdk';
// Initialize with options
const audit = new Entelog({
apiKey: process.env.ENTELOG_API_KEY!,
batchSize: 50, // flush every 50 events (default)
flushInterval: 5000, // or every 5 seconds (default)
maxRetries: 3, // retry failed sends (default)
debug: false, // enable console logging
});
// Log agent actions
await audit.log({
agent: 'CustomerSupportBot',
action: 'data_access',
data: {
query: 'SELECT * FROM tickets WHERE status = open',
rows_returned: 15,
customer_id: 'cust_456',
},
});
await audit.log({
agent: 'CustomerSupportBot',
action: 'generation',
data: {
prompt: 'Summarize open tickets for customer',
model: 'gpt-4',
tokens_used: 1200,
response_type: 'text',
},
});
// Flush remaining events on shutdown
process.on('SIGTERM', async () => {
await audit.shutdown();
process.exit(0);
});API Reference
new Entelog(apiKey | options)Create a new Entelog client.
audit.log(event)Queue an agent event. Auto-flushes when batch is full.
audit.flush()Send all queued events immediately.
audit.shutdown()Stop auto-flush timer and send remaining events.
Python
Use Python's requests library to log agent actions. No extra dependencies required.
pip install requestsUsage
import requests
ENTELOG_KEY = "a0_live_xxxxx"
def audit_log(agent: str, action: str, data: dict):
"""Log an agent action to Entelog."""
requests.post(
"https://entelog.com/api/ingest",
headers={"Authorization": f"Bearer {ENTELOG_KEY}"},
json={
"agent_name": agent,
"action_type": action,
"raw_data": data,
},
)
# Log agent actions
audit_log("ResearchBot", "web_search", {
"query": "latest SEC filing for ACME Corp",
"results_count": 5,
"sources": ["sec.gov", "edgar.sec.gov"],
})
# Log decisions
audit_log("ResearchBot", "decision", {
"decision": "flag_for_review",
"reason": "Unusual trading pattern detected",
"confidence": 0.87,
})REST API
Use the REST API directly if you prefer not to use an SDK, or for languages we don't have an SDK for yet.
POST /api/ingest
curl -X POST https://entelog.com/api/ingest \
-H "Authorization: Bearer a0_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"agent_name": "SalesBot",
"action_type": "data_access",
"raw_data": {
"action": "customer_lookup",
"customer_id": "cust_123",
"fields_accessed": ["name", "email"],
"result": "success"
}
}'Response
{
"message": "Log ingested successfully",
"log": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"agent_name": "SalesBot",
"action_type": "data_access",
"summary": "The AI agent looked up customer cust_123 and accessed their name and email.",
"risk_level": "low",
"timestamp": "2026-04-25T20:00:00.000Z",
"workspace_id": "..."
}
}Request body
| Field | Type | Required | Description |
|---|---|---|---|
agent_name | string | ✓ | Name of the AI agent |
action_type | string | ✓ | Category of action (data_access, api_call, decision, generation) |
raw_data | object | ✓ | Arbitrary JSON payload with action details |
timestamp | string | ✗ | ISO 8601 timestamp (auto-generated if omitted) |
Integrations
Drop Entelog into your existing agent framework with these recipes.
LangChain
import requests
from langchain.callbacks.base import BaseCallbackHandler
ENTELOG_KEY = "a0_live_xxxxx"
def audit_log(agent, action, data):
requests.post("https://entelog.com/api/ingest",
headers={"Authorization": f"Bearer {ENTELOG_KEY}"},
json={"agent_name": agent, "action_type": action, "raw_data": data})
class EntelogCallback(BaseCallbackHandler):
"""Log every LangChain action to Entelog."""
def on_tool_start(self, serialized, input_str, **kwargs):
audit_log("LangChainAgent", "tool_call", {
"tool": serialized.get("name", "unknown"),
"input": input_str,
})
def on_llm_end(self, response, **kwargs):
audit_log("LangChainAgent", "generation", {
"output": response.generations[0][0].text[:500],
"model": response.llm_output.get("model_name", "unknown"),
})
# Use it
agent = initialize_agent(
tools, llm,
callbacks=[EntelogCallback()]
)CrewAI
import requests
from crewai import Agent, Task, Crew
ENTELOG_KEY = "a0_live_xxxxx"
def audit_log(agent, action, data):
requests.post("https://entelog.com/api/ingest",
headers={"Authorization": f"Bearer {ENTELOG_KEY}"},
json={"agent_name": agent, "action_type": action, "raw_data": data})
# Wrap task execution with audit logging
class AuditedAgent(Agent):
def execute_task(self, task, context=None):
result = super().execute_task(task, context)
audit_log(self.role, "task_execution", {
"task": task.description[:200],
"result": str(result)[:500],
"context_length": len(context) if context else 0,
})
return result
# Use AuditedAgent instead of Agent
researcher = AuditedAgent(
role="Research Analyst",
goal="Find and analyze market data",
backstory="Expert financial researcher",
)OpenAI Function Calling
import { Entelog } from '@entelog/sdk';
import OpenAI from 'openai';
const audit = new Entelog('a0_live_xxxxx');
const openai = new OpenAI();
// Wrap function calls with audit logging
async function executeFunction(name: string, args: any) {
const result = await functions[name](args);
// Log every function call to Entelog
await audit.log({
agent: 'AssistantBot',
action: 'function_call',
data: {
function: name,
arguments: args,
result: result,
},
});
return result;
}