Executing code from an LLM

Search2o never runs arbitrary Python code, whoever wrote it. A future dynamic command will let an LLM write an agent in Search2o's own JSON format and run that agent instead.

The difference matters. A generated agent is still a set of commands. Its expressions run in the agent runtime, under the allowlist and the limits, and it produces the same trace as a hand-written agent. It can do only what a hand-written agent can do. Arbitrary code would bypass all of that, which is why it is ruled out rather than restricted.

Until the dynamic command is available, let the model decide what happens through tool calling: offer it functions that do the work, and it chooses which function to call and with which arguments. See the llm command.