Skip to main content

OpenCAD AI agent — natural-language modelling on top of the OpenCAD core

Project description

opencad-agent

Natural-language CAD modelling on top of the opencad core.

The agent generates OpenCAD Python, validates it against an isolated analytic kernel, repairs it once if validation fails, then executes it — returning the generated code, the operations executed, and the updated feature tree.

Install:

pip install "opencad-agent[llm]"   # [llm] pulls LiteLLM for code generation

Use it against an existing runtime:

from opencad import reset_default_context
from opencad_agent import run_chat

ctx = reset_default_context()
response, operations = run_chat(ctx, "Create a mounting bracket with 4 standoffs")

Or drive the service directly:

from opencad_agent import OpenCadAgentService
from opencad_agent.models import ChatRequest

service = OpenCadAgentService()
result = service.chat(ChatRequest(message="Build a cog", tree_state=tree))

Configure the model with OPENCAD_LLM_MODEL and, when the provider needs it, OPENCAD_LLM_PROVIDER.

Kernel access

The agent never speaks HTTP. It takes a KernelClient (opencad.kernel.client) and the caller picks the transport — an in-process LocalKernelClient, or the HTTP client that opencad-backend supplies.

Tests

pytest

tests/agent/test_runtime_chat.py requires a configured live LLM; the rest of the suite runs offline with an injected completion function.

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

opencad_agent-0.2.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

opencad_agent-0.2.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file opencad_agent-0.2.0.tar.gz.

File metadata

  • Download URL: opencad_agent-0.2.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for opencad_agent-0.2.0.tar.gz
Algorithm Hash digest
SHA256 02f4fdf0a3506a43544278a573214bbc2ca20320530efd116288deda9a02743e
MD5 147fc51574a5e3fe76005d83635c4041
BLAKE2b-256 82dab10f36e31f9c6df2fba60973cb8c03931e9769b8df401decc4ee6e66fbbe

See more details on using hashes here.

File details

Details for the file opencad_agent-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: opencad_agent-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for opencad_agent-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 69f0272999fb8e458fa71b7e5be1a8fc16137a22f0162f3c1f0687fd9ea03f13
MD5 6c7fb6f0e9be07012abbd8cdcf652ff8
BLAKE2b-256 da952b8b8a2e19675f77937ffcf74f5b2e991aa8f7ec65ddba09f7962f9fcc5a

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