Orq MCP is live: Use natural language to interrogate traces, spot regressions, and experiment your way to optimal AI configurations. Available in Claude Desktop, Claude Code, Cursor, and more. Start now →
generate_and_simulate() creates personas, scenarios, and opening messages from a brief agent description. Use this for a quick first pass.
Orq agent
OpenAI
num_personas × num_scenarios simulations run in parallel. Results are uploaded to AI Studio automatically.
Python
import asynciofrom evaluatorq.simulation import generate_and_simulateasync def main(): results = await generate_and_simulate( evaluation_name="support-agent-sim", target="agent:my-support-agent", agent_description=( "Customer support agent for an e-commerce store; " "handles refunds, orders, and product questions." ), num_personas=3, num_scenarios=4, # → 12 simulations total max_turns=6, evaluator_names=["goal_achieved", "criteria_met"], ) passed = sum(r.goal_achieved for r in results) print(f"Pass rate: {passed}/{len(results)}")if __name__ == "__main__": asyncio.run(main())
Pass any async function as target_callback. Set sim_model to route the simulator and judge through any provider. Set upload_results=False to keep results local.
Python
import asynciofrom openai import AsyncOpenAIfrom evaluatorq.contracts import Messagefrom evaluatorq.simulation import generate_and_simulateclient = AsyncOpenAI()SYSTEM = "You are a customer support agent for Acme Corp. Be concise and helpful."async def my_agent(messages: list[Message]) -> str: history = [{"role": "system", "content": SYSTEM}] history += [{"role": m.role, "content": m.content or ""} for m in messages] resp = await client.chat.completions.create(model="gpt-4o-mini", messages=history) return resp.choices[0].message.content or ""async def main(): results = await generate_and_simulate( evaluation_name="support-agent-sim", target_callback=my_agent, agent_description=( "Customer support agent for an e-commerce store; " "handles refunds, orders, and product questions." ), num_personas=3, num_scenarios=4, sim_model="gpt-4o-mini", # simulator + judge provider max_turns=6, evaluator_names=["goal_achieved", "criteria_met"], upload_results=False, ) passed = sum(r.goal_achieved for r in results) print(f"Pass rate: {passed}/{len(results)}")if __name__ == "__main__": asyncio.run(main())
Use generate_personas([...]) and generate_scenarios([...]) (also from evaluatorq.simulation) to generate multiple objects in one call.
Replace target with target_callback=<my_async_fn>, add sim_model="gpt-4o-mini" to set the simulator/judge provider, and set upload_results=False to keep results local.