agenauto-nextjs
v1.3.0
Published
AgenAuto SDK for Next.js — autonomous AI agent for your React/Next.js project
Maintainers
Readme
@agenauto/nextjs
Official Next.js SDK for AgenAuto — your autonomous AI agent.
Installation
npm install @agenauto/nextjsQuick Start
1. Add the Provider
Wrap your app with the AgenAutoProvider in your root layout:
// app/layout.tsx
import { AgenAutoProvider } from '@agenauto/nextjs';
export default function RootLayout({ children }) {
return (
<html>
<body>
<AgenAutoProvider agentKey="YOUR_AGENT_KEY">
{children}
</AgenAutoProvider>
</body>
</html>
);
}2. Use the Hook (Optional)
Interact with your agent programmatically:
'use client';
import { useAgenAuto } from '@agenauto/nextjs';
function MyComponent() {
const { status, sendMessage } = useAgenAuto();
const askAgent = async () => {
const response = await sendMessage('Analyze this page for SEO');
console.log(response.reply);
};
return (
<div>
<p>Agent: {status.connected ? '🟢 Connected' : '🔴 Disconnected'}</p>
<button onClick={askAgent}>Ask Agent</button>
</div>
);
}API
<AgenAutoProvider>
| Prop | Type | Default | Description |
|:---|:---|:---|:---|
| agentKey | string | required | Your Agent Key from the AgenAuto dashboard |
| apiUrl | string | https://agenauto.lat | Your AgenAuto instance URL |
| showBadge | boolean | false | Show status badge on the page |
useAgenAuto()
Returns:
| Property | Type | Description |
|:---|:---|:---|
| status | AgentStatus | { connected, agentName, model } |
| sendMessage | (msg: string) => Promise | Send a message to your agent |
| reportPage | () => void | Manually report current page data |
License
MIT
