Agents workspace
Monitor live sessions, review routing policies, and connect proompteng orchestration to Convex state without switching tabs.
policy-first orchestrationobservability on taprole aware sessionstool + memory mesh
Realtime playbook
Drop these snippets into your convex/ directory and React clients to orchestrate models, persist telemetry, and render live views without manual polling.
Action: orchestrate models
Call proompteng from a Convex action to pick the best model and persist inference telemetry.
import { action } from './_generated/server';
import { v } from 'convex/values';
export const routePrompt = action({
args: {
prompt: v.string(),
sessionId: v.string(),
tags: v.array(v.string()),
},
handler: async (ctx, args) => {
const response = await fetch(process.env.PROOMPTENG_URL + '/v1/queries:route', {
method: 'POST',
headers: {
'content-type': 'application/json',
authorization: 'Bearer ' + process.env.PROOMPTENG_API_KEY,
},
body: JSON.stringify({
prompt: args.prompt,
session: args.sessionId,
routing: { tags: args.tags, fallback: ['claude-3-5', 'o1-mini'] },
}),
});
if (!response.ok) {
throw new Error('failed to route prompt');
}
const result = await response.json();
await ctx.db.insert('inferences', {
sessionId: args.sessionId,
requestId: result.requestId,
model: result.model,
latencyMs: result.metrics?.totalLatencyMs,
createdAt: Date.now(),
});
return result;
},
});