← All tools

Knowledge & Research

Wolfram Alpha

Computational knowledge engine.

wolfram_alpha

Overview

The fact-and-math engine behind services like Siri. Ask it to compute an expression, convert units, or look up a scientific constant and it returns a precise answer instead of the language model guessing.

How it works

Sends the query to the Wolfram Alpha API and returns either a short one-line answer (the 'short answer' endpoint) or the full structured response with multiple solution pods (the 'full results' endpoint). Good for deterministic math, unit conversion, currency rates, and scientific lookups. Requires a free Wolfram AppID.

Example

When a user asks:

What's the derivative of x³ + 2x² − 5x?

the agent calls the tool:

wolfram_alpha(query="derivative of x^3 + 2x^2 - 5x")

and gets back: 3x² + 4x − 5, with optional step-by-step working.

Configuration

Set these before calling the tool. Values marked required must be present or the tool call will fail.

WOLFRAM_APPID required

Wolfram Alpha app ID from developer.wolframalpha.com. Read from env or the 'app_id' parameter.

swarmai.tools.wolfram.app-id optional

Spring property alternative to the env var.

Use it in a workflow

Wire this tool into a SwarmAI crew. Use the YAML DSL for declarative workflows, or the Java builder API when you want full programmatic control.

YAML DSL

# quant.yaml
name: quant-crew
process: SEQUENTIAL

agents:
  - id: quant
    role: Quant Analyst
    goal: Answer mathematical sub-questions with certainty
    tools:
      - wolfram_alpha

tasks:
  - id: quant-task
    agent: quant
    description: Compute the derivative of x^3 + 2x^2 - 5x step by step.

Java

import ai.intelliswarm.swarmai.agent.Agent;
import ai.intelliswarm.swarmai.task.Task;
import ai.intelliswarm.swarmai.swarm.Swarm;
import ai.intelliswarm.swarmai.swarm.SwarmOutput;
import ai.intelliswarm.swarmai.process.ProcessType;
import ai.intelliswarm.swarmai.tool.research.WolframAlphaTool;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.beans.factory.annotation.Autowired;

@Autowired ChatClient chatClient;
@Autowired WolframAlphaTool wolframAlphaTool;

Agent quant = Agent.builder()
    .role("Quant Analyst")
    .goal("Answer mathematical sub-questions with certainty")
    .chatClient(chatClient)
    .tool(wolframAlphaTool)
    .build();

Task quantTask = Task.builder()
    .description("Compute the derivative of x^3 + 2x^2 - 5x step by step.")
    .agent(quant)
    .build();

SwarmOutput result = Swarm.builder()
    .agent(quant)
    .task(quantTask)
    .process(ProcessType.SEQUENTIAL)
    .build()
    .kickoff();

What it's good for

Real scenarios where agents put this tool to work.

Math/calculus solving in reasoning agents
Unit conversion and physical constants
Computable factual answers (planetary data, chemistry)
Verifier pass on numeric LLM claims

Source

Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/research/WolframAlphaTool.java in the swarm-ai repository.

Open wolfram_alpha on GitHub →