# Office Workflow OpenEnv Environment `office_workflow_env` simulates three realistic office tasks humans do and exposes them via OpenEnv’s standard `reset()` / `step()` / `state()` API. It supports deterministic grading (0.0–1.0) for: 1. `email_triage` (easy) 2. `data_cleaning` (medium) 3. `support_escalation` (hard) At the end of each episode, the environment writes the final task score to `observation.info.final_score` and the structured breakdown to `observation.info.final_breakdown`. ## Task / Episode API ### Reset Call `reset(task_id=..., seed=..., episode_id=...)`. * `task_id`: one of `email_triage`, `data_cleaning`, `support_escalation` * `seed`: integer seed for deterministic shuffling ### Step Call `step(action)` where `action` is an `OfficeAction`. The server returns: * `observation`: an `OfficeObservation` * `reward`: scalar float (shaped with partial progress) * `done`: boolean when the task is finished or `max_steps` is reached The `info` field is carried inside `observation.info`. ### State Call `state()` to retrieve `OfficeState` (progress + action trace; no hidden ground truth answers). ## Action Space (`OfficeAction`) Single action schema for all tasks, discriminated by `type`: * `type="triage_email"` * `email_id`: string * `category`: one of `billing`, `technical`, `spam`, `other` * `priority`: int in `[0, 5]` * `type="correct_cell"` * `row_id`: string * `column`: one of `email`, `phone`, `date` * `value`: proposed cleaned value * `type="support_decision"` * `ticket_id`: string * `intent`: one of `ask_for_information`, `resolve`, `escalate` * `reply`: draft reply text * plus intent-specific fields: * `requested_info` (when `ask_for_information`) * `resolution_steps` (when `resolve`) * `escalation_reason` (when `escalate`) Optional helper actions: * `type="request_status"` * `type="noop"` ## Observation Space (`OfficeObservation`) Common fields: * `task_id`, `status`, `max_steps`, `step_index` Task-specific fields: * `email_triage`: `emails`, `triaged` * `data_cleaning`: `dataset`, `cleaned_cells` * `support_escalation`: `tickets`, `handled_tickets` Grader-facing info: * `info.objective`, `info.completion_rule` (task instructions) * `info.reward_breakdown` (per-step reward component breakdown) * final episode results in `info.final_score` and `info.final_breakdown` ## Reward Shaping (partial progress) Rewards are not binary: they increase as the agent makes correct partial progress. All tasks: * progress component grows with corrected/handled items * correctness component rewards correct submissions * stalling/wrong actions are penalized by driving reward toward `0.0` ## Local Setup ### Step-by-step (Windows / PowerShell) 1. Open a terminal in `c:\Users\hp\Desktop\hackathon` 2. Install dependencies: ```bash python -m pip install -U pip python -m pip install "openenv-core[core]>=0.2.1" openai requests uvicorn ``` 3. Validate OpenEnv structure: ```bash openenv validate ``` 4. Start the server: ```bash uvicorn server.app:app --host 0.0.0.0 --port 8000 ``` 5. Confirm it responds: - `http://localhost:8000/health` - `http://localhost:8000/docs` 6. Run the connectivity smoke test (expected score 0.0 because it sends only `noop`): ```bash python scripts/smoke_test.py ``` 7. Run a “real” local demo baseline (no OpenAI key required; rule-based): ```bash python scripts/baseline_inference.py ``` ## Baseline Inference (OpenAI) The baseline script runs a model against all 3 tasks and prints reproducible scores. Environment variables: * `OPENAI_API_KEY` * `OPENAI_MODEL` (optional, default `gpt-4o-mini`) * `OPENENV_BASE_URL` (optional, default `http://localhost:8000`) * `BASELINE_SEED` (optional, default `123`) Run: ```bash python scripts/baseline_inference.py ``` ## Hugging Face Spaces Deployment This repo includes a `server/Dockerfile` suitable for Hugging Face Spaces. When you’re ready to deploy: ```bash openenv validate openenv push --repo-id YOUR_HF_USERNAME/office-workflow-env ``` `openenv push` will package the environment and build the Docker image for Spaces. After it deploys, validate the running Space: ```bash openenv validate https://YOUR_HF_USERNAME-office-workflow-env.hf.space ```