@agenttracehq/sdk
v1.0.0
Published
Official Node.js SDK for AgentTraceHQ - Tamper-proof audit trails for AI agents
Maintainers
Readme
@agenttracehq/sdk
Official Node.js SDK for AgentTraceHQ — Audit Trail for AI Agents.
Installation
npm install @agenttracehq/sdkQuick Start
const { AgentTraceHQ } = require('@agenttracehq/sdk');
const tracer = new AgentTraceHQ({
apiKey: 'athq_live_...',
agentId: 'my-agent-001',
});
await tracer.trace({
action: 'tool_call',
input: { query: 'What is the weather?' },
output: { result: 'Sunny, 72F' },
toolsUsed: ['weather_api'],
});
await tracer.flush();Session Tracing
const session = tracer.session();
await session.trace({ action: 'user_input', input: { message: 'Hello' } });
await session.trace({ action: 'response', output: { message: 'Hi there!' } });
await session.end();LangChain Integration
const handler = tracer.langchainHandler();
// Pass as callback to any LangChain component
const llm = new ChatOpenAI({ callbacks: [handler] });API Reference
new AgentTraceHQ(options)
apiKey(string, required) — Your API keyagentId(string, required) — Default agent identifierbaseUrl(string) — API URL (default: https://agenttracehq.com/api/v1)batchSize(number) — Traces per batch (default: 10)flushIntervalMs(number) — Auto-flush interval (default: 1000ms)
