An AI-agent for optimization of power electronics circuits
Project description
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
.ascschematic 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 mainPowerAgentclass 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ltspice_agent-0.2.0.tar.gz.
File metadata
- Download URL: ltspice_agent-0.2.0.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3860fd63d5c78dae167eeb373c1a19ab52a34658ebb7391fd57ee35dde0b6ed
|
|
| MD5 |
6b788a63d233032477c1d5cfce234c2a
|
|
| BLAKE2b-256 |
3ab428a2a132a58dfcaad82e84e75db3bfb9841c2dc0a4d2ccd8fd91164325d7
|
File details
Details for the file ltspice_agent-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ltspice_agent-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5fef3e65af77c7b0d077f3afb5a8d7ab0c01d722a8dd14d073278d59e325041
|
|
| MD5 |
a31830a70bf1f30aa514b042077443d3
|
|
| BLAKE2b-256 |
39e49dfe7f02b1e7924ca56227bc0adc6d1c8fb9dfe18a8204e46fd38c6d1320
|