Skip to content

Tool Execution: Sandboxed Code Execution for Tool Orchestration #780

Description

@lmorchard

Concept from opencode:
Instead of forcing the LLM to make sequential, multi-turn tool calls, opencode gives the LLM a constrained JS subset runtime (packages/codemode). The LLM can write a small script that loops over data and calls host tools natively inside the sandbox, while strict budgets enforce limits.

How decafclaw could implement this:
decafclaw currently suffers from the overhead of multiple LLM round-trips when performing repetitive tasks (e.g., searching a codebase and reading 5 specific files based on the results).

Proposed Implementation:

  • Introduce a restricted execution environment (e.g. a sandboxed Python AST evaluator or embedded Lua runtime) mapped as a specific tool (execute_script).
  • Allow the LLM to write procedural logic (loops, conditionals) that executes locally against decafclaw's tool registry.
  • Establish strict timeout and max-call budgets on the execution runtime.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions