Spaces:
Running
Running
Commit Β·
105c5c9
1
Parent(s): 934f824
made changes to the workflows
Browse files- inference.py +18 -22
- server/environment.py +10 -1
- server/workflow_engine.py +13 -23
inference.py
CHANGED
|
@@ -47,11 +47,12 @@ SYSTEM_PROMPT = """\
|
|
| 47 |
You are OrgOS Agent β an enterprise workflow automation agent.
|
| 48 |
You operate across four SaaS applications: Jira, Zendesk, Salesforce, and Workday.
|
| 49 |
|
| 50 |
-
Each turn you receive
|
| 51 |
-
- workflow_goal : the
|
| 52 |
-
-
|
| 53 |
-
- app_states : current state of each app
|
| 54 |
-
- schema_hints : field renames in effect
|
|
|
|
| 55 |
- active_rules : current SLA / approval thresholds
|
| 56 |
- message : feedback from the last action
|
| 57 |
- current_score : your cumulative score (0.001β0.999)
|
|
@@ -74,18 +75,12 @@ Available apps and key operations:
|
|
| 74 |
|
| 75 |
CRITICAL RULES:
|
| 76 |
1. Read schema_hints FIRST β if "jira.priority" β "severity", use "severity" not "priority" in args.
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
Example actions:
|
| 84 |
-
{"app": "zendesk", "operation": "acknowledge_ticket", "args": {"ticket_number": "ZD-001"}}
|
| 85 |
-
{"app": "jira", "operation": "create_issue", "args": {"title": "Bug fix for ACME-001", "linked_zendesk": "ZD-001"}}
|
| 86 |
-
{"app": "salesforce", "operation": "get_account", "args": {"account_id": "ACME-001"}}
|
| 87 |
-
{"app": "workday", "operation": "log_sla_event", "args": {"ticket_id": "ZD-001", "sla_met": true}}
|
| 88 |
-
{"app": "zendesk", "operation": "create_agent_profile", "args": {"employee_id": "EMP-NEW-001", "email": "jordan.riley@company.com", "name": "Jordan Riley"}}
|
| 89 |
"""
|
| 90 |
|
| 91 |
WORKFLOW_NAMES = {
|
|
@@ -139,18 +134,19 @@ def api_get(path: str) -> dict:
|
|
| 139 |
# ------------------------------------------------------------------
|
| 140 |
|
| 141 |
def obs_to_text(obs: dict) -> str:
|
|
|
|
|
|
|
|
|
|
| 142 |
lines = [
|
| 143 |
f"current_score: {obs['current_score']}",
|
| 144 |
f"step_count: {obs['step_count']}",
|
| 145 |
f"workflow_id: {obs['workflow_id']}",
|
|
|
|
| 146 |
"",
|
| 147 |
"=== WORKFLOW GOAL ===",
|
| 148 |
obs["workflow_goal"],
|
| 149 |
"",
|
| 150 |
-
"===
|
| 151 |
-
"\n".join(f" - {s}" for s in obs["pending_steps"]) or " (all steps complete!)",
|
| 152 |
-
"",
|
| 153 |
-
"=== SCHEMA HINTS (use these field names) ===",
|
| 154 |
json.dumps(obs["schema_hints"], indent=2) if obs["schema_hints"] else " (no drift β use canonical names)",
|
| 155 |
"",
|
| 156 |
"=== ACTIVE RULES ===",
|
|
@@ -159,7 +155,7 @@ def obs_to_text(obs: dict) -> str:
|
|
| 159 |
"=== LAST MESSAGE ===",
|
| 160 |
obs["message"],
|
| 161 |
"",
|
| 162 |
-
"=== APP STATES ===",
|
| 163 |
]
|
| 164 |
for app_name, view in obs.get("app_states", {}).items():
|
| 165 |
lines.append(f" [{app_name.upper()}]")
|
|
|
|
| 47 |
You are OrgOS Agent β an enterprise workflow automation agent.
|
| 48 |
You operate across four SaaS applications: Jira, Zendesk, Salesforce, and Workday.
|
| 49 |
|
| 50 |
+
Each turn you receive an observation with:
|
| 51 |
+
- workflow_goal : the business objective you must achieve
|
| 52 |
+
- completed_steps : step IDs already finished (e.g. ["A1", "A2"])
|
| 53 |
+
- app_states : current state of each app β your primary source of truth
|
| 54 |
+
- schema_hints : PARTIAL field renames in effect (e.g. {"jira.priority": "severity"})
|
| 55 |
+
Not all drift is revealed β probe with get_* if a field is rejected.
|
| 56 |
- active_rules : current SLA / approval thresholds
|
| 57 |
- message : feedback from the last action
|
| 58 |
- current_score : your cumulative score (0.001β0.999)
|
|
|
|
| 75 |
|
| 76 |
CRITICAL RULES:
|
| 77 |
1. Read schema_hints FIRST β if "jira.priority" β "severity", use "severity" not "priority" in args.
|
| 78 |
+
If a field is rejected, use get_* or list_* to probe the current schema before retrying.
|
| 79 |
+
2. Inspect app_states to determine what has been done and what still needs action.
|
| 80 |
+
3. Use list_* and get_* operations to discover record IDs β never assume them.
|
| 81 |
+
4. Do not repeat a successful action.
|
| 82 |
+
5. If an operation fails, read the message and adapt your field names or args.
|
| 83 |
+
6. Stop when completed_steps covers all workflow steps or done=true.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
"""
|
| 85 |
|
| 86 |
WORKFLOW_NAMES = {
|
|
|
|
| 134 |
# ------------------------------------------------------------------
|
| 135 |
|
| 136 |
def obs_to_text(obs: dict) -> str:
|
| 137 |
+
completed = obs.get("completed_steps", [])
|
| 138 |
+
completed_str = ", ".join(completed) if completed else "none"
|
| 139 |
+
|
| 140 |
lines = [
|
| 141 |
f"current_score: {obs['current_score']}",
|
| 142 |
f"step_count: {obs['step_count']}",
|
| 143 |
f"workflow_id: {obs['workflow_id']}",
|
| 144 |
+
f"completed_steps: [{completed_str}]",
|
| 145 |
"",
|
| 146 |
"=== WORKFLOW GOAL ===",
|
| 147 |
obs["workflow_goal"],
|
| 148 |
"",
|
| 149 |
+
"=== SCHEMA HINTS (partial β probe with get_* for unknown fields) ===",
|
|
|
|
|
|
|
|
|
|
| 150 |
json.dumps(obs["schema_hints"], indent=2) if obs["schema_hints"] else " (no drift β use canonical names)",
|
| 151 |
"",
|
| 152 |
"=== ACTIVE RULES ===",
|
|
|
|
| 155 |
"=== LAST MESSAGE ===",
|
| 156 |
obs["message"],
|
| 157 |
"",
|
| 158 |
+
"=== APP STATES (use these to determine what still needs to be done) ===",
|
| 159 |
]
|
| 160 |
for app_name, view in obs.get("app_states", {}).items():
|
| 161 |
lines.append(f" [{app_name.upper()}]")
|
server/environment.py
CHANGED
|
@@ -220,8 +220,17 @@ class OrgOSEnvironment:
|
|
| 220 |
|
| 221 |
# Workflow progress
|
| 222 |
completed_steps = self._workflow.get_completed()
|
| 223 |
-
pending_steps = self._workflow.get_pending()
|
| 224 |
workflow_goal = self._workflow.get_goal()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
|
| 226 |
# Reward breakdown snapshot
|
| 227 |
breakdown = RewardBreakdown(
|
|
|
|
| 220 |
|
| 221 |
# Workflow progress
|
| 222 |
completed_steps = self._workflow.get_completed()
|
|
|
|
| 223 |
workflow_goal = self._workflow.get_goal()
|
| 224 |
+
total_steps = len(self._workflow._steps)
|
| 225 |
+
steps_done = len(completed_steps)
|
| 226 |
+
# Expose only a progress count β agent must infer what's next from app states
|
| 227 |
+
if steps_done == total_steps:
|
| 228 |
+
pending_steps = []
|
| 229 |
+
else:
|
| 230 |
+
pending_steps = [
|
| 231 |
+
f"{steps_done}/{total_steps} steps completed β "
|
| 232 |
+
"inspect app states and schema_hints to determine your next action."
|
| 233 |
+
]
|
| 234 |
|
| 235 |
# Reward breakdown snapshot
|
| 236 |
breakdown = RewardBreakdown(
|
server/workflow_engine.py
CHANGED
|
@@ -106,35 +106,25 @@ WORKFLOW_C_STEPS = [
|
|
| 106 |
WORKFLOW_GOALS: Dict[str, str] = {
|
| 107 |
"A": (
|
| 108 |
"Workflow A β Customer Bug Fix: "
|
| 109 |
-
"A P1 bug has been
|
| 110 |
-
"
|
| 111 |
-
"
|
| 112 |
-
"
|
| 113 |
-
"
|
| 114 |
-
"(4) assign the Jira issue (JIRA-001) to an engineer, "
|
| 115 |
-
"(5) log the SLA compliance event in Workday. "
|
| 116 |
-
"Use list operations if you need to discover record IDs."
|
| 117 |
),
|
| 118 |
"B": (
|
| 119 |
"Workflow B β Employee Onboarding: "
|
| 120 |
-
"A new support engineer has joined the West team. "
|
| 121 |
-
"
|
| 122 |
-
"
|
| 123 |
-
"
|
| 124 |
-
"(2) provision Jira access for EMP-NEW-001 via Workday, "
|
| 125 |
-
"(3) assign EMP-NEW-001 to the correct Salesforce territory (use any ACME-* account in the west region), "
|
| 126 |
-
"(4) create a Zendesk agent profile for EMP-NEW-001. "
|
| 127 |
-
"You have manager-level access."
|
| 128 |
),
|
| 129 |
"C": (
|
| 130 |
"Workflow C β Churn Risk Alert: "
|
| 131 |
-
"
|
| 132 |
-
"
|
| 133 |
-
"
|
| 134 |
-
"
|
| 135 |
-
"(3) list open Jira bugs related to ACME-003, "
|
| 136 |
-
"(4) assign an intervention owner to ACME-003 in Salesforce. "
|
| 137 |
-
"Focus account: ACME-003."
|
| 138 |
),
|
| 139 |
}
|
| 140 |
|
|
|
|
| 106 |
WORKFLOW_GOALS: Dict[str, str] = {
|
| 107 |
"A": (
|
| 108 |
"Workflow A β Customer Bug Fix: "
|
| 109 |
+
"A P1 bug has been escalated through the support queue. "
|
| 110 |
+
"Investigate the open ticket, escalate it to the engineering tracker, "
|
| 111 |
+
"verify the affected customer's account health, ensure the issue has an assigned owner, "
|
| 112 |
+
"and record SLA compliance. "
|
| 113 |
+
"Use list operations to discover relevant record IDs before acting."
|
|
|
|
|
|
|
|
|
|
| 114 |
),
|
| 115 |
"B": (
|
| 116 |
"Workflow B β Employee Onboarding: "
|
| 117 |
+
"A new support engineer has joined the West team and needs to be fully set up. "
|
| 118 |
+
"Ensure their employment record exists, provision the appropriate tooling access, "
|
| 119 |
+
"assign them to the correct territory in your CRM, and create their support profile. "
|
| 120 |
+
"Query the relevant systems to identify the new employee and required accounts."
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
),
|
| 122 |
"C": (
|
| 123 |
"Workflow C β Churn Risk Alert: "
|
| 124 |
+
"An enterprise account is showing churn signals and requires immediate attention. "
|
| 125 |
+
"Flag the at-risk account, assess their recent support ticket volume and open bug history, "
|
| 126 |
+
"and assign an intervention owner. "
|
| 127 |
+
"Use discovery operations to identify the account before taking action."
|
|
|
|
|
|
|
|
|
|
| 128 |
),
|
| 129 |
}
|
| 130 |
|