muskan singh commited on
Commit
2dfdd72
Β·
unverified Β·
1 Parent(s): c5174c6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +267 -62
README.md CHANGED
@@ -2,7 +2,7 @@
2
  title: OrgOS Enterprise Workflow RL Environment
3
  emoji: 🏒
4
  colorFrom: indigo
5
- colorTo: blue
6
  sdk: docker
7
  pinned: false
8
  app_port: 8000
@@ -15,10 +15,23 @@ tags:
15
 
16
  # OrgOS β€” Enterprise Workflow RL Environment
17
 
18
- **OrgOS** is a multi-app enterprise reinforcement learning environment where an AI agent completes real business workflows across four interconnected SaaS applications. Between episodes the environment injects **schema drift** (renamed fields) and **policy changes** (tightened SLAs), forcing agents to generalize rather than memorize.
19
 
20
  Built for the [Meta PyTorch Γ— Scaler OpenEnv Hackathon](https://huggingface.co/) β€” targeting the **Multi-App Enterprise Workflow** sub-theme.
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  ---
23
 
24
  ## Live Demo
@@ -33,71 +46,135 @@ uvicorn server.app:app --host 0.0.0.0 --port 8000
33
 
34
  ---
35
 
 
 
 
 
 
 
 
 
 
 
36
  ## What Makes OrgOS Unique
37
 
38
  | Feature | Description |
39
  |---|---|
40
- | **4 Mock SaaS Apps** | Jira, Zendesk, Salesforce, Workday β€” each with realistic operations |
41
- | **Schema Drift** | Fields rename between episodes (e.g. `priority β†’ severity β†’ urgency_level`). Agent gets `-0.20` for stale names, `+0.10` for adapted names |
42
- | **Policy Drift** | Every 3rd episode, SLA thresholds tighten automatically |
43
- | **3 Workflows** | Cross-app tasks of increasing complexity: Bug Fix β†’ Onboarding β†’ Churn Alert |
44
- | **RBAC** | Support vs. manager roles enforced; `-0.25` penalty for unauthorized actions |
45
  | **Dense Reward** | Per-step composite signal tied to 5 measurable business outcomes |
46
 
47
  ---
48
 
49
- ## Applications & Operations
50
 
51
- | App | Key Operations |
52
- |---|---|
53
- | **Jira** | `get_issue`, `create_issue`, `update_status`, `set_priority`, `assign_owner`, `link_zendesk_ticket`, `close_issue`, `list_issues` |
54
- | **Zendesk** | `get_ticket`, `acknowledge_ticket`, `set_urgency`, `assign_agent`, `escalate_to_jira`, `resolve_ticket`, `add_note`, `list_tickets` |
55
- | **Salesforce** | `get_account`, `list_accounts`, `update_deal_stage`, `flag_churn_risk`, `assign_account_owner`, `log_interaction`, `get_opportunity` |
56
- | **Workday** | `get_employee`, `list_employees`, `provision_access`, `log_sla_event`, `request_budget_approval`, `create_onboarding_task`, `complete_task` |
57
 
58
  ---
59
 
60
- ## Workflows
 
 
 
61
 
62
- ### Workflow A β€” Customer Bug Fix (support role, 5 steps, max 15)
63
- 1. Acknowledge Zendesk ticket
64
- 2. Create linked Jira issue
65
- 3. Assign Jira issue to engineer
66
- 4. Log SLA event in Workday
67
- 5. Query Salesforce for account health
 
68
 
69
- ### Workflow B β€” Employee Onboarding (manager role, 4 steps, max 20)
70
- 1. Create employee record in Workday
71
- 2. Provision Jira access
72
- 3. Add employee to Salesforce team
73
- 4. Create Zendesk support profile
74
 
75
- ### Workflow C β€” Churn Risk Alert (support role, 4 steps, max 18)
76
- 1. Flag churn risk in Salesforce
77
- 2. Escalate to Zendesk ticket
78
- 3. Create Jira tracking issue
79
- 4. Log SLA event in Workday
80
 
81
  ---
82
 
83
- ## Action / Observation Format
 
84
 
85
- **Action:**
86
- ```json
87
- {"app": "zendesk", "operation": "acknowledge_ticket", "args": {"ticket_number": "ZD-001"}}
88
- ```
89
 
90
- **Observation (key fields):**
91
- ```json
92
- {
93
- "workflow_goal": "Resolve customer bug report end-to-end",
94
- "pending_steps": ["Assign Jira issue to engineer", "Log SLA event in Workday"],
95
- "schema_hints": {"jira.priority": "severity"},
96
- "active_rules": {"sla_p0_minutes": 30},
97
- "current_score": 0.42,
98
- "message": "Jira issue JI-001 created and linked to ZD-001"
99
- }
100
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
  ---
103
 
@@ -111,11 +188,25 @@ score = 0.30 Γ— workflow_completion
111
  + 0.10 Γ— policy_drift_handling
112
 
113
  Per-step delta = new_score βˆ’ old_score
114
- Schema error penalty = βˆ’0.20
115
- RBAC violation penalty = βˆ’0.25
116
- Terminal completion bonus = +0.20
 
117
  ```
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  ---
120
 
121
  ## API Endpoints
@@ -129,17 +220,66 @@ Terminal completion bonus = +0.20
129
  | `GET` | `/schema/apps` | All app operations catalogue |
130
  | `GET` | `/docs` | Swagger UI |
131
  | `GET` | `/` | Live dashboard (UI) |
132
- | `GET` | `/ui/run-agent` | SSE stream: live agent inference |
133
 
134
  ---
135
 
136
  ## Training
137
 
138
- The `training/grpo_orgos.ipynb` notebook trains **Qwen2.5-3B-Instruct** with **Unsloth 4-bit LoRA** using **HF TRL GRPOTrainer**:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
 
140
- - Before training: ~0.55 score (uses stale canonical field names β†’ schema error penalties)
141
- - After training: ~0.75 score (reads `schema_hints`, uses drifted field names β†’ adaptation bonuses)
142
- - **Ξ” β‰ˆ +0.20** per episode, visible in `before_after_curves.png`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
 
144
  ---
145
 
@@ -155,7 +295,6 @@ uvicorn server.app:app --host 0.0.0.0 --port 8000
155
  # 3. Run baseline inference (requires LLM API)
156
  export API_BASE_URL=https://api.openai.com/v1
157
  export MODEL_NAME=gpt-4o-mini
158
- export HF_TOKEN=your_token
159
  python inference.py
160
 
161
  # 4. Or use the Python client
@@ -181,10 +320,10 @@ openEnv/
181
  β”œβ”€β”€ server/
182
  β”‚ β”œβ”€β”€ app.py # FastAPI routes (15 endpoints)
183
  β”‚ β”œβ”€β”€ environment.py # OrgOSEnvironment β€” reset/step/state
184
- β”‚ β”œβ”€β”€ schema_drift.py # Per-episode field renames
185
- β”‚ β”œβ”€β”€ business_rules.py # RBAC + SLA enforcement
186
- β”‚ β”œβ”€β”€ workflow_engine.py # 3 cross-app workflow definitions
187
- β”‚ β”œβ”€β”€ data_generator.py # Synthetic data (seed=42)
188
  β”‚ └── apps/
189
  β”‚ β”œβ”€β”€ jira.py
190
  β”‚ β”œβ”€β”€ zendesk.py
@@ -192,14 +331,80 @@ openEnv/
192
  β”‚ └── workday.py
193
  β”œβ”€β”€ models.py # Pydantic models
194
  β”œβ”€β”€ client.py # OrgOSEnvClient
195
- β”œβ”€β”€ inference.py # Baseline inference loop + SSE generator
196
  β”œβ”€β”€ ui/index.html # Live dashboard (Tailwind + Alpine.js + Chart.js)
197
  β”œβ”€β”€ training/
198
- β”‚ └── grpo_orgos.ipynb # GRPO training notebook (Colab)
 
199
  β”œβ”€β”€ openenv.yaml # OpenEnv manifest
200
  └── Dockerfile
201
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
 
 
 
 
 
203
  ---
204
 
205
  MIT License Β· Built for Meta PyTorch Γ— Scaler OpenEnv Hackathon Round 2
 
2
  title: OrgOS Enterprise Workflow RL Environment
3
  emoji: 🏒
4
  colorFrom: indigo
5
+ colorTo: cyan
6
  sdk: docker
7
  pinned: false
8
  app_port: 8000
 
15
 
16
  # OrgOS β€” Enterprise Workflow RL Environment
17
 
18
+ **OrgOS** is a multi-app enterprise reinforcement learning environment where an AI agent completes real business workflows across four interconnected SaaS applications. Between episodes the environment injects **schema drift** (renamed API fields) and **policy changes** (tightened SLAs and approval thresholds), forcing agents to generalize rather than memorize.
19
 
20
  Built for the [Meta PyTorch Γ— Scaler OpenEnv Hackathon](https://huggingface.co/) β€” targeting the **Multi-App Enterprise Workflow** sub-theme.
21
 
22
+ ---
23
+
24
+ ## Resources
25
+
26
+ | | |
27
+ |---|---|
28
+ | Environment Space | **[huggingface.co/spaces/tanvibisht/orgos-openenv](https://huggingface.co/spaces/tanvibisht/orgos-openenv)** |
29
+ | Training Space | **[huggingface.co/spaces/muskansingh1101/orgos-training](https://huggingface.co/spaces/muskansingh1101/orgos-training)** |
30
+ | HF Blog Post | **[OrgOS: Teaching Agents to Survive Enterprise API Drift](https://huggingface.co/blog/muskansingh1101/orgos-openenv)** |
31
+ | Training Notebook | **[training/grpo_orgos.ipynb](training/grpo_orgos.ipynb)** |
32
+ | Youtube Demo Video| **[]()** |
33
+
34
+
35
  ---
36
 
37
  ## Live Demo
 
46
 
47
  ---
48
 
49
+ ## The Problem OrgOS Solves
50
+
51
+ Real enterprise AI agents don't fail because the model is bad β€” they fail because the environment keeps changing. SaaS APIs rename fields across versions. SLA policies tighten after incidents. Access controls shift when team structures change.
52
+
53
+ An agent trained on a static dataset will memorize field names like `priority`, `assignee`, `deal_stage`. But in production, those same fields become `severity`, `owner`, and `pipeline_stage`. The agent breaks silently β€” it still runs, but its actions fail schema validation and real work never gets done.
54
+
55
+ OrgOS simulates this exactly. Every episode, the agent faces the same four apps with **different field names** and potentially **different SLA rules**. The only path to a high score is reading the `schema_hints` observation and the `active_rules` dict before acting β€” then using the *current* field names, not the ones it saw in training.
56
+
57
+ ---
58
+
59
  ## What Makes OrgOS Unique
60
 
61
  | Feature | Description |
62
  |---|---|
63
+ | **4 Mock SaaS Apps** | Jira, Zendesk, Salesforce, Workday β€” each with realistic CRUD operations |
64
+ | **Schema Drift** | Fields rename between episodes across 3 versioned schemas per app. Agent gets `-0.20` for stale names, `+0.10` for adapted names |
65
+ | **Policy Drift** | Every 3rd episode, SLA thresholds tighten automatically (P0: 30 min β†’ 15 min, P1: 4 h β†’ 2 h) |
66
+ | **3 Workflows** | Cross-app tasks that require correct sequencing and state carry-over between steps |
67
+ | **RBAC** | Support vs. manager roles strictly enforced; `-0.25` penalty for unauthorized actions |
68
  | **Dense Reward** | Per-step composite signal tied to 5 measurable business outcomes |
69
 
70
  ---
71
 
72
+ ## The Three Workflows
73
 
74
+ Each workflow tests a different capability: information discovery, state threading between apps, and schema-aware field usage. All three run against the same four apps but require different operation sequences and roles.
 
 
 
 
 
75
 
76
  ---
77
 
78
+ ### Workflow A β€” Customer Bug Fix
79
+ **Role:** `support` | **Steps:** 5 | **Step budget:** 15
80
+
81
+ A P1 bug has been escalated through the support queue. The agent must move it end-to-end: from acknowledging the ticket in Zendesk, through creating and assigning a Jira issue, to verifying account health in Salesforce and logging SLA compliance in Workday.
82
 
83
+ | Step | App | Operation | What Must Happen |
84
+ |---|---|---|---|
85
+ | A1 | Zendesk | `acknowledge_ticket` | Find and acknowledge the new P1 ticket |
86
+ | A2 | Jira | `create_issue` | Create a new issue **linked** to that Zendesk ticket |
87
+ | A3 | Salesforce | `get_account` | Verify the customer's account status |
88
+ | A4 | Jira | `assign_owner` | Assign the **same** issue created in A2 to an engineer |
89
+ | A5 | Workday | `log_sla_event` | Log SLA compliance using the ticket ID |
90
 
91
+ **Why it's hard:** Steps must happen in order β€” the Jira issue created in A2 must be the one assigned in A4. The agent can't shortcut by assigning an unrelated issue. Schema drift hits Zendesk's `urgency`/`state` fields and Jira's `priority`/`assignee` fields.
 
 
 
 
92
 
93
+ **What an untrained agent does:** Calls `list_tickets` in a loop, uses canonical field name `priority` (stale on v2/v3 schemas), gets `-0.20` schema error, never advances past A1.
94
+
95
+ **What a trained agent does:** Reads `schema_hints` first (e.g. `jira.priority β†’ severity`), calls `acknowledge_ticket` with correct args, threads the ticket ID through to Jira's `create_issue`, then `assign_owner` on the same issue ID.
 
 
96
 
97
  ---
98
 
99
+ ### Workflow B β€” Employee Onboarding
100
+ **Role:** `manager` | **Steps:** 4 | **Step budget:** 20
101
 
102
+ A new hire is in Workday with `status=pending`. The manager-role agent must complete their onboarding across all four apps β€” and each step's output feeds the next. The agent must carry `employee_id` and `territory` from step B1 through to B3 and B4.
 
 
 
103
 
104
+ | Step | App | Operation | What Must Happen |
105
+ |---|---|---|---|
106
+ | B1 | Workday | `create_onboarding_task` | Find the pending employee and create their onboarding record |
107
+ | B2 | Workday | `provision_access` | Provision **Jira** access for that specific `employee_id` |
108
+ | B3 | Salesforce | `assign_account_owner` | Assign the new hire as owner of an account **in their own territory** |
109
+ | B4 | Jira | `assign_owner` | Assign an open Jira issue to the new hire's `employee_id` |
110
+
111
+ **Why it's hard:** This is a state-threading problem. There's only one pending employee in Workday, but the agent must discover them via `list_employees` with `status=pending`, extract their `employee_id` and `territory`, then pass those values correctly into B3 (Salesforce territory filter) and B4 (Jira assignee). Hardcoding any ID will fail β€” the data generator seeds differently each episode.
112
+
113
+ **RBAC note:** Only `manager` role has full access to all four apps. A `support` agent attempting Workday's `provision_access` or Salesforce's `assign_account_owner` incurs a `-0.25` penalty per violation.
114
+
115
+ **What an untrained agent does:** Tries to call `create_onboarding_task` directly without listing first, passes wrong `employee_id`, then attempts `assign_account_owner` on a random account (wrong territory β†’ step B3 fails completion check).
116
+
117
+ **What a trained agent does:** Calls `list_employees` with `status=pending` β†’ extracts `employee_id` + `territory` β†’ threads them correctly into all downstream steps.
118
+
119
+ ---
120
+
121
+ ### Workflow C β€” Churn Risk Alert
122
+ **Role:** `support` | **Steps:** 4 | **Step budget:** 18
123
+
124
+ An enterprise account is showing churn signals. The agent must identify it in Salesforce, assess the account's support history and open bugs, then assign an intervention owner. The challenge: the at-risk account's ID changes each episode and must be discovered dynamically.
125
+
126
+ | Step | App | Operation | What Must Happen |
127
+ |---|---|---|---|
128
+ | C1 | Salesforce | `flag_churn_risk` | Identify and flag the at-risk account |
129
+ | C2 | Zendesk | `get_ticket` | Query support tickets **for the churn account's ID** (from C1) |
130
+ | C3 | Jira | `list_issues` | List open bugs **with `customer_id=<churn account>`** (from C1) |
131
+ | C4 | Salesforce | `assign_account_owner` | Assign an intervention owner to the at-risk account |
132
+
133
+ **Why it's hard:** Steps C2 and C3 require passing the `account_id` discovered in C1 as a filter argument. A hardcoded ID (or no filter) fails the completion check. Salesforce's `health`/`owner`/`deal_stage` fields drift across schema versions, so the agent must use the current names when calling `flag_churn_risk`.
134
+
135
+ **Why it scores lowest for untrained agents (0.25):** Schema drift hits Salesforce hardest β€” three fields rename simultaneously between v1/v2/v3. The untrained model almost never uses the right field names on the first call, burning half its step budget on schema errors before discovering C1's output is needed in C2 and C3.
136
+
137
+ **What a trained agent does:** Reads `schema_hints` to find current Salesforce field names β†’ calls `flag_churn_risk` correctly β†’ extracts the returned `account_id` β†’ uses it as the filter in both the Zendesk query and Jira `list_issues` call.
138
+
139
+ ---
140
+
141
+ ## Schema Drift β€” Deep Dive
142
+
143
+ Each episode, the schema drift engine samples an independent schema version (v1/v2/v3) for each app. v1 uses canonical field names (no drift). v2 and v3 rename fields.
144
+
145
+ | App | Canonical | v2 | v3 |
146
+ |---|---|---|---|
147
+ | **Jira** | `priority` | `severity` | `urgency_level` |
148
+ | **Jira** | `assignee` | `owner` | `assigned_to` |
149
+ | **Jira** | `status` | `state` | `current_state` |
150
+ | **Zendesk** | `urgency` | `priority` | `impact_level` |
151
+ | **Zendesk** | `agent_email` | `handler` | `assigned_agent` |
152
+ | **Salesforce** | `deal_stage` | `pipeline_stage` | `stage` |
153
+ | **Salesforce** | `health` | `account_health` | `risk_score` |
154
+ | **Salesforce** | `owner` | `account_owner` | `rep_email` |
155
+ | **Workday** | `level` | `job_level` | `seniority` |
156
+ | **Workday** | `manager_id` | `reports_to` | `direct_manager` |
157
+
158
+ The observation includes **one schema hint** per episode (e.g. `{"jira.priority": "severity"}`). The agent must use `get_*` and `list_*` operations to discover the rest of the drift by reading what the app returns.
159
+
160
+ **Reward signals:**
161
+ - Using a stale canonical field name: **-0.20**
162
+ - Using the correct drifted field name: **+0.10**
163
+ - v1 schema (no drift): no penalty, no credit
164
+
165
+ ---
166
+
167
+ ## Policy Drift
168
+
169
+ Every 3rd episode, SLAs tighten:
170
+
171
+ | Rule | Default | After Policy Drift |
172
+ |---|---|---|
173
+ | P0 acknowledgement | 30 min | **15 min** |
174
+ | P1 first response | 4 hours | **2 hours** |
175
+ | Budget approval threshold | $10,000 | **$5,000** |
176
+
177
+ Since each environment step simulates ~10 minutes of elapsed time, under policy drift a P0 ticket must be acknowledged within the first **step** β€” not the first few steps. The agent sees the current thresholds in `active_rules` on every observation.
178
 
179
  ---
180
 
 
188
  + 0.10 Γ— policy_drift_handling
189
 
190
  Per-step delta = new_score βˆ’ old_score
191
+ Schema error penalty = βˆ’0.20 (stale field name used)
192
+ RBAC violation penalty = βˆ’0.25 (unauthorized operation)
193
+ SLA breach penalty = βˆ’0.10 to βˆ’0.15
194
+ Terminal completion bonus = +0.20 (all workflow steps done)
195
  ```
196
 
197
+ `efficiency` only increases when a **new workflow step is completed** β€” padding with repeated `list_*` calls doesn't help. This is what makes single-step reward exploitation hard and why the multi-step reward function in training is critical.
198
+
199
+ ---
200
+
201
+ ## Applications & Operations
202
+
203
+ | App | Key Operations |
204
+ |---|---|
205
+ | **Jira** | `get_issue`, `create_issue`, `update_status`, `set_priority`, `assign_owner`, `link_zendesk_ticket`, `close_issue`, `list_issues` |
206
+ | **Zendesk** | `get_ticket`, `acknowledge_ticket`, `set_urgency`, `assign_agent`, `escalate_to_jira`, `resolve_ticket`, `add_note`, `list_tickets` |
207
+ | **Salesforce** | `get_account`, `list_accounts`, `update_deal_stage`, `flag_churn_risk`, `assign_account_owner`, `log_interaction`, `get_opportunity` |
208
+ | **Workday** | `get_employee`, `list_employees`, `provision_access`, `log_sla_event`, `request_budget_approval`, `create_onboarding_task`, `complete_task` |
209
+
210
  ---
211
 
212
  ## API Endpoints
 
220
  | `GET` | `/schema/apps` | All app operations catalogue |
221
  | `GET` | `/docs` | Swagger UI |
222
  | `GET` | `/` | Live dashboard (UI) |
 
223
 
224
  ---
225
 
226
  ## Training
227
 
228
+ The [`training/grpo_orgos.ipynb`](training/grpo_orgos.ipynb) notebook trains **Qwen2.5-3B-Instruct** with **Unsloth 4-bit LoRA** using **HF TRL GRPOTrainer** (150 GRPO steps, multi-step reward, checkpoints every 30 steps).
229
+
230
+ Also runnable as a live HF Space: **[muskansingh1101/orgos-training](https://huggingface.co/spaces/muskansingh1101/orgos-training)**
231
+
232
+ ### What Training Teaches the Agent
233
+
234
+ The key behavioral changes GRPO induces:
235
+
236
+ 1. **Schema awareness** β€” the agent learns to read `schema_hints` in the observation before constructing action args. Before training it ignores hints and uses canonical names; after training it uses the drifted names.
237
+
238
+ 2. **Step sequencing** β€” the agent learns to follow `pending_steps` in order. Before training it calls operations randomly; after training it completes A1 before attempting A2, and carries state (IDs) from earlier steps forward.
239
+
240
+ 3. **Discovery before action** β€” the agent learns to call `list_*` or `get_*` first to discover record IDs, rather than guessing or hardcoding them.
241
+
242
+ ### Results
243
+
244
+ | Workflow | Before GRPO | After GRPO | Ξ” |
245
+ |---|---|---|---|
246
+ | A β€” Customer Bug Fix | 0.70 | ~0.82 | +0.12 |
247
+ | B β€” Employee Onboarding | 0.57 | ~0.74 | +0.17 |
248
+ | C β€” Churn Risk Alert | 0.25 | ~0.48 | +0.23 |
249
+ | **Average** | **0.50** | **~0.68** | **+0.18** |
250
 
251
+ The largest gain is on Workflow C β€” the most schema-sensitive workflow (Salesforce has 3 drifting fields simultaneously). The untrained model almost never makes it past C1; the trained model completes C1β†’C2β†’C3 reliably.
252
+
253
+ ![Training Curve](training/plots/training_curve.png)
254
+ *Reward per training step β€” 150 GRPO steps on Qwen2.5-3B-Instruct*
255
+
256
+ ![Baseline vs Trained](training/plots/baseline_vs_trained.png)
257
+ *Per-workflow score: untrained baseline vs. GRPO-trained agent*
258
+
259
+ ![Score Distribution](training/plots/score_distribution.png)
260
+ *Distribution of episode scores before and after training*
261
+
262
+ ---
263
+
264
+ ## Action / Observation Format
265
+
266
+ **Action:**
267
+ ```json
268
+ {"app": "zendesk", "operation": "acknowledge_ticket", "args": {"ticket_number": "ZD-001"}}
269
+ ```
270
+
271
+ **Observation (key fields):**
272
+ ```json
273
+ {
274
+ "workflow_goal": "Workflow A β€” Customer Bug Fix: A P1 bug has been escalated...",
275
+ "pending_steps": ["Assign the Jira issue you just created to an engineer", "Log the SLA compliance event in Workday"],
276
+ "completed_steps": ["A1", "A2", "A3"],
277
+ "schema_hints": {"jira.priority": "severity"},
278
+ "active_rules": {"sla_p0_minutes": 15, "sla_p1_hours": 2, "approval_threshold": 5000},
279
+ "current_score": 0.42,
280
+ "message": "Jira issue JI-001 created and linked to ZD-001"
281
+ }
282
+ ```
283
 
284
  ---
285
 
 
295
  # 3. Run baseline inference (requires LLM API)
296
  export API_BASE_URL=https://api.openai.com/v1
297
  export MODEL_NAME=gpt-4o-mini
 
298
  python inference.py
299
 
300
  # 4. Or use the Python client
 
320
  β”œβ”€β”€ server/
321
  β”‚ β”œβ”€β”€ app.py # FastAPI routes (15 endpoints)
322
  β”‚ β”œβ”€β”€ environment.py # OrgOSEnvironment β€” reset/step/state
323
+ β”‚ β”œβ”€β”€ schema_drift.py # Per-episode field renames (3 versions per app)
324
+ β”‚ β”œβ”€β”€ business_rules.py # RBAC + SLA enforcement + policy drift
325
+ β”‚ β”œβ”€β”€ workflow_engine.py # 3 cross-app workflow definitions + completion checks
326
+ β”‚ β”œβ”€β”€ data_generator.py # Synthetic data (seed=42 + episode_num)
327
  β”‚ └── apps/
328
  β”‚ β”œβ”€β”€ jira.py
329
  β”‚ β”œβ”€β”€ zendesk.py
 
331
  β”‚ └── workday.py
332
  β”œβ”€β”€ models.py # Pydantic models
333
  β”œβ”€β”€ client.py # OrgOSEnvClient
334
+ β”œβ”€β”€ inference.py # Baseline inference loop
335
  β”œβ”€β”€ ui/index.html # Live dashboard (Tailwind + Alpine.js + Chart.js)
336
  β”œβ”€β”€ training/
337
+ β”‚ β”œβ”€β”€ grpo_orgos.ipynb # GRPO training notebook (Colab-ready)
338
+ β”‚ └── plots/ # Training result plots
339
  β”œβ”€β”€ openenv.yaml # OpenEnv manifest
340
  └── Dockerfile
341
  ```
342
+ ---
343
+ title: Orgos Training
344
+ emoji: πŸ†
345
+ colorFrom: red
346
+ colorTo: pink
347
+ sdk: docker
348
+ pinned: false
349
+ ---
350
+
351
+ # OrgOS β€” GRPO Training Space (can be found deployed at HF : )
352
+
353
+ This Space trains **Qwen2.5-3B-Instruct** with **Unsloth 4-bit LoRA** using **HF TRL GRPOTrainer** on the OrgOS enterprise workflow RL environment.
354
+
355
+ ---
356
+
357
+ ## What Is OrgOS?
358
+
359
+ OrgOS is a multi-app enterprise RL environment where an AI agent completes real business workflows across four interconnected SaaS apps (Jira, Zendesk, Salesforce, Workday). Between episodes the environment injects **schema drift** (renamed fields) and **policy changes** (tightened SLAs), forcing agents to generalize rather than memorize.
360
+
361
+ 🌐 **[Environment Space β†’](https://huggingface.co/spaces/tanvibisht/orgos-openenv)**
362
+
363
+ ---
364
+
365
+ ## Training Setup
366
+
367
+ | Config | Value |
368
+ |---|---|
369
+ | **Model** | Qwen2.5-3B-Instruct (4-bit via Unsloth) |
370
+ | **Algorithm** | GRPO (Generalized Reward Policy Optimization) |
371
+ | **LoRA rank** | r=16 |
372
+ | **Steps** | 150 |
373
+ | **Batch size** | 1 (grad accum 2) |
374
+ | **Learning rate** | 8e-6 |
375
+ | **Reward** | Multi-step (2 steps per sample) |
376
+ | **Checkpoints** | Every 30 steps to Drive |
377
+
378
+ The reward function combines 5 components: workflow completion (0.30), rule compliance (0.25), schema adaptation (0.20), efficiency (0.15), policy drift handling (0.10).
379
+
380
+ ---
381
+
382
+ ## Results
383
+
384
+ | Workflow | Before GRPO | After GRPO | Ξ” |
385
+ |---|---|---|---|
386
+ | A β€” Customer Bug Fix | 0.70 | ~0.82 | +0.12 |
387
+ | B β€” Employee Onboarding | 0.57 | ~0.74 | +0.17 |
388
+ | C β€” Churn Risk Alert | 0.25 | ~0.48 | +0.23 |
389
+ | **Average** | **0.50** | **~0.68** | **+0.18** |
390
+
391
+ ![Training Curve](plots/training_curve.png)
392
+ *Reward per training step*
393
+
394
+ ![Baseline vs Trained](plots/baseline_vs_trained.png)
395
+ *Per-workflow score comparison*
396
+
397
+ ![Score Distribution](plots/score_distribution.png)
398
+ *Episode score distribution before and after GRPO*
399
+
400
+ ---
401
+
402
+ ## Resources
403
 
404
+ - 🌐 [Environment Space](https://huggingface.co/spaces/tanvibisht/orgos-openenv)
405
+ - πŸ“ [HF Blog Post](https://huggingface.co/blog/muskansingh1101/orgos-openenv)
406
+ - πŸ““ [Training Notebook (Colab)](https://github.com/muskansingh1101/OpenEnv-Round-2/blob/main/training/grpo_orgos.ipynb)
407
+ - πŸ’» [Environment GitHub Repo](https://github.com/muskansingh1101/OpenEnv-Round-2)
408
  ---
409
 
410
  MIT License Β· Built for Meta PyTorch Γ— Scaler OpenEnv Hackathon Round 2