react-native-agent
v0.1.2
Published
Rewried OpenAI Agents SDK to React Native for building multi-agent workflows.
Maintainers
Readme
React Native Agent
React Native Agent is a React Native port of the OpenAI Agents SDK for building multi-agent, realtime, and voice-powered AI applications on mobile.
Built with ❤️ by reactnative.info
[!NOTE] Check out the OpenAI Agents SDK).
Core concepts
- Agents: LLMs configured with instructions, tools, guardrails, and handoffs
- Agents as tools / Handoffs: Delegating to other agents for specific tasks
- Tools: Various Tools let agents take actions (functions, MCP, hosted tools)
- Guardrails: Configurable safety checks for input and output validation
- Human in the loop: Built-in mechanisms for involving humans across agent runs
- Sessions: Automatic conversation history management across agent runs
- Tracing: [Under work] Built-in tracking of agent runs, allowing you to view, debug and optimize your workflows
- Realtime Agents: [Under work] Build powerful voice agents with full features
Explore the examples/(TODO) directory to see the SDK in action.
Get started
Supported environments
React Native
Installation
npm install react-native-agent[!NOTE]
To enable text streaming in React Native, you need polyfills in index.js:
import { poly } from 'react-native-agent';
poly();Run your first agent
const openAIClient = new OpenAI({
API_KEY, BASE_URL
});
const modelProvider = new OpenAIProvider({
openAIClient,
});
setDefaultOpenAIClient(openAIClient);
setOpenAIAPI('chat_completions');
const agent = new Agent({
name: 'Assistant',
instructions: '',
model: 'YOUR_MODEL',
tools: [],
});
const runner = new Runner({ modelProvider });
const result = await runner.run(agent, prompt, {
signal: controller.signal,
});
console.log(result.finalOutput);Acknowledgements
We'd like to acknowledge the excellent work of the open-source community, especially:
