Using AI in Ambassadors
Learn about Using AI in Ambassadors in WaymakerOS.
Ambassadors have two built-in AI paths. Choose the one that fits your workload — or use both in the same ambassador for different tasks.
One AI — Full-Power AI
One AI routes your request through the One intelligence layer, which selects the best model for the task. It supports all available models, compliance-aware routing, and the full range of AI capabilities.
When to use
- Complex reasoning, planning, or strategic analysis
- High-quality writing (reports, summaries, proposals)
- HIPAA-compliant data processing (regulated industries)
- Tasks where quality matters more than speed
Code example
export default async function handler(request, ctx) {
const result = await ctx.ai.generate({
prompt: 'Analyse this customer feedback and identify the top 3 themes...',
})
return new Response(result.text)
}
Model selection
One automatically selects the best model for your task based on complexity, cost, and compliance requirements. You can override this by specifying a model:
const result = await ctx.ai.generate({
prompt: 'Write a detailed market analysis...',
model: 'gpt-4o',
maxTokens: 4000,
})
HIPAA compliance
If your organization's workspace is classified as HIPAA-regulated, One automatically routes all AI requests to HIPAA-compliant models. No code changes needed — the routing is handled by the platform.
Edge AI — Fast AI
Edge AI runs an edge-optimised model directly on the same global network as your ambassador. There's no round-trip to an external service — the AI runs alongside your code, making it very fast and very affordable.
When to use
- Data extraction from text, forms, or images
- Classification, categorisation, and tagging
- Summarisation at high volume
- Structured output (get JSON back, not free text)
- Multi-turn conversations where speed matters
Text generation
export default async function handler(request, ctx) {
const result = await ctx.ai.edge.generate({
prompt: 'Extract the company name and industry from this text: ' + inputText,
})
return new Response(result.text)
}
Structured output
Get validated JSON back instead of free text. Provide a schema describing the shape you expect:
const result = await ctx.ai.edge.structured({
prompt: 'Extract the following from this invoice: ' + invoiceText,
schema: {
company: 'string',
total: 'number',
currency: 'string',
date: 'string',
},
})
// result.data.company, result.data.total, etc. are typed
await ctx.tables.insert('invoices', result.data)
Vision (processing images)
Edge AI can process images alongside text prompts — useful for receipts, documents, photos, and screenshots:
const imageBuffer = await request.arrayBuffer()
const result = await ctx.ai.edge.vision({
prompt: 'Describe what you see in this image',
images: [imageBuffer],
})
Conversation caching
For multi-turn conversations, pass a sessionId to keep the conversation context warm. Each subsequent turn is faster and cheaper because the model remembers the previous context:
const sessionId = crypto.randomUUID()
const turn1 = await ctx.ai.edge.generate({
prompt: 'You are a customer support agent. The customer says: ' + message,
sessionId,
})
// Later, in a follow-up request with the same sessionId:
const turn2 = await ctx.ai.edge.generate({
prompt: 'The customer replies: ' + followUp,
sessionId,
})
// turn2 is faster and cheaper — the context is already cached
Limitations
- Not HIPAA-compliant — if your workspace requires HIPAA compliance, Edge AI will return an error directing you to use One AI instead
- Single model — Edge AI uses an edge-optimised model. You cannot select a specific model like you can with One AI
- No streaming — Edge AI returns the complete response. For streamed responses, use One AI
Choosing the Right Path
Use this table to decide which path fits each task in your ambassador:
| Task | Recommended path | Why |
|---|---|---|
| Extract fields from a form submission | Edge AI (structured) | Fast, cheap, returns typed JSON |
| Write a detailed report | One AI | Needs premium reasoning and writing quality |
| Classify incoming support tickets | Edge AI | High volume, simple categorisation |
| Process uploaded receipts | Edge AI (vision) | Image processing at low cost |
| Analyse financial data for compliance | One AI | May involve regulated data, needs precision |
| Summarise meeting notes | Edge AI | Straightforward summarisation |
| Generate a strategic recommendation | One AI | Complex reasoning required |
| Qualify leads from form data | Edge AI (structured) | Extract and categorise at volume |
You can use both paths in the same ambassador — for example, use Edge AI to extract data from a document, then pass the extracted data to One AI for deeper analysis.
Credit Usage
Both AI paths consume credits from your organization's WaymakerOne Pass allocation:
- One AI credits are tracked in real time as part of the request
- Edge AI credits are tracked asynchronously — they appear in your usage within a few seconds
View your AI credit usage in the Invocation Logs for per-ambassador tracking, or in your organization's billing dashboard for overall usage.
Next steps
- Creating Ambassadors — set up a new ambassador
- Invoking & Logs — run ambassadors and view logs
- Serverless Functions — ambassador overview