What is a Connector?
Your agent shouldn’t call GitHub directly. You want a middleman that (a) limits what the agent can do and (b) records what actually happened. That’s the Connector. A Connector is a pre-built class that wraps an external system. You create one, hand it to Enact, and Enact passes it to your workflow. You never call GitHub (or Postgres, or the filesystem) directly anymore — you call the connector. Think of it like handing a contractor a limited toolbox before you leave for work. The toolbox only contains the tools you specifically put in it. If the contractor hallucinates and decides to demolish a load-bearing wall — too bad, there’s no sledgehammer in the box.Basic Usage
Policies vs. allowed_actions
You might be thinking: “Don’t we already have Policies?” Yes — but they work differently.
- Policies are your business rules: “You can push code, but not to the
masterbranch.” allowed_actionsis your hardcoded floor: “This connector can only ever call these two methods. Full stop.”
allowed_actions caps the blast radius for everything else — even actions you never thought to write a policy for.
Available Connectors
| System | Actions | Rollback | Notes |
|---|---|---|---|
| GitHub | create_branch, create_pr, create_issue, delete_branch, merge_pr, push_commit | Yes — except push_commit | merge_pr via revert_commit |
| Postgres | select_rows, insert_row, update_row, delete_row | Yes — pre-SELECT captures state | |
| Filesystem | read_file, write_file, delete_file, list_dir | Yes — content captured before mutation | |
| Slack | post_message, delete_message | post_message yes, delete_message no | Bot token needs chat:delete scope for rollback |
Import Paths
WorkflowContext
TheWorkflowContext is the “bag” that travels through the system — passed to every policy check and every workflow action.
What Rollback Can and Can’t Undo
| Action | Rollback? | How |
|---|---|---|
github.create_branch | ✅ | Deletes the branch |
github.create_pr | ✅ | Closes the PR |
github.merge_pr | ✅ | git revert -m 1 <sha> — new commit that restores pre-merge state |
github.delete_branch | ✅ | Recreates branch at captured SHA |
github.push_commit | ❌ | Force-push required; blocked on protected branches |
postgres.insert_row | ✅ | Deletes the inserted row |
postgres.update_row | ✅ | Restores pre-update values |
postgres.delete_row | ✅ | Re-inserts every deleted row |
filesystem.write_file | ✅ | Restores previous content |
filesystem.delete_file | ✅ | Recreates file with captured content |
slack.post_message | ✅ | Deletes via chat.delete using captured ts |
slack.delete_message | ❌ | Can’t un-delete a Slack message |