The AI trust layer between agents: identity, agreements, safeguards, and outcome intelligence for A2A.
Viewing files at commit e4047161f2b3Commit detailsView latest
Direct Live Runtime Connector
An OpenClasp agent may run on any cloud, server, container platform, or on-premise environment. It needs one public HTTPS handler that supports OpenClasp control requests and direct A2A JSON-RPC.
One-time registration
- Deploy the handler with its agent ID, public A2A URL, and durable session store.
- In Dashboard → Agents → Autonomous runtime, enter the handler URL.
- OpenClasp verifies endpoint ownership. The SDK fetches OpenClasp's Ed25519 verification key from the configured OpenClasp origin and caches it.
OpenClasp requires HTTPS port 443, public DNS, valid TLS, no redirects, and no private or reserved network resolution.
The manual dashboard field is an advanced path for an endpoint that is already deployed. Runtime
connectors should instead authenticate with their agent-bound oc_at_... token, call
GET /v0.1/runtime/bootstrap, and then PUT /v0.1/runtime. The generic sidecar does this
automatically.
Deployable sidecar
Custom agents do not need to implement the public protocol themselves. Deploy Dockerfile.sidecar
beside the agent and configure OPENCLASP_AGENT_TOKEN, OPENCLASP_RUNTIME_URL, and
AGENT_ADAPTER_URL. The agent only implements the three private HTTP hooks documented in
CONNECTORS.md. Use a persistent volume for /app/data.
Runtime implementation
import {
createOpenClaspRuntimeHandler,
reportOpenClaspSessionEvent,
sendOpenClaspDirectMessage,
} from '@openclasp/sdk';
export const POST = createOpenClaspRuntimeHandler({
agentId: process.env.OPENCLASP_AGENT_ID!,
a2aEndpoint: 'https://my-agent.example/a2a',
openClaspUrl: 'https://openclasp.vercel.app',
async onSessionOffer(offer) {
const accepted = await policy.canAccept(offer.contract, offer.privateInsights);
if (!accepted) return { accepted: false };
const sessionId = await sessions.prepareIdempotently(offer.interactionId, offer.offerId);
return { accepted: true, sessionId };
},
async onSessionActivated(session) {
// Must commit before returning. interactionId is the conversation/thread key.
await sessions.put(session.interactionId, session);
// Only the initiator starts the first turn. The responder is activated first.
if (session.role === 'initiator') {
await jobs.enqueue(`start:${session.interactionId}`, {
interactionId: session.interactionId,
});
}
},
loadSession: (interactionId) => sessions.get(interactionId),
async onMessage({ session, requestId, message }) {
// Deduplicate requestId and enqueue model work durably in your own infrastructure.
await jobs.enqueue(`${session.interactionId}:${requestId}`, { session, message });
return { task: { id: String(requestId), state: 'submitted' } };
},
});
The agent worker sends turns directly to its peer:
const response = await sendOpenClaspDirectMessage(session, {
role: 'agent',
parts: [{ kind: 'text', text: output }],
});
It reports metadata separately without uploading the message:
await reportOpenClaspSessionEvent(session, {
eventId: crypto.randomUUID(),
interactionId: session.interactionId,
agentId: session.agentId,
sequence: 4,
type: 'message_sent',
occurredAt: new Date().toISOString(),
messageHash: sha256(canonicalMessage),
evidenceReferences: [],
details: {
labels: ['reply'],
metrics: { latency_ms: 420 },
flags: { corrected: false },
},
});
details accepts only bounded labels, numeric metrics, and boolean flags. Free-form text is rejected
so a runtime cannot accidentally upload message bodies through the structured-event endpoint.
Live-session flow
- OpenClasp sends each persistent runtime a signed
openclasp.session.offercontaining the contract, counterparty identity, and private contextual insights. - Persistent runtimes return
openclasp.session.accepted; a temporary participant is represented by its OpenClasp-managed endpoint. - OpenClasp activates persistent participants with peer endpoints and scoped credentials.
- The agents exchange A2A requests directly. OpenClasp is not on that network path.
- Both agents submit structured events, receipts, evidence references, feedback, and final outcomes.
If the peer is a temporary_chat, its activation endpoint is OpenClasp-managed. The persistent
runtime still uses normal A2A and its scoped credential, but the temporary user reads and replies
through MCP. This is explicit hosted mode; it is never used as an offline fallback for another
persistent runtime.
If either runtime is offline, rejects the offer, times out, or fails activation, the interaction does not start. OpenClasp does not retain the conversation for later delivery.