SDK Reference
1
Agent Trust — meta-package
@kobil/aitrustkobil-aitrustThe front door. Bundles the Agent SDK + Audit behind one AITrust() factory and the
declarative tool API.
Recommended path: define tools with
defineTool and register them with
registerTools — that's exactly what the integration guide
and the sample agents use. ai.tool() and ai.secureAgent() are higher-level shortcuts for
quick prototypes.Factory + instance
import { AITrust } from "@kobil/aitrust";
const ai = AITrust({ agentId, clientId, clientSecret,
managementUrl, auditUrl, idpUrl, realm, timeoutMs });
// platformUrl is required — AITrust() throws ConfigurationError without it
// instance methods
ai.tool(fn, { scopes, name }) // wrap a function in the full pipeline
ai.secureAgent(client, { tools }) // auto-detect framework, secure every call
await ai.requireApproval({ approver, message }) // inline CIBA
await ai.health() // subsystem health
from kobil_aitrust import AITrust, AITrustConfig
ai = AITrust(AITrustConfig(agent_id=..., client_id=..., client_secret=...,
management_url=..., audit_url=..., idp_url=..., realm=..., timeout_ms=...))
# instance methods (async where they call the platform)
ai.tool(fn, {"scopes": [...], "name": "..."})
ai.secure_agent(client, {"tools": {...}})
await ai.require_approval(options) # inline CIBA
await ai.health()
Declarative tools
import { defineTool, registerTools, toAnthropicTools, toOpenAITools } from "@kobil/aitrust";
const def = defineTool({
name, description, parameters, // JSON Schema
scopes?, needsApproval?, approver?, approvalMessage?, unguarded?, unaudited?,
execute: async (input) => string,
});
const secured = registerTools(ai, { [name]: def }); // → secured registry
const tools = toAnthropicTools(secured); // or toOpenAITools(secured)
await secured[name].execute(input);
from kobil_aitrust import define_tool, register_tools, to_anthropic_tools, to_openai_tools, ToolDefinition
d = define_tool(ToolDefinition(
name=..., description=..., parameters={...}, # JSON Schema
scopes=None, needs_approval=None, approver=None, approval_message=None, unguarded=None,
execute=async_fn, # async (input) -> str
))
secured = register_tools(ai, {name: d})
tools = to_anthropic_tools(secured) # or to_openai_tools(secured)
await secured[name].execute(tool_input)
Errors
import { NotAuthorized, ApprovalDenied, ApprovalTimeout,
NotAuthenticated, UntrustedAgent, ConfigurationError } from "@kobil/aitrust";
from kobil_aitrust import (NotAuthorized, ApprovalDenied, ApprovalTimeout,
NotAuthenticated, UntrustedAgent, ConfigurationError)
2
Agent SDK
@kobil/kobil-agent-sdkkobil-agent-sdkThe low-level engine under the meta-package: identity + token acquisition, the tool registry, and per-framework secure clients. Use it directly for fine-grained control or unusual frameworks.
Framework secure clients
import { SecureAnthropicClient, SecureOpenAIClient, SecureGoogleAdkClient,
SecureLangChainClient, SecureVercelAIClient, SecureGoogleGenAIClient } from "@kobil/kobil-agent-sdk";
// one-line converters too:
import { toAnthropicTool, toOpenAITool, toGoogleAdkTool, toLangChainTool, toVercelTool } from "@kobil/kobil-agent-sdk";
// identity / auth primitives:
import { KobilAI, OAuthClient, CIBAClient, AgentIdentityManager } from "@kobil/kobil-agent-sdk";
// quick helpers:
import { kobilTool, createKobil } from "@kobil/kobil-agent-sdk";
# Python package: kobil_agent_sdk — identity, token acquisition, tool registry, # and the same per-framework secure clients exposed through the meta-package's # secure_agent(...) / integrations. Most apps use kobil_aitrust and never import # kobil_agent_sdk directly.
Framework coverage: Anthropic, OpenAI (incl. Agents SDK), Google ADK, Google GenAI, LangChain, Vercel AI, and Claude Agent / MCP.
3
Audit
@kobil/kobil-agent-auditkobil-agent-auditA tamper-evident trail of every tool call, token grant, and approval, plus token-usage tracking,
CIBA async-authorization, and compliance reporting. Tool calls through registerToolsregister_tools
are audited automatically; post your own events for work outside the pipeline.
import { KobilAgentAudit, AuditLogger, TokenTracker,
AsyncAuthorization, ComplianceReporter } from "@kobil/kobil-agent-audit";
from kobil_agent_audit import (KobilAgentAudit, AuditLogger, TokenTracker,
AsyncAuthorization, ComplianceReporter)
Manual event (HTTP)
POST {AITRUST_AUDIT_URL}/v1/events
{ "agentId": "agent:<id>", "action": "document_sign",
"eventType": "claims.document_signed", "outcome": "success",
"resourceId": "<instanceId>", "details": { } } // `action` is required
Ready to wire these together? The integration guide shows the
exact order — identity → tools → FGA → CIBA → Audit — with copy-paste diffs.