Skip to content

Repository files navigation

Creo Design Agent

An AI design service for manufacturing — sheet metal and injection-molded parts.

中文文档 (Chinese) ->

Creo Design Agent gives engineers and product managers an AI-powered design workflow: a built-in design agent clarifies requirements, selects materials and processes, performs structural design and DFM validation, computes mold-flow / mechanical / FEA / thermal analysis parameters, and drives PTC Creo Parametric for 3D modeling and export — all through natural language.


Features

  • Built-in ReAct design agents — three personas (sheet metal, injection molding, analysis advisor) available via the MCP design_chat tool or the HTTP /chat endpoint.
  • Configurable OpenAI-compatible providers — OpenAI, DeepSeek, Qwen (DashScope), GLM, Moonshot, Ollama, vLLM, LM Studio, and any service implementing /chat/completions. Multiple providers with automatic failover.
  • Knowledge base (industry + company) — built-in packs for sheet metal, injection molding, materials, and analysis templates, in Chinese + English; import your company's internal standards (markdown/txt/pdf). Degrades gracefully to keyword + hash-vector hybrid retrieval when no embedding API is available.
  • Analysis engine — sheet metal (K-factor, bend allowance/deduction, minimum bend radius, hole clearance, flat development, punch force, DFM), injection molding / mold flow (wall thickness, draft, ribs/bosses, gating, clamp force, cooling time, process window), mechanics / FEA (beam/plate, safety factor, solver input checklist), thermal (expansion, heat dissipation, boundary conditions). Outputs are directly usable as input checklists for Creo Simulate / Moldflow / Moldex3D / ANSYS.
  • Creo 3D modeling — layered strategy: parameterized smart-template driven modeling (works with the free J-Link) plus full J-Link (wfc.jar) feature / sheet-metal creation when detected.
  • Security — API keys via environment variables only; write operations require explicit confirmation (allow_write / /chat/confirm); JSONL audit logs; the KB index never follows symlinks; per-user session isolation.
  • Testable — 44 Python unit tests (78% coverage) + 7 pure-Java reflection tests, a GitHub Actions CI, and a fully offline end-to-end demo that needs neither an API key nor Creo.

Architecture

AI client (Claude Code / Cursor / any MCP client / HTTP)
        |  MCP stdio · HTTP
        v
+--------------------------------------------------------------+
|  Agent Service (Python 3.11 · FastAPI + MCP)                  |
|  +- ReAct agents (sheet metal / injection molding / analysis) |
|  +- LLM gateway (OpenAI spec · multiple providers)            |
|  +- Knowledge base (vector + keyword hybrid retrieval)        |
|  +- Analysis engine (sheet metal / mold flow / FEA / thermal) |
|  +- Audit log · write-operation confirmation                  |
+-------------------------------+------------------------------+
                                | HTTP JSON-RPC (127.0.0.1:7788)
                                v
+--------------------------------------------------------------+
|  Creo J-Link Bridge (Java 17 · separate process)              |
|  +- 96 J-Link tools (MCP stdio mode)                          |
|  +- HTTP bridge + capability detection (wfc.jar -> full J-Link)|
|  +- single-threaded in-process J-Link (hard constraint)       |
+-------------------------------+------------------------------+
                                | J-Link
                       +--------v---------+
                       |   Creo 6 – 11    |
                       +------------------+

Repository layout

creo-design-agent/
├── agent-service/          # Python agent service (core)
│   ├── app/
│   │   ├── main.py         # FastAPI + MCP server
│   │   ├── agent.py        # ReAct runtime, sessions, confirmation flow
│   │   ├── llm.py          # OpenAI-compatible LLM gateway
│   │   ├── kb/             # knowledge base (chunking/vectors/hybrid search)
│   │   ├── analysis/       # analysis engine (5 calculators + reports)
│   │   ├── creo/           # HTTP client for the Java bridge
│   │   └── cli.py          # offline demo CLI
│   └── tests/              # 44 Python unit tests (+7 Java reflection tests)
├── java-bridge/            # Creo J-Link bridge (Java 17)
├── knowledge/              # industry packs + company docs
├── config/                 # agent.example.yaml
├── docs/                   # config · api · mcp-tools · knowledge-base
└── scripts/                # launch / test scripts · Makefile

Quick start

0. Requirements

Component Requirement
Python 3.11+
Java 17+ (Java bridge only)
Creo 6.0+ (optional; needed for modeling)
LLM provider any OpenAI-compatible service (optional; the offline demo needs none)

1. Configure

cp config/agent.example.yaml config/agent.yaml   # providers / KB / agent settings
cp .env.example .env                             # fill in real keys (never committed)

Secrets are referenced by environment-variable name (api_key_env), e.g. put DEEPSEEK_API_KEY=sk-... in .env.

2. Install and test

make setup     # create agent-service/.venv and install dependencies
make test      # run the Python unit tests (and Java reflection tests in CI)

3. Offline demo (no API key / no Creo)

make demo       # end-to-end pipeline: KB -> material -> DFM -> analysis -> Markdown report
make chat-demo  # ReAct agent chat demo (stub LLM)
make workflow    # deterministic design_task demo (with creo_plan)
make smoke PROVIDER=deepseek  # real provider smoke test (needs an API key)
make bench         # performance baseline (KB / search / calculators / workflow)
make verify        # one-shot local verification runbook
make check-env     # environment prerequisite check

4. Start the service

# Agent service (HTTP, default 127.0.0.1:8123)
./scripts/start-agent.sh                 # or: make run

# MCP stdio mode (for Claude Code / Cursor, etc.)
python -m app.main --mcp                 # from agent-service/

5. Connect Creo (optional)

# On the machine that runs Creo (Java bridge, default 127.0.0.1:7788)
cd java-bridge
./gradlew fatJar
scripts/start-bridge.bat            # Windows: HTTP JSON-RPC bridge
scripts/start-bridge.bat --mcp      # or MCP stdio mode

Copy pfc.jar (and wfc.jar for full J-Link) from your Creo installation into java-bridge/libs/. Without the bridge, analysis and knowledge-base features still work; Creo modeling tools return an explicit error.


Tool surface (HTTP / MCP consistent)

Tool Description
design_chat(persona?, message, session_id?, allow_write?) Built-in agent chat (sheet_metal / injection_molding / analysis)
kb_search(query, namespace?, top_k?) Search the knowledge base (industry + company)
dfm_check(domain, design) DFM validation (sheet_metal / injection_molding)
analysis_params(kind, design) Analysis input parameters (sheet_metal / moldflow / fea / thermal)
design_task(requirement, domain?, design?, template?) Deterministic end-to-end workflow: KB -> material -> DFM -> analysis -> report (optional Creo modeling + STEP). Domains: sheet_metal / injection_molding / assembly
drawing_workflow / family_table_workflow Drawing (views -> PDF) and family-table (size series) automation
delegate_task / optimize_design / vision_analyze Multi-agent delegation, DFM-constrained parameter optimization, vision-based geometry analysis
capabilities() Service / bridge / KB status
call_tool(name, args) Passthrough to any underlying tool (write ops auto-gated)

All low-level Creo tools (creo_connect, creo_open_file, creo_set_parameter, creo_regenerate, creo_export_step, ...) are exposed directly.

Full J-Link L2 tools (require wfc.jar; return E_CAPABILITY otherwise): creo_l2_capabilities, creo_sm_is_sheetmetal, creo_sm_get_info (Y/K factor, bend table, thickness), creo_sm_apply_bend_table, creo_sm_remove_bend_table, creo_create_feature (FET, experimental). See docs/jlink-l2.md for the on-machine verification checklist.


Configuring LLM providers

Define any number of OpenAI-compatible services in config/agent.yaml:

providers:
  deepseek:
    base_url: https://api.deepseek.com/v1
    api_key_env: DEEPSEEK_API_KEY
    model: deepseek-chat
    embed_model: text-embedding-v1
  dashscope:                              # Qwen (OpenAI-compatible mode)
    base_url: https://dashscope.aliyuncs.com/compatible-mode/v1
    api_key_env: DASHSCOPE_API_KEY
    model: qwen-max
  local:                                  # Ollama / vLLM / LM Studio
    base_url: http://127.0.0.1:11434/v1
    api_key_env: ""                       # local services usually need no key
    model: qwen2.5:7b
provider: deepseek                        # default provider

See docs/config.md for details.


Security

  • API keys live only in environment variables (api_key_env); no config file stores plaintext secrets.
  • .env, agent/, .pi/, *.log are git-ignored.
  • Write operations (Creo modeling/save/export) are blocked by default; grant access via allow_write=true or POST /chat/confirm.
  • The bridge listens on 127.0.0.1 by default; set BRIDGE_TOKEN for cross-host deployments (constant-time comparison).
  • Audit log: logs/audit-*.jsonl (configurable via CREO_AUDIT_DIR); HTTP requests audited too.
  • Per-user rate limiting on /chat* (rate_limit_per_min, default 60); unified error schema {"error": {"code", "message"}}.
  • Deep self-check: GET /diagnose (KB / provider key presence / bridge / personas).
  • KB import does not follow symlinks; company-directory content is sent to the LLM context, so keep sensitive credentials out.

Documentation

Roadmap

Version Scope Status
v0.1 Foundation: two-process architecture, LLM gateway, KB, analysis engine, demo, Docker Done
v0.1.1 Code-review fixes + expanded tests (44 Python / 78% + 7 Java) Done
v0.2 Sheet-metal end-to-end (design_task engine + provider smoke ready; needs real provider + Creo host) In progress
v0.3 Injection-molding end-to-end (mold-design closure done: parting line/cavity/gate/cooling) In progress
v0.4 Full J-Link (wfc.jar): WSMTPart sheet-metal features / WSolid FET Partial (reflection layer done; FET needs on-machine verification — see docs/jlink-l2.md)
v0.5 Production hardening: streaming (SSE + token deltas done), multi-user session isolation (done), performance, packaging Partial

License

MIT

About

jlink tool for agent

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages