Skip to main content

SpiceAgent

AI-powered agent that optimizes LTSpice circuit designs autonomously.

Overview

SpiceAgent uses an LLM to analyze netlists, propose parameter modifications, and run LTSpice simulations iteratively until the circuit meets the target specifications. The agent is capable of optimizing non-linear circuits and features a design tailored for effective human-machine interaction, allowing for collaborative circuit refinement.

Workflow: Analyze → Propose → Simulate → Evaluate → Iterate

Installation

You can install SpiceAgent directly from the source:

git clone https://github.com/DavideMilillo/SpiceAgent.git
cd SpiceAgent
pip install .

Or, you can install directly the python package: https://pypi.org/project/ltspice-agent/0.1.0/ pip install ltspice-agent==0.1.0

Quick Start (V2)

The recommended way to use SpiceAgent is via the PowerAgent class:

from spiceagent import PowerAgent

# 1. Initialize the agent
agent = PowerAgent(api_key="sk-...")

# 2. Define your initial guess and targets
initial_values = {
    'Vin': '12', 
    'Cin': '300u', 
    'L1': '14u', 
    'Cout': '38u', 
    'Rload': '6', 
    'Vsw': 'PULSE(0 10 0 1n 1n 4.4u 10u)',
    'D1': 'MBR745', 
    'M1': 'IRF1404'
}

targets = {
    "v_mean": 5.0,  # Target output voltage (Volts)
    "ripple": 10   # Maximum ripple allowed (%)
}

# 3. Run Optimization
# If circuit_path is None, it uses the built-in Buck Converter example.
# You can increase max_iterations if the agent needs more steps.
result = agent.optimize(
    circuit_path=None, 
    initial_values=initial_values,
    target_specs=targets,
    max_iterations=50
)

print("Optimization Complete!")
print("Final Values:", result.get("circuit_values"))

Interactive Mode (New in V3) ✅

For complex designs or when you need a "Human-in-the-Loop" approach, use the new PowerAgentV3.

Features:

  • Consultant Phase: Chat with the agent to define goals and identify tunable parameters.
  • Live Mode (Windows Only): Updates your .asc schematic in real-time as the agent optimizes.
  • Safe Mode: Works on a copy of your files (default).
from spiceagent import PowerAgentV3

# 1. Initialize
agent = PowerAgentV3()

# 2. Run Interactive Optimization
# This launches a CLI chat session.
agent.optimize(circuit_path="path/to/my_circuit.asc")

Project Structure

📦 SpiceAgent Package (New Standard)

  • src/spiceagent/: The source code of the package.
  • src/spiceagent/power_agent.py: The main PowerAgent class logic.

🔌 Legacy Scripts (V1)

  • PowerAgent/: Contains the original V1.5 script and LangGraph experiments.
  • BabySpiceAgent/: Simple RC circuit prototype.

Changelog

See CHANGELOG.md for version history.

License

MIT License

Author

Davide Milillo

Metadata

Release files for ltspice-agent 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ltspice-agent 0.2.0
File Size Uploaded
ltspice_agent-0.2.0.tar.gz 16.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ltspice-agent 0.2.0
File Interpreter ABI Platform
ltspice_agent-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.9 kB

Release files / ltspice_agent-0.2.0.tar.gz

Download URL ltspice_agent-0.2.0.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a3860fd63d5c78dae167eeb373c1a19ab52a34658ebb7391fd57ee35dde0b6ed
BLAKE2b-256 checksum
How to use checksums
3ab428a2a132a58dfcaad82e84e75db3bfb9841c2dc0a4d2ccd8fd91164325d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release files / ltspice_agent-0.2.0-py3-none-any.whl

Download URL ltspice_agent-0.2.0-py3-none-any.whl
Size 17.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5fef3e65af77c7b0d077f3afb5a8d7ab0c01d722a8dd14d073278d59e325041
BLAKE2b-256 checksum
How to use checksums
39e49dfe7f02b1e7924ca56227bc0adc6d1c8fb9dfe18a8204e46fd38c6d1320
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page