>_ The Manifest

LLMs handle language brilliantly but stumble on arithmetic, a problem when your declarative agent needs to answer policy questions and crunch real numbers. Embedded Knowledge gives your agent document grounding, but it can’t reliably calculate a 401(k) match. Code Interpreter fills that gap, and enabling it takes a single line of JSON.

What Is Code Interpreter?

Code Interpreter is a built-in capability for declarative agents that lets M365 Copilot write and execute Python code on the fly. When the agent encounters a question that requires computation (calculations, data transformations, even chart generation), it spins up a sandboxed Python environment, runs the code, and returns the result.

You don’t see the code (unless you want to). You just get the answer.

The key insight is that the agent decides when to use it. You’re not building a pipeline that routes math questions to a calculator. You’re telling the orchestrator: “Hey, this agent is allowed to run code.” Copilot’s orchestrator figures out when that capability is the right tool for the job.

📝 Note

Code Interpreter runs in a secure, sandboxed environment managed by Microsoft. Your agent doesn’t need any external services, Azure subscriptions, or API keys. The Python runtime is ephemeral; it spins up for the calculation and tears down when done.

Enabling Code Interpreter

Enabling it is a single entry in your capabilities array:

"capabilities": [
  {
    "name": "CodeInterpreter"
  }
]

If you already have other capabilities, just add it alongside them:

"capabilities": [
  {
    "name": "EmbeddedKnowledge",
    "files": [
      { "file": "employee-handbook.docx" },
      { "file": "benefits-guide.docx" },
      { "file": "it-setup-guide.docx" }
    ]
  },
  {
    "name": "CodeInterpreter"
  }
]

Embedded Knowledge for document grounding, Code Interpreter for precise computation.

💡 Tip

Add a line to your agent’s instructions like: “When performing calculations involving salary, benefits, PTO accrual, or financial projections, use the code interpreter to ensure accuracy.” This nudges the agent toward using Code Interpreter for numerical questions and keeps responses clean for end users.

Where Code Interpreter Shines

Three scenarios show how Code Interpreter transforms the HR Onboarding Buddy from “helpful but vague” to trustworthy.

401(k) Matching Calculations

A new hire asks:

HR Onboarding Buddy

I make $95,000 and want to contribute 8% to my 401(k). How much will I and Zava Insurance contribute over the year, and what’s my take-home impact per paycheck?

Here’s the breakdown based on the Zava Insurance Benefits Guide:

  • Your 8% contribution: $7,600/year ($316.67/paycheck)
  • Zava Insurance’s 6% match: $5,700/year (they match dollar-for-dollar up to 6%)
  • Total going into your 401(k): $13,300/year

Your pre-tax paycheck impact: ~$316.67 less per semi-monthly paycheck, but your actual take-home reduction is ~$237 after the tax benefit.

Embedded Knowledge provides the policy context, Code Interpreter provides the math. Precise, not approximate.

PTO Accrual Over Time

HR Onboarding Buddy

How does my PTO accrual work over my first 3 years? Can you chart it?

Based on the Employee Handbook, here’s how your PTO accrual builds over your first 3 years at Zava Insurance:

  • Year 1: 15 days (1.25 days/month)
  • Year 2: 17 days (1.42 days/month)
  • Year 3: 20 days (1.67 days/month)

I’ve generated a month-by-month accrual chart showing your running PTO balance across all 36 months.

[Chart shown inline]

Knowledge, computation, and visualization in one response.

Health Insurance Cost Comparison

HR Onboarding Buddy

I’m choosing between the Silver and Gold health plans. My spouse and I have about $4,000 in annual medical expenses. Which plan saves us more money?

Based on the Zava Insurance Benefits Guide, here’s the total annual cost at $4,000 in medical expenses:

Silver PlanGold Plan
Annual premium$1,980$3,360
Deductible applied$1,500$500
Out-of-pocket (after deductible)$2,500$3,500
Total annual cost$5,980$7,360

At your spending level, the Silver plan saves you approximately $1,380/year. If your expenses were above $6,000, the Gold plan would become more cost-effective.

The agent looks up plan details from the Benefits Guide and runs a total-cost-of-ownership calculation with numbers to back up the recommendation.

Where Code Interpreter Shines

Code Interpreter has a clear sweet spot. It excels when your agent needs to go beyond text and actually compute something:

  • Financial calculations such as salary breakdowns, benefits estimates, and tax projections
  • Data analysis and comparisons across plans, policies, or options
  • Generating charts and visualizations for trends, accruals, or cost comparisons
  • Date math including PTO accrual, leave calculations, and scheduling
  • Conversions and unit math for currency, measurements, or rate calculations

For tasks that don’t involve computation, other capabilities are a better fit. Policy questions are best answered through Embedded Knowledge, creative image generation through GraphicArt, and live information through WebSearch. Simple factual lookups (“What’s the dress code?”) don’t need Code Interpreter at all.

⚠️ Warning

Code Interpreter adds latency. The Python environment needs to spin up, execute, and return results. For simple factual questions that don’t need computation, it’s slower than a direct response from Embedded Knowledge. Be intentional about what you enable; every capability you add is a capability the agent might use when you don’t expect it.

The principle is intentional configuration. Enable Code Interpreter when your agent’s domain involves numbers, dates, or data. Don’t enable it “just in case”; that invites the orchestrator to reach for it in situations where a straightforward text response would be faster and better.

The Value: Trust Through Precision

Code Interpreter matters for enterprise agents because of trust. An approximate benefits answer creates doubt; employees second-guess it, open spreadsheets, email HR. A precise answer with exact dollar amounts? They act on it.

For HR scenarios (benefits, payroll, PTO, compensation), precision is table stakes. Nobody wants “approximately $237” on their paycheck. They want $237.50. Code Interpreter gets you there.

Resources

Have questions or want to share what you're building? Connect with me on LinkedIn or check out more on The Manifest.