agent-iam-sdk
v0.1.0
Published
Tiny zero-dependency client that lets AI agents report events to Agent IAM
Readme
Agent IAM SDK
Tiny, zero-dependency client for AI agents to report events to an Agent IAM deployment. Single file, works in Node.js and browsers.
Install
npm install agent-iam-sdkUsage
import { AgentIAM } from "agent-iam-sdk";
const agent = new AgentIAM({
apiKey: process.env.AGENT_IAM_KEY, // the key shown once when the agent was created
});
// Report a single event
await agent.logEvent({
event_type: "tool_call",
resource: "postgres.customers",
action: "read",
metadata: { query: "SELECT * FROM customers LIMIT 10" },
occurred_at: new Date().toISOString(),
});
// Report many events in one request (batching is automatic)
await agent.logEvents([
{ event_type: "tool_call", resource: "stripe.charges", action: "read" },
{ event_type: "error", resource: "stripe.charges", action: "call", metadata: { error: "timeout" } },
]);Events are POSTed to <baseUrl>/api/ingest/events with Authorization: Bearer <apiKey>.
Options
| Option | Default | Description |
| --------------- | ----------------------- | ------------------------------------------------ |
| apiKey | — (required) | The agent API key, e.g. agk_live_… |
| baseUrl | page origin | Base URL of the Agent IAM deployment |
| maxBatchSize | 100 | Max events per request in logEvents |
| swallowErrors | false | Swallow failures instead of throwing |
License
MIT
