Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Amy is an intelligent Julia agent for scientific computing with natural language queries and multi-domain mathematical reasoning.

License

Notifications You must be signed in to change notification settings

agenisea/agentic-mathematical-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Amy - Agentic Mathematical Engine

An intelligent computational reasoning system for scientific research

License: MIT

Note: This project is an experiment and a work in progress. All contributions are welcome!

The Problem

Scientists and engineers face a gap between what they want to compute and how to compute it:

  • Traditional tools require specifying exact operations: "Differentiate xΒ² + 2x"
  • But researchers think in goals: "Find where this function has extrema"
  • Complex problems require chaining multiple tools across domains
  • Manual verification is tedious and error-prone
  • Results lack reasoning traces for reproducibility

The Solution

Agentic Mathematical Engine bridges this gap with an intelligent agent that:

  • Understands natural language mathematical queries
  • Plans multi-step solutions automatically
  • Executes computations across seven mathematical domains
  • Verifies results for correctness and physical validity
  • Explains reasoning traces for full transparency

How It Works

  1. Describe your goal in natural language
  2. Agent decomposes the problem into sub-goals
  3. Tools execute the required computations
  4. Verification ensures correctness
  5. Explanation provides reasoning trace
using AgenticMathematicalEngine

# Natural language query
response = solve("Design a Hohmann transfer from Earth to Mars with minimum fuel")

# Get results with full explanation
println(response.result)       # Ξ”v = 5.59 km/s, transfer time = 259 days
println(response.explanation)  # Step-by-step reasoning
println(response.confidence)   # 0.95

Features

Seven Mathematical Domains

Domain Capabilities
Symbolic Algebra, calculus, equation solving, simplification
Numerical ODEs, PDEs, integration, optimization, N-body simulation
Tensor General relativity, differential geometry, index manipulation
Coordinate Reference frames, orbital mechanics, unit conversion
Propulsion Rocket equations, delta-v budgets, trajectory optimization
Linear Algebra Eigenanalysis, decompositions, matrix calculus
Physics Electromagnetism, thermodynamics, fluids, quantum mechanics

Intelligent Agent Capabilities

  • Dynamic Planning β€” Automatically decomposes complex problems
  • Tool Selection β€” Chooses appropriate methods for each sub-goal
  • Verification β€” Checks units, conservation laws, physical bounds
  • Replanning β€” Adapts when approaches fail
  • Explanation β€” Generates reasoning traces for reproducibility

Built-in Knowledge

  • Solar system body data (planets, moons)
  • Physical constants with units
  • Material properties
  • Reference values for verification

Installation

Prerequisites

  • Julia 1.9 or higher
  • ~2GB disk space for dependencies

Install from Source

git clone https://github.com/agenisea/agentic-mathematical-engine.git
cd agentic-mathematical-engine
julia --project=. -e 'using Pkg; Pkg.instantiate()'

LLM Configuration

Amy uses Ollama with DeepSeek-R1 for LLM-powered reasoning. Ensure Ollama is running locally:

# Install Ollama (macOS)
brew install ollama

# Pull the DeepSeek-R1 model
ollama pull deepseek-r1:latest

# Start Ollama server (runs on localhost:11434 by default)
ollama serve

Usage

Basic Usage

using AgenticMathematicalEngine

# Simple query
response = solve("What is the derivative of xΒ³ + 2xΒ²?")
println(response.result)  # 3xΒ² + 4x

# Trajectory design
response = solve("Design a Hohmann transfer from LEO (400km) to GEO")
println(response.result.delta_v_total)  # ~3.9 km/s

# Stability analysis
response = solve("Is the L4 Lagrange point stable for the Sun-Earth system?")
println(response.result)  # STABLE (with eigenvalue analysis)

Multi-turn Conversations

agent = Agent()

response1 = agent("Set up a simple harmonic oscillator with Ο‰ = 5 rad/s")
response2 = agent("Now add damping with ΞΆ = 0.3")
response3 = agent("Find the damped natural frequency")

Configuration

config = AgentConfig(
    max_tool_calls = 50,
    verification_level = :thorough,  # :minimal, :standard, :thorough
    explanation_detail = :verbose,   # :brief, :standard, :verbose
    timeout_seconds = 300,
)

response = solve("Complex multi-step problem...", config=config)

Examples

The examples/ directory contains comprehensive demonstrations:

Example Description
llm_demo.jl Interactive LLM demo with real-time event streaming
trajectory_design.jl Orbital mechanics, mission design, gravity assists
stability_analysis.jl Eigenvalue analysis, Lagrange points, control systems
physics_simulation.jl Heat transfer, E&M, quantum mechanics, N-body
symbolic_derivation.jl Calculus, series expansions, tensor calculus

Run an example:

julia --project=. examples/trajectory_design.jl

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         USER QUERY                              β”‚
β”‚  "Design a Hohmann transfer from Earth to Mars"                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      REASONING AGENT                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ UNDERSTAND β”‚β†’ β”‚   PLAN     β”‚β†’ β”‚  EXECUTE   β”‚β†’ β”‚  VERIFY   β”‚  β”‚
β”‚  β”‚            β”‚  β”‚            β”‚  β”‚            β”‚  β”‚           β”‚  β”‚
β”‚  β”‚ Parse      β”‚  β”‚ Decompose  β”‚  β”‚ Run tools  β”‚  β”‚ Check     β”‚  β”‚
β”‚  β”‚ intent     β”‚  β”‚ into goals β”‚  β”‚ Get resultsβ”‚  β”‚ results   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚                    WORKING MEMORY                        β”‚   β”‚
β”‚  β”‚  β€’ Goal stack  β€’ Intermediate results  β€’ Confidence      β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        TOOL SUITE                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚SYMBOLIC β”‚ β”‚NUMERICALβ”‚ β”‚ TENSOR  β”‚ β”‚COORD    β”‚ β”‚PROPULSIONβ”‚  β”‚
β”‚  β”‚         β”‚ β”‚         β”‚ β”‚         β”‚ β”‚         β”‚ β”‚          β”‚  β”‚
β”‚  β”‚simplify β”‚ β”‚solve_odeβ”‚ β”‚riemann  β”‚ β”‚kepler   β”‚ β”‚hohmann   β”‚  β”‚
β”‚  β”‚diff     β”‚ β”‚optimize β”‚ β”‚geodesic β”‚ β”‚ephemerisβ”‚ β”‚lambert   β”‚  β”‚
β”‚  β”‚integrateβ”‚ β”‚nbody    β”‚ β”‚contract β”‚ β”‚transformβ”‚ β”‚delta_v   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚ MATRIX  β”‚ β”‚ PHYSICS β”‚ β”‚         VERIFICATION           β”‚    β”‚
β”‚  β”‚         β”‚ β”‚         β”‚ β”‚                                β”‚    β”‚
β”‚  β”‚eigen    β”‚ β”‚maxwell  β”‚ β”‚ check_units  check_conservationβ”‚    β”‚
β”‚  β”‚decomposeβ”‚ β”‚heat     β”‚ β”‚ check_bounds numerical_verify  β”‚    β”‚
β”‚  β”‚jacobian β”‚ β”‚quantum  β”‚ β”‚                                β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                          OUTPUT                                 β”‚
β”‚  Result: Ξ”v_total = 5.59 km/s, Transfer time = 259 days         β”‚
β”‚  Reasoning: Decomposed into orbital parameters, vis-viva...     β”‚
β”‚  Confidence: 0.95 (verified against reference data)             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Multi-Agent LLM Pipeline

Amy uses 5 specialized LLM agents orchestrated by a supervisor:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           LLM AGENT PIPELINE                                β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                      β”‚
β”‚  β”‚ INTERPRETER │───▢│   PLANNER   │───▢│  EXECUTOR   β”‚                      β”‚
β”‚  β”‚             β”‚    β”‚             β”‚    β”‚             β”‚                      β”‚
β”‚  β”‚ Parse query β”‚    β”‚ Decompose   β”‚    β”‚ Map goals   β”‚                      β”‚
β”‚  β”‚ Extract     β”‚    β”‚ into goal   β”‚    β”‚ to tools    β”‚                      β”‚
β”‚  β”‚ intent      β”‚    β”‚ DAG         β”‚    β”‚ Execute     β”‚                      β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜                      β”‚
β”‚                                               β”‚                             β”‚
β”‚                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚
β”‚                      β”‚                                             β”‚        β”‚
β”‚                      β–Ό                                             β–Ό        β”‚
β”‚               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚               β”‚  VERIFIER   β”‚                              β”‚  EXPLAINER  β”‚  β”‚
β”‚               β”‚             β”‚                              β”‚             β”‚  β”‚
β”‚               β”‚ Validate    β”‚                              β”‚ Generate    β”‚  β”‚
β”‚               β”‚ results     β”‚                              β”‚ natural     β”‚  β”‚
β”‚               β”‚ Check units β”‚                              β”‚ language    β”‚  β”‚
β”‚               β”‚ & bounds    β”‚                              β”‚ explanation β”‚  β”‚
β”‚               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Agent Role Output Format
INTERPRETER Parse natural language, extract intent & entities Structured JSON intent
PLANNER Decompose problem into goal DAG Goal nodes with dependencies
EXECUTOR Map goals to tools, prepare parameters Tool call specifications
VERIFIER Validate results against physical laws Pass/Warn/Fail verdict
EXPLAINER Generate human-readable explanations Summary with LaTeX equations

Parallel Execution Architecture (Fan-Out/Fan-In)

Amy uses a DAG-based parallel execution model to maximize throughput when goals are independent:

                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β”‚           PLANNER                   β”‚
                         β”‚   Creates Goal DAG with deps        β”‚
                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β”‚
                                        β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚          PARALLEL SCHEDULER               β”‚
                    β”‚   Identifies independent goals            β”‚
                    β”‚   Groups into execution batches           β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚                             β”‚                             β”‚
          β–Ό                             β–Ό                             β–Ό
   ══════════════════════════════════════════════════════════════════════
                              FAN-OUT PHASE
   ══════════════════════════════════════════════════════════════════════
          β”‚                             β”‚                             β”‚
          β–Ό                             β–Ό                             β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚   GOAL 1    β”‚               β”‚   GOAL 2    β”‚               β”‚   GOAL 3    β”‚
   β”‚   (no deps) β”‚               β”‚   (no deps) β”‚               β”‚   (no deps) β”‚
   β”‚             β”‚               β”‚             β”‚               β”‚             β”‚
   β”‚  Execute    β”‚               β”‚  Execute    β”‚               β”‚  Execute    β”‚
   β”‚  Tool A     β”‚               β”‚  Tool B     β”‚               β”‚  Tool C     β”‚
   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜               β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜               β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
          β”‚                             β”‚                             β”‚
          β–Ό                             β–Ό                             β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  VERIFIER   β”‚               β”‚  VERIFIER   β”‚               β”‚  VERIFIER   β”‚
   β”‚  (parallel) β”‚               β”‚  (parallel) β”‚               β”‚  (parallel) β”‚
   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜               β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜               β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
          β”‚                             β”‚                             β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β”‚
   ══════════════════════════════════════════════════════════════════════
                               FAN-IN PHASE
   ══════════════════════════════════════════════════════════════════════
                                        β”‚
                                        β–Ό
                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β”‚       THREAD-SAFE MEMORY            β”‚
                         β”‚   Collects results from all goals   β”‚
                         β”‚   Tracks verification status        β”‚
                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β”‚
                                        β–Ό
                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β”‚          NEXT BATCH                 β”‚
                         β”‚   Goals with satisfied deps         β”‚
                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚                             β”‚                             β”‚
          β–Ό                             β–Ό                             β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚   GOAL 4    β”‚               β”‚   GOAL 5    β”‚               β”‚   GOAL 6    β”‚
   β”‚ (deps: 1,2) β”‚               β”‚ (deps: 2,3) β”‚               β”‚ (deps: 1)   β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β”‚
                                        β–Ό
                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β”‚          EXPLAINER                  β”‚
                         β”‚   Generates unified explanation     β”‚
                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Features of Parallel Execution

Feature Description
DAG Scheduling Goals form a directed acyclic graph; independent goals run concurrently
Batch Execution Goals grouped into batches based on dependency satisfaction
Thread-Safe Memory Concurrent writes protected with ReentrantLock
Parallel Verification Each goal verified independently, can run alongside next batch
Automatic Fallback Falls back to sequential execution for single-goal plans
Budget Management Token budgets tracked per-agent with atomic counters

Execution Modes

# Automatic mode selection based on goal count and dependencies
config = PipelineConfig(
    enable_parallel_execution = true,   # Enable parallel when beneficial
    max_concurrent_goals = 4,           # Max parallel goals
    enable_parallel_verification = true # Verify concurrently
)

When Parallel Execution is Used:

  • Plan has 2+ goals
  • Goals have independent dependencies (can run in parallel batches)
  • Budget permits concurrent LLM calls

When Sequential Execution is Used:

  • Single goal plans
  • Strictly linear dependencies (each goal depends on previous)
  • Fallback mode (budget/circuit breaker constraints)

Project Structure

agentic-mathematical-engine/
β”œβ”€β”€ Project.toml              # Julia package manifest
β”œβ”€β”€ Manifest.toml             # Dependency lock file
β”œβ”€β”€ README.md                 # This file
β”œβ”€β”€ CONTRIBUTING.md           # Contribution guidelines
β”œβ”€β”€ CODE_OF_CONDUCT.md        # Community standards
β”œβ”€β”€ SECURITY.md               # Security policy
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ AgenticMathematicalEngine.jl  # Main module
β”‚   β”‚
β”‚   β”œβ”€β”€ types/                # Core type definitions
β”‚   β”‚   β”œβ”€β”€ goals.jl          # Goal & GoalStatus
β”‚   β”‚   β”œβ”€β”€ plans.jl          # Plan & PlanStatus
β”‚   β”‚   β”œβ”€β”€ memory.jl         # WorkingMemory
β”‚   β”‚   β”œβ”€β”€ tools.jl          # ToolDefinition
β”‚   β”‚   └── results.jl        # AgentResponse, Explanation
β”‚   β”‚
β”‚   β”œβ”€β”€ agent/                # Agent components
β”‚   β”‚   β”œβ”€β”€ core.jl           # Main agent loop
β”‚   β”‚   β”œβ”€β”€ understanding.jl  # Intent parsing
β”‚   β”‚   β”œβ”€β”€ planning.jl       # Problem decomposition
β”‚   β”‚   β”œβ”€β”€ execution.jl      # Tool invocation
β”‚   β”‚   β”œβ”€β”€ verification.jl   # Result checking
β”‚   β”‚   └── explanation.jl    # Reasoning traces
β”‚   β”‚
β”‚   β”œβ”€β”€ tools/                # Mathematical tools
β”‚   β”‚   β”œβ”€β”€ registry.jl       # Tool registry
β”‚   β”‚   β”œβ”€β”€ symbolic.jl       # Symbolic math
β”‚   β”‚   β”œβ”€β”€ numerical.jl      # Numerical methods
β”‚   β”‚   β”œβ”€β”€ tensor.jl         # Tensor algebra
β”‚   β”‚   β”œβ”€β”€ coordinate.jl     # Coordinate systems
β”‚   β”‚   β”œβ”€β”€ propulsion.jl     # Propulsion tools
β”‚   β”‚   β”œβ”€β”€ matrix.jl         # Linear algebra
β”‚   β”‚   β”œβ”€β”€ physics.jl        # Physics tools
β”‚   β”‚   └── verification.jl   # Verification tools
β”‚   β”‚
β”‚   β”œβ”€β”€ strategies/           # Problem-solving strategies
β”‚   β”‚   β”œβ”€β”€ base.jl           # Strategy interface
β”‚   β”‚   β”œβ”€β”€ trajectory.jl     # Trajectory design
β”‚   β”‚   β”œβ”€β”€ stability.jl      # Stability analysis
β”‚   β”‚   β”œβ”€β”€ derivation.jl     # Mathematical derivation
β”‚   β”‚   β”œβ”€β”€ simulation.jl     # Physics simulation
β”‚   β”‚   └── optimization.jl   # Optimization problems
β”‚   β”‚
β”‚   β”œβ”€β”€ knowledge/            # Built-in knowledge
β”‚   β”‚   β”œβ”€β”€ constants.jl      # Physical constants
β”‚   β”‚   β”œβ”€β”€ bodies.jl         # Celestial body data
β”‚   β”‚   β”œβ”€β”€ materials.jl      # Material properties
β”‚   β”‚   └── references.jl     # Reference values
β”‚   β”‚
β”‚   β”œβ”€β”€ util/                 # Utilities
β”‚   β”‚   β”œβ”€β”€ units.jl          # Unit handling
β”‚   β”‚   β”œβ”€β”€ latex.jl          # LaTeX generation
β”‚   β”‚   └── logging.jl        # Logging utilities
β”‚   β”‚
β”‚   β”œβ”€β”€ llm/                  # LLM Integration Layer
β”‚   β”‚   β”œβ”€β”€ client.jl         # Ollama client
β”‚   β”‚   β”œβ”€β”€ events.jl         # Event streaming
β”‚   β”‚   β”œβ”€β”€ parser.jl         # Response parsing
β”‚   β”‚   β”œβ”€β”€ prompts.jl        # Agent prompts
β”‚   β”‚   └── fallback.jl       # Fallback handlers
β”‚   β”‚
β”‚   β”œβ”€β”€ orchestration/        # Multi-Agent Orchestration
β”‚   β”‚   β”œβ”€β”€ supervisor.jl     # Pipeline supervisor
β”‚   β”‚   β”œβ”€β”€ parallel.jl       # Parallel execution
β”‚   β”‚   β”œβ”€β”€ budget.jl         # Token budget management
β”‚   β”‚   └── resilience.jl     # Circuit breakers
β”‚   β”‚
β”‚   └── prompts/              # Agent System Prompts
β”‚       β”œβ”€β”€ interpreter.md    # Intent parsing prompt
β”‚       β”œβ”€β”€ planner.md        # Goal decomposition prompt
β”‚       β”œβ”€β”€ executor.md       # Tool invocation prompt
β”‚       β”œβ”€β”€ verifier.md       # Result validation prompt
β”‚       └── explainer.md      # Explanation generation prompt
β”‚
β”œβ”€β”€ examples/                 # Example scripts
β”‚   β”œβ”€β”€ trajectory_design.jl
β”‚   β”œβ”€β”€ stability_analysis.jl
β”‚   β”œβ”€β”€ physics_simulation.jl
β”‚   └── symbolic_derivation.jl
β”‚
└── test/                     # Test suite
    β”œβ”€β”€ runtests.jl
    β”œβ”€β”€ unit/
    β”œβ”€β”€ integration/
    └── validation/

Tech Stack

  • Julia 1.9+ β€” High-performance scientific computing
  • Symbolics.jl β€” Computer algebra system
  • DifferentialEquations.jl β€” ODE/PDE solvers
  • Unitful.jl β€” Physical units with type safety
  • Optim.jl β€” Optimization algorithms
  • LinearAlgebra β€” Matrix operations
  • ForwardDiff.jl β€” Automatic differentiation

Design Artifacts

This repo includes the original planning and agent-design docs used to architect the systemβ€”shared intentionally for transparency and reuse. These documents are optional; the engine runs independently of them.

Roadmap

  • Core agent architecture
  • Seven mathematical domains
  • Verification system
  • Comprehensive examples
  • LLM integration (Ollama/DeepSeek-R1)
  • Multi-agent orchestration (5 specialized agents)
  • Parallel execution with fan-out/fan-in
  • Token budget management
  • Circuit breaker resilience
  • Web interface
  • Jupyter notebook integration
  • GPU acceleration for N-body
  • More physics domains (plasma, relativity)

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Quick Start for Contributors

# Clone and setup
git clone https://github.com/agenisea/agentic-mathematical-engine.git
cd agentic-mathematical-engine
julia --project=. -e 'using Pkg; Pkg.instantiate()'

# Run tests
julia --project=. -e 'using Pkg; Pkg.test()'

# Run examples
julia --project=. examples/trajectory_design.jl

License

MIT License - see LICENSE for details.

Support


Built by Ageniseaβ„’ πŸͺΌ

About

Amy is an intelligent Julia agent for scientific computing with natural language queries and multi-domain mathematical reasoning.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages