# srinivasmd/windchill-ai-agent architecture

> Architecture diagram of the GitHub repository srinivasmd/windchill-ai-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/srinivasmd/windchill-ai-agent
- Repository: https://github.com/srinivasmd/windchill-ai-agent

## Overview

Windchill AI Agent is a CLI for turning a task into a Windchill document-creation request. The shown workflow parses the task, resolves a container, builds a payload, sends the request, and checks its result; failures can retry execution up to the configured limit. The README describes LLM tool selection and self-healing payload correction, but the sampled implementation uses regex parsing and does not show an LLM or payload correction. Relationships below follow the sampled code and README; no unsampled modules are assumed.

Main entry points: [`src/agents.py`](https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/agents.py) (Parse And Prepare), [`cli.py`](https://github.com/srinivasmd/windchill-ai-agent/blob/main/cli.py) (CLI Entry), [`src/windchill_client.py`](https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/windchill_client.py) (HTTP Client), [`src/builders.py`](https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/builders.py) (Document Payload)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_cli["CLI Entry<br/>[cli.py]"]
end

subgraph group_workflow["Agent Workflow"]
  node_author["Parse And Prepare<br/>[agents.py]"]
  node_builder["Document Payload<br/>[builders.py]"]
  node_executor["Request Executor<br/>[agents.py]"]
  node_healer["Result And Retry<br/>[agents.py]"]
end

subgraph group_integration["Windchill Integration"]
  node_container_lookup["Container Lookup"]
  node_csrf["CSRF Token"]
  node_api_client["HTTP Client"]
end

node_user(("Task User"))
node_windchill{{"Windchill WRS"}}

node_user -->|"submits task"| node_cli
node_cli -->|"invokes workflow"| node_author
node_author -->|"resolves container"| node_container_lookup
node_author -->|"builds payload"| node_builder
node_author -->|"routes state"| node_executor
node_executor -->|"sends request"| node_api_client
node_executor -->|"checks result"| node_healer
node_healer -->|"retries request"| node_executor
node_container_lookup -->|"GET containers"| node_windchill
node_api_client -->|"requests token"| node_csrf
node_csrf -->|"GET token"| node_windchill
node_api_client -->|"sends HTTP request"| node_windchill
node_cli -->|"prints result"| node_user

click node_cli "https://github.com/srinivasmd/windchill-ai-agent/blob/main/cli.py"
click node_author "https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/agents.py"
click node_builder "https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/builders.py"
click node_executor "https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/agents.py"
click node_healer "https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/agents.py"
click node_container_lookup "https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/windchill_client.py"
click node_csrf "https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/windchill_client.py"
click node_api_client "https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/windchill_client.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli toneBlue
class node_author,node_builder,node_executor,node_healer toneAmber
class node_container_lookup,node_csrf,node_api_client toneMint
class node_user toneRose
class node_windchill toneIndigo
```

## Components

### User Interface

- [CLI Entry](https://github.com/srinivasmd/windchill-ai-agent/blob/main/cli.py): `cli.py`

### Agent Workflow

- [Parse And Prepare](https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/agents.py): `src/agents.py`
- [Document Payload](https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/builders.py): `src/builders.py`
- [Request Executor](https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/agents.py): `src/agents.py`
- [Result And Retry](https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/agents.py): `src/agents.py`

### Windchill Integration

- [Container Lookup](https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/windchill_client.py): `src/windchill_client.py`
- [CSRF Token](https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/windchill_client.py): `src/windchill_client.py`
- [HTTP Client](https://github.com/srinivasmd/windchill-ai-agent/blob/main/src/windchill_client.py): `src/windchill_client.py`

### Other components

- **Task User**
- **Windchill WRS**

## Connections

- Task User → CLI Entry: submits task (evidence: `README.md`)
- CLI Entry → Parse And Prepare: invokes workflow (evidence: `cli.py`)
- Parse And Prepare → Container Lookup: resolves container (evidence: `src/agents.py`)
- Parse And Prepare → Document Payload: builds payload (evidence: `src/agents.py`)
- Parse And Prepare → Request Executor: routes state (evidence: `src/agents.py`)
- Request Executor → HTTP Client: sends request (evidence: `src/agents.py`)
- Request Executor → Result And Retry: checks result (evidence: `src/agents.py`)
- Result And Retry → Request Executor: retries request (evidence: `src/agents.py`)
- Container Lookup → Windchill WRS: GET containers (evidence: `src/windchill_client.py`)
- HTTP Client → CSRF Token: requests token (evidence: `src/windchill_client.py`)
- CSRF Token → Windchill WRS: GET token (evidence: `src/windchill_client.py`)
- HTTP Client → Windchill WRS: sends HTTP request (evidence: `src/windchill_client.py`)
- CLI Entry → Task User: prints result (evidence: `cli.py`)
