@agentgatepkg/react
v0.1.0
Published
AgentGate React SDK — hooks, provider, and guard components for AI agent verification
Maintainers
Readme
@agentgatepkg/react
React hooks, provider, and guard components for AgentGate AI agent verification.
Install
npm install @agentgatepkg/react @agentgatepkg/clientQuick Start
Provider + Hook
import { AgentGateProvider, useAgentGate } from "@agentgatepkg/react";
function App() {
return (
<AgentGateProvider endpoint="http://localhost:8080">
<ProtectedContent />
</AgentGateProvider>
);
}
function ProtectedContent() {
const { isAgent, loading, score, error } = useAgentGate();
if (loading) return <p>Verifying agent identity...</p>;
if (error) return <p>Verification error: {error.message}</p>;
if (!isAgent) return <p>Access restricted to AI agents</p>;
return <p>Welcome, Agent! Score: {score}</p>;
}Guard Component
import { AgentGateGuard } from "@agentgatepkg/react";
function App() {
return (
<AgentGateProvider endpoint="http://localhost:8080">
<AgentGateGuard fallback={<p>Verifying...</p>}>
<SecretContent />
</AgentGateGuard>
</AgentGateProvider>
);
}Exports
| Export | Type | Description |
|--------|------|-------------|
| AgentGateProvider | Component | Context provider — wrap your app |
| useAgentGate | Hook | Returns { isAgent, loading, score, error } |
| useVerification | Hook | Returns full verification result |
| useChallenge | Hook | Manual challenge control |
| AgentGateGuard | Component | Renders children only if verified |
| VerificationBadge | Component | Displays verification status badge |
Peer Dependencies
react>= 18.0.0react-dom>= 18.0.0
Requirements
- AgentGate backend running (setup guide)
Links
License
MIT
