AI Agents
Connect your desktop AI Agent to MesoSim to develop strategies, submit and monitor backtests, and analyze results in a conversation. AI Agents are available on Advanced and FundPro. See Accounts and Access for the plan comparison.
The MesoSim plugin from Deltaray gives the agent access to MesoSim's tools. It uses your API connection, and you can inspect the same runs in Backtests. You do not need to write API requests to use the plugin.
Set up the agent
Install the plugin
Use the Portal setup guide for Codex Desktop or Claude Desktop. It covers the desktop app prerequisites, including Node.js 22 or later.
Add the Deltaray plugin marketplace in your app's plugin settings using this repository:
deltaray-io/ai-plugins
Find MesoSim from Deltaray and install it. Start a new local task in Codex Desktop or a new conversation in Claude Desktop.
Connect your account
Create an API key on your MesoSim Portal. Then ask the agent:
Use MesoSim to check my setup.
The agent prepares .env.mesosim and shows its location. Open that file, enter your connection details, and save it:
MESOSIM_INSTANCE=https://mesosim.io
MESOSIM_API_KEY=your-api-key
For retail, use https://mesosim.io. For FundPro, use your own Portal's HTTPS address without /api or another path. Enter the key in the file on your computer; do not paste it into the conversation.
Check the connection
Close and reopen the desktop app to load the settings. Start a new conversation and ask:
List my last 10 backtests in MesoSim.
A list, or confirmation that you have no backtests yet, verifies the connection. If it fails, ask the agent to check your setup again. Check the API key setup and consult the API reference for response details.
Agentic workflow
Give the agent a research question, the settings it must preserve, and a limit on the runs you want it to perform. The agent uses the MesoSim plugin to carry out the work: prepare a definition, validate it, submit a backtest, monitor its status, retrieve results, and use those results to guide the next experiment. You steer the research and review the evidence it reports.
Develop and run a strategy
Describe the instrument, backtest period, capital, structure, sizing, entry schedule, exits, and adjustments. Ask the agent to clarify missing decisions and show the complete Strategy Definition before execution.
The agent validates the definition, submits the run through the API, and polls until it finishes. If validation or execution fails, ask it to inspect the reported error and propose a correction. Validation checks the definition; the historical simulation can still reveal data or runtime issues.
The corresponding manual steps are editing in the Job Editor and following a run in Backtests. With the agent, submission and monitoring happen through the conversation.
Investigate the results
Ask the agent to retrieve the run's metrics, NAV series, and events, then analyze the question you set. It can summarize performance, identify drawdown periods, trace the positions and adjustments involved, and explain its findings with the backtest link and supporting data.
For example, ask which positions contributed most to the largest drawdown and how their entries, adjustments, and exits affected the outcome. The agent should connect its explanation to the recorded results.
For a visual check in the Portal, Tearsheets show performance, Events Viewer shows the execution events, and Position Monitor lets you inspect position behavior. These are the UI counterparts to the agent's analysis. See Quantitative Metrics for the metric definitions.
Compare and refine
Ask the agent to create and run a revised definition programmatically, preserving the baseline. Change one setting at a time and compare the results across runs. The agent can collect the metrics, calculate differences, and report which changes helped or hurt, along with the run identifiers and links.
For entry-variable research, it can analyze captured entry values against final position outcomes. The corresponding interactive charting workflow is described in Analytics with DataVoyager.
Example: a bounded experiment
Use MesoSim to investigate whether entry time affects this strategy. Start from backtest [ID]. Run two variants: enter 30 minutes and 60 minutes before market close. Keep the dates, structure, position size, costs, exits, and adjustments unchanged. Validate each definition, run and monitor both variants, then compare them with the baseline. Summarize trade count, returns, and drawdowns, investigate the events behind any large difference, and link all three runs. Stop after these two new runs and recommend the next experiment.
For worked strategy ideas, visit the Deltaray blog. Return to AI Assisted development to explore the other AI workflows.