Wolfram Agent¶
The Wolfram Agent
is a third-party agent powered by Wolfram|Alpha and the Wolfram Language, designed to perform advanced computations, mathematical derivations, scientific data lookups, visualizations, and knowledge-based queries.
Our AI Refinery SDK enables seamless integration with a customized Wolfram Agent
through the WolframAgent
class. This integration brings the full computational and knowledge power of Wolfram into applications on the AI Refinery platform.
Creating Wolfram Agents ¶
To create and use a Wolfram Agent
, follow these steps:
- Sign Up for a Wolfram account.
- Obtain a Wolfram App ID from Wolfram Developer Portal. You will need this later to access the agent.
-
Ensure network access to the Wolfram|Alpha LLM API endpoint and verify your API key by making a test query with your App ID (e.g., using
where you can substitutecurl
).WOLFRAM_LLM_API
with the API you intend to use (https://www.wolframalpha.com/api/v1/llm-api
) andYOUR_APP_ID
with you API key you obtained in step 2. -
Use this App ID and endpoint to configure your agent in AI Refinery.
Onboarding Wolfram Agent¶
To use the Wolfram agent through our AI Refinery SDK, users need the following configuration parameters:
Variable | Description | Required |
---|---|---|
app_id |
Name of the environment variable holding your Wolfram App ID (e.g., "WOLFRAM_APP_ID" ). |
Yes |
base_url |
Wolfram LLM API base URL (default: https://www.wolframalpha.com/api/v1/llm-api ). |
Yes |
timeout |
Time (in seconds) to wait for a Wolfram API response. | No |
enable_interpreter |
Boolean switch to enable an interpreter helper that translates the Wolfram raw responses in a user-friendly format. | No |
output_format |
Exhaustive list of Wolfram-provided components to include in responses ("text" , "images" , "website_link" ). |
No |
Workflow Overview¶
The workflow of the WolframAgent
class consists of four key stages:
- Initialization: A Wolfram agent is created and registered in AI Refinery with the specified configuration.
- Sending a Query: A user query is forwarded from the AI Refinery to the Wolfram API endpoint.
- Wolfram-side Processing: Wolfram evaluates the computation, retrieves data, or generates plots/visualizations.
- Receiving and Formatting: The Wolfram agent collects the raw API response. If the interpreter is enabled, the raw response is reformatted into user-friendly text, images, and/or links according to the settings in
output_format
.
Usage and Quickstart¶
To quickly establish an AI Refinery project with a Wolfram Agent
, you will need:
- A valid Wolfram App ID.
- A YAML configuration file that registers
WolframAgent
as a utility agent.
Specifically, ensure the following configurations are included:
- Add a utility agent with
agent_class: WolframAgent
underutility_agents
. - Ensure the
agent_name
you chose for yourWolframAgent
is listed in theagent_list
underorchestrator
.
Template YAML Configuration of WolframAgent¶
orchestrator:
agent_list:
- agent_name: "WolframComputationalAgent" # The name you choose for your Wolfram agent
utility_agents:
- agent_class: WolframAgent
agent_name: "WolframComputationalAgent" # The name you choose for your Wolfram agent
agent_description: "An assistant that can perform computations, solve equations, and provide scientific knowledge."
config:
app_id: "WOLFRAM_APP_ID" # Required: Name of the environment variable holding your Wolfram App ID
base_url: "https://www.wolframalpha.com/api/v1/llm-api" # Required: Wolfram LLM API endpoint
timeout: 60 # Optional: Timeout in seconds (default: 60)
enable_interpreter: true # Optional: Enables interpreter for formatted responses
output_format: ["text", "images", "website_link"] # Optional: Output components