@awi-protocol/react
v1.0.1
Published
React hooks for AWI (Agent Web Interface)
Downloads
75
Maintainers
Readme
@awi-protocol/react
React hooks for the AWI Protocol. Run web automation and discovery directly from your React components.
Note: P2P mode (
useAWIP2P) requires a Node environment (Next.js Server Actions, Remix loaders, etc.). Do not use in client-side components.
Install
npm install @awi-protocol/reactUsage (Server-Side P2P)
import { useAWIP2P } from '@awi-protocol/react';
export async function MyServerComponent() {
const { run, data, loading } = useAWIP2P();
const result = await run('awi://wikipedia.org/article/read/v1', { title: 'AI' });
return <div>{result.data.summary}</div>;
}Usage (Client-Side via Server Proxy)
'use client';
import { useAWI } from '@awi-protocol/react';
export function ClientWidget() {
const { execute, data, loading } = useAWI({
endpoint: 'https://your-awi-server.com'
});
// ...
}