Sandbox Algorithms
Purpose
Execute small deterministic algorithm tasks through the EdgeOne sandbox code interpreter instead of relying only on model reasoning.
When to Use
Use this skill for requests involving:
- Fibonacci sequence calculation.
- Factorial calculation.
- Prime or composite number checks.
- Prime list generation.
- Sorting or searching examples.
- Combination, permutation, or binomial coefficient calculation.
- Small dynamic programming demonstrations.
- User requests that explicitly mention sandbox execution, runCode, code_interpreter, or algorithm scripts.
Workflow
- Identify the algorithm task and required inputs.
- Prefer the reusable implementations in
scripts/algorithms.py. - Build a small self-contained Python snippet that imports or includes the relevant implementation.
- Execute the snippet with the EdgeOne sandbox
code_interpretertool. - Inspect
results,logs, anderror. - If execution fails, fix the code and run once more.
- Return the final answer with a short explanation and the executed result.
Tool Usage Rules
- Use
code_interpreterfor actual computation whenever available. - Do not fake tool outputs.
- Do not rely only on mental arithmetic for requested algorithm execution.
- Keep code snippets deterministic and self-contained.
- Set a reasonable timeout, usually 5 to 15 seconds for small algorithms.
- Avoid network access unless the user explicitly asks for it.
- Avoid writing files unless a file is necessary for the task.
Output Format
Return:
## Result
...
## Method
- Algorithm: ...
- Executed with: EdgeOne sandbox `code_interpreter`
## Execution Output
```text
...
```
For very small answers, keep the response concise.