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.1.tar.gz (17.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.1-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: opencad_agent-0.2.1.tar.gz
  • Upload date:
  • Size: 17.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.1.tar.gz
Algorithm Hash digest
SHA256 cabb6c5711eb4b7bd46dc01a1d2716a0c854a45786e72d20904c407fa993e3cc
MD5 728b971270cabe91d062617022d29929
BLAKE2b-256 2cfaafafdb54222303a2070a57af17d90ff17d17b1a0ad0058a26e94268c2a68

See more details on using hashes here.

File details

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

File metadata

  • Download URL: opencad_agent-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 19.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e1425cd579e45dad433e1ea656a872a554c1f638235121b542ada813d0608d44
MD5 a089e44f927c322e6cfc0d853eb4ad43
BLAKE2b-256 449c632bf1b925730cf9694d869273597ae8b4109e86a5e9397954d1bf873d28

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