react-native-agent-sdk
v0.1.0
Published
Build AI agents that can actually use your phone. Camera, NFC, Bluetooth, Location, Contacts — all as agent tools. MCP compatible.
Maintainers
Readme
🤖 React Native Agent SDK
Build AI agents that can actually use your phone.
Not another chatbot UI. This is an agent framework that gives AI access to device capabilities — camera, location, NFC, bluetooth, contacts, APIs — as callable tools.
Quick Start
yarn add react-native-agent-sdkimport { createAgent, openai, LocationTool, CameraTool, APITool } from 'react-native-agent-sdk';
const agent = createAgent({
model: openai({ apiKey: 'sk-...' }),
tools: [new LocationTool(), new CameraTool(), new APITool()],
});
// Agent thinks, calls tools, returns result
const result = await agent.run("Find nearby restaurants and show me the top 3");
console.log(result.response);
// → "Here are the top 3 restaurants near you: ..."
// (Agent used LocationTool to get GPS, APITool to search Google Places)What It Does
User prompt → Agent thinks → Calls device tools → Returns result
│
┌────────────────┼────────────────┐
▼ ▼ ▼
📍 Location 📷 Camera 🌐 API calls
📇 Contacts 📋 Clipboard 🔔 Notifications
💾 Storage 📤 Share 🔌 MCP serversThe AI decides which tools to use based on the user's request. You just provide the tools and the prompt.
Built-in Tools
| Tool | What it does |
|------|-------------|
| LocationTool | GPS coordinates |
| CameraTool | Take photo / pick from gallery |
| ContactsTool | Search device contacts |
| NotificationsTool | Send local notifications |
| StorageTool | Read/write local storage |
| APITool | HTTP requests to any API |
| ClipboardTool | Read/write clipboard |
| ShareTool | System share dialog |
Model Providers
import { openai, anthropic, gemini, custom } from 'react-native-agent-sdk';
// OpenAI
const agent = createAgent({ model: openai({ apiKey: '...', model: 'gpt-4o' }) });
// Claude
const agent = createAgent({ model: anthropic({ apiKey: '...', model: 'claude-sonnet-4-20250514' }) });
// Gemini
const agent = createAgent({ model: gemini({ apiKey: '...', model: 'gemini-2.0-flash' }) });
// Custom (bring your own)
const agent = createAgent({ model: custom(async (messages, tools) => { ... }) });MCP Support
Connect to any MCP server — tools are auto-discovered and usable by the agent:
const agent = createAgent({
model: openai({ apiKey: '...' }),
tools: [new LocationTool()],
});
// Connect to MCP server — its tools become available
await agent.connectMCP({
url: 'https://company.com/mcp',
auth: 'token-123',
});
// Agent can now use both local tools AND MCP server tools
await agent.run("Get customer data from CRM and send them a notification");Custom Tools
Create your own tools in minutes:
import { Tool, ToolResult, ParameterDef } from 'react-native-agent-sdk';
class WeatherTool extends Tool {
name = 'get_weather';
description = 'Get current weather for a city';
parameters = {
city: { type: 'string', description: 'City name', required: true },
};
async execute(params: { city: string }): Promise<ToolResult> {
const res = await fetch(`https://api.weather.com/current?city=${params.city}`);
const data = await res.json();
return { success: true, data };
}
}
agent.registerTool(new WeatherTool());Agent Callbacks
Monitor what the agent is doing:
const agent = createAgent({
model: openai({ apiKey: '...' }),
tools: [...],
onThinking: (msg) => console.log('🤔', msg),
onToolCall: (name, params) => console.log('🔧', name, params),
onResponse: (msg) => console.log('💬', msg),
});Real-World Examples
// Find nearby coffee shops
await agent.run("Find coffee shops within 500m and share the closest one's address");
// Smart notification
await agent.run("Remind me to call John tomorrow at 9am");
// Data pipeline
await agent.run("Fetch latest Bitcoin price and save it to local storage");
// Multi-step task
await agent.run("Take a photo, then share it on WhatsApp with the caption 'Hello!'");Architecture
┌─────────────────────────────────────────────────────────┐
│ Your App │
│ │
│ ┌───────────────────────────────────────────────────┐ │
│ │ Agent Core │ │
│ │ - Prompt → Model → Tool calls → Response │ │
│ │ - Multi-step reasoning loop │ │
│ │ - Permission management │ │
│ └──────────────┬────────────────────────────────────┘ │
│ │ │
│ ┌──────────────▼────────────────────────────────────┐ │
│ │ Tools Layer │ │
│ │ 📍 Location 📷 Camera 📇 Contacts 🌐 API │ │
│ │ 📋 Clipboard 📤 Share 🔔 Notify 💾 Storage │ │
│ └──────────────┬────────────────────────────────────┘ │
│ │ │
│ ┌──────────────▼────────────────────────────────────┐ │
│ │ MCP Layer (optional) │ │
│ │ Connect to any MCP server → auto-discover tools │ │
│ └───────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────────┐
│ LLM API │ │ MCP Servers │
│ (OpenAI / │ │ (Company APIs / │
│ Claude / │ │ External) │
│ Gemini) │ │ │
└──────────────┘ └──────────────────┘Coming Soon
@rn-agent/nfc— Read/write NFC tags@rn-agent/bluetooth— BLE device communication@rn-agent/chat-ui— Ready-made chat + voice UI components@rn-agent/cloud— Agent memory, sync, analytics- Voice input/output (speech-to-text, text-to-speech)
- Streaming responses
- Multi-agent orchestration
License
MIT
Author
Hasan Gönen — @hasangonen91
