Executing code from an LLM

Search2o will never execute arbitrary Python code. A future dynamic command will let an LLM generate an agent in Search2o's own JSON format and execute that agent.

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

Until the dynamic command ships, use tool calling to let a model decide what happens: offer the model functions that do the work, and let the model choose which function to call and with which arguments. See the llm command.