Skip to main content

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"))

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ltspice_agent-0.1.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ltspice_agent-0.1.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file ltspice_agent-0.1.1.tar.gz.

File metadata

  • Download URL: ltspice_agent-0.1.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for ltspice_agent-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ee2c98027f749338fc0dfa662149a92d04ff742554e2482b25a88e6f81cf9689
MD5 5346e817b3d77191ef229c33d6121071
BLAKE2b-256 2f67cb8044808f8bd918020fb5c0bc0ed4ef4579257984be05340f7facc8cac5

See more details on using hashes here.

File details

Details for the file ltspice_agent-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ltspice_agent-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for ltspice_agent-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c240860a2e1d3e6a8bf69645fb2d9292d2aad93a131c50e508a5df73e0abe10d
MD5 c6cf4bc2119a8aabb8b035cbfb92df16
BLAKE2b-256 e77191d5b24ad3ff60d5df4a02841b033ca8bf97aeb377f385ad84c72dc98174

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page