Use case
Mobile Peer Embedded In The App
Run a Studio peer directly inside a mobile app so it can answer users and trigger native app actions such as screen navigation, camera capture, and task execution.
- Stack Client SDK
- Pattern Chat · Mobile
- Read ~8 min
Overview
A common mobile pattern is not just chat. It is a peer living inside the app and helping the user complete tasks without leaving the native flow. For example, a field sales app can expose a Studio peer that drafts follow-up messages, opens account screens, or starts a visit summary workflow.
This keeps Studio focused on peer behavior while your mobile app remains responsible for device capabilities and navigation.
When to reach for this use case
If your team needs the capabilities described above and you would rather build on proven primitives than wire one from scratch — this is the shape to start from.
Architecture
Client SDK works in browser and Node-style environments, making it suitable for React Native bridges or mobile web shells. The peer comes from Studio, but the app decides which native actions are safe to expose as client tools.
Typical client tools in mobile include opening a screen, scanning a barcode, capturing a photo, or saving a draft locally for offline sync.
1. Initialize The Mobile Integration
Create the client in your mobile app shell and fetch the peer bound to the app channel.
import { CognipeerClient } from '@cognipeer/sdk';
const client = new CognipeerClient({
token: mobileSession.cognipeerToken,
hookId: mobileSession.channelHookId,
apiUrl: 'https://api.cognipeer.com/v1',
});
const peer = await client.peers.get();
console.log('Connected mobile peer:', peer.name);2. Map Native Capabilities As Client Tools
The peer can now decide when to invoke native functionality without owning that logic itself.
const mobileTools = [
{
type: 'function',
function: {
name: 'openCustomerDetailScreen',
description: 'Navigate to a customer detail screen inside the mobile app',
parameters: {
type: 'object',
properties: {
customerId: { type: 'string' },
},
required: ['customerId'],
},
},
implementation: async ({ customerId }) => {
navigation.navigate('CustomerDetail', { customerId });
return 'Customer detail screen opened';
},
},
{
type: 'function',
function: {
name: 'captureVisitPhoto',
description: 'Open the camera and attach a visit photo to the current record',
parameters: {
type: 'object',
properties: {
visitId: { type: 'string' },
},
required: ['visitId'],
},
},
implementation: async ({ visitId }) => {
const asset = await openNativeCamera();
await uploadVisitPhoto(visitId, asset);
return 'Visit photo uploaded';
},
},
];3. Continue The Conversation Across App Actions
Use a normal conversation flow. The peer calls tools when it needs to move the user through the mobile experience.
const firstTurn = await client.conversations.create({
messages: [
{
role: 'user',
content: 'Open Acme Corp, show the latest opportunity, and help me prepare a follow-up note.',
},
],
clientTools: mobileTools,
});
const nextTurn = await client.conversations.sendMessage({
conversationId: firstTurn.conversationId,
messages: [{ role: 'user', content: 'Attach the latest visit photo as well.' }],
clientTools: mobileTools,
});
console.log(nextTurn.content);Result
You get a mobile-native assistant that:
- Keeps the Studio peer inside your app experience
- Calls native device capabilities through client tools
- Guides users through real app tasks instead of standalone chat
- Works well for field teams, sales reps, ops users, and task-heavy mobile flows
Products used
This pattern is built on one Cognipeer product.
The peer itself is authored and maintained in Cognipeer Studio — the SDK only connects your product to it.
Related use cases
HR Self-Service Widget
Embed a Studio-powered HR assistant into an employee portal for policy Q&A, leave requests, onboarding help, and document routing.
Expense Upload & Approval Widget
Let employees upload receipts, extract fields, and submit expense requests through a Studio-powered finance widget embedded in your product.
Website Product Advisor Widget
Embed a Studio peer into a public website to qualify visitors, answer pricing questions, and trigger product actions without building a separate bot backend.
Customer Support Bot
Deploy conversational AI with streaming responses, human-in-the-loop escalation, guardrails, and tool transparency.
See every pattern on the use case index, or browse all Cognipeer libraries.

