Calculator

Evaluate arithmetic expressions using a sandboxed Python script.

ag2ai b38734c 2 files · 1.8 KB Updated

File contents

Calculator

Use this skill whenever the user asks for an arithmetic calculation (addition, subtraction, multiplication, division, exponentiation, modulo, or any expression that combines them).

How to use

Call the run_skill_script tool with:

  • name: "calculator"
  • script: "calc.py"
  • args: a single-element list containing the expression as a string, e.g. ["(2 + 3) * 4"].

The script prints the result of the expression. Report the printed value back to the user verbatim.

Examples

  • "What's 17 * 23?" → args=["17 * 23"]
  • "Compute (100 - 7) / 3" → args=["(100 - 7) / 3"]

ag2ai/build-with-ag2/tree/main/.agents/skills/calculator commit b38734c914

Frequently asked questions

npx skillmds@latest add ag2ai/calculator