wexa 0.7.0__tar.gz → 0.7.0.dev105__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wexa-0.7.0 → wexa-0.7.0.dev105}/PKG-INFO +238 -37
- {wexa-0.7.0 → wexa-0.7.0.dev105}/README.md +237 -36
- {wexa-0.7.0 → wexa-0.7.0.dev105}/pyproject.toml +1 -1
- {wexa-0.7.0 → wexa-0.7.0.dev105}/wexa/__init__.py +173 -47
- {wexa-0.7.0 → wexa-0.7.0.dev105}/wexa/_tools.py +222 -27
- {wexa-0.7.0 → wexa-0.7.0.dev105}/wexa/tools_schema.json +749 -17
- {wexa-0.7.0 → wexa-0.7.0.dev105}/wexa.egg-info/PKG-INFO +238 -37
- {wexa-0.7.0 → wexa-0.7.0.dev105}/setup.cfg +0 -0
- {wexa-0.7.0 → wexa-0.7.0.dev105}/wexa/_names.py +0 -0
- {wexa-0.7.0 → wexa-0.7.0.dev105}/wexa/py.typed +0 -0
- {wexa-0.7.0 → wexa-0.7.0.dev105}/wexa.egg-info/SOURCES.txt +0 -0
- {wexa-0.7.0 → wexa-0.7.0.dev105}/wexa.egg-info/dependency_links.txt +0 -0
- {wexa-0.7.0 → wexa-0.7.0.dev105}/wexa.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wexa
|
|
3
|
-
Version: 0.7.0
|
|
3
|
+
Version: 0.7.0.dev105
|
|
4
4
|
Summary: Python client for Wexa Fabric
|
|
5
5
|
License: Proprietary
|
|
6
6
|
Project-URL: Homepage, https://fabric.wexa.ai
|
|
@@ -142,7 +142,7 @@ Sixteen grants cover sixty-nine of the seventy-one tools in this client. The oth
|
|
|
142
142
|
| `fabric:query.read` | `query_context`, `graph_stats`, `graph_subgraph`, `search_code`, `fetch_code`, `connector_read` |
|
|
143
143
|
| `fabric:ontology.write` | `save_context`, `create_ontology`, `delete_context` |
|
|
144
144
|
| `fabric:docs.read` | `docs` |
|
|
145
|
-
| `fabric:orchestrate.read` | `list_skills`, `list_connectors`, `get_connector_sync`, `list_connector_catalog`, `get_connector_form`, `list_om_catalog`, `get_om_connection_form`, `list_connector_access_scopes`, `get_connector_ingestion`, `list_user_connectors`, `get_user_connector`, `list_models`, `list_agents`, `get_agent`, `get_process_flow`, `get_execution`, `knowledge_base_retrieve`, `agent_versions`, `flow_versions`, `list_schedules`, `get_schedule`, `list_triggers`, `list_peer_agents`, `handshake_peer_agent`, `get_whatsapp_connection` |
|
|
145
|
+
| `fabric:orchestrate.read` | `list_skills`, `list_connectors`, `get_connector_sync`, `list_connector_catalog`, `get_connector_form`, `list_om_catalog`, `get_om_connection_form`, `list_connector_access_scopes`, `get_connector_ingestion`, `list_user_connectors`, `get_user_connector`, `list_models`, `list_agents`, `get_agent`, `list_process_flows`, `get_process_flow`, `get_execution`, `knowledge_base_retrieve`, `agent_versions`, `flow_versions`, `list_schedules`, `get_schedule`, `list_triggers`, `list_peer_agents`, `handshake_peer_agent`, `get_whatsapp_connection` |
|
|
146
146
|
| `fabric:orchestrate.write` | `create_process_flow`, `update_process_flow`, `create_agent`, `update_agent`, `delete_agent`, `knowledge_base_add`, `promote_flow`, `rollback_flow_version`, `rollback_agent_version`, `create_schedule`, `update_schedule`, `delete_schedule`, `set_triggers`, `register_peer_agent`, `delete_peer_agent` |
|
|
147
147
|
| `fabric:agent.run` | `run_agent`, `run_process_flow`, `restart_execution`, `pause_execution`, `resume_execution` |
|
|
148
148
|
| `fabric:skill.write` | `provision_connector`, `configure_connector`, `delete_connector`, `request_connector`, `import_connector_spec`, `save_user_connector`, `test_user_connector_action`, `publish_user_connector`, `delete_user_connector` |
|
|
@@ -328,6 +328,52 @@ yourself — see [Arguments the server owns](#arguments-the-server-owns).
|
|
|
328
328
|
|
|
329
329
|
Needs `fabric:query.read`.
|
|
330
330
|
|
|
331
|
+
### Which projects a query reads
|
|
332
|
+
|
|
333
|
+
| Filter | Reads |
|
|
334
|
+
|---|---|
|
|
335
|
+
| `n.project_id = $project_id` | This project, plus the projects that org-shared connectors and data sources shared with this project write into |
|
|
336
|
+
| `n.project_id IN $project_ids` | Every project you can access |
|
|
337
|
+
|
|
338
|
+
The server binds both from your credential. On servers built before 10 October
|
|
339
|
+
2026, `= $project_id` also matched every other project you can access; to be sure
|
|
340
|
+
of one project there, check `project_id` in the rows you get back. The map form
|
|
341
|
+
`(n {project_id: $project_id})` reads only this project. Do not put `project_id`
|
|
342
|
+
or `project_ids` in `parameters`: a `project_id` other than your own is refused.
|
|
343
|
+
|
|
344
|
+
### Passing values: `parameters`
|
|
345
|
+
|
|
346
|
+
```python
|
|
347
|
+
rows = fabric.query_context(
|
|
348
|
+
query="""
|
|
349
|
+
MATCH (t:Ticket)
|
|
350
|
+
WHERE t.project_id = $project_id
|
|
351
|
+
AND t.status IN $statuses
|
|
352
|
+
AND t.due >= $from AND t.due < $to
|
|
353
|
+
RETURN t.id AS id, t.due AS due
|
|
354
|
+
ORDER BY due
|
|
355
|
+
LIMIT 200
|
|
356
|
+
""",
|
|
357
|
+
parameters={"statuses": ["open", "blocked"], "from": "2026-10-15", "to": "2026-10-29"},
|
|
358
|
+
)
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Refer to each value as `$name` instead of pasting it into the query text. Range
|
|
362
|
+
comparisons (`>=`, `<`, …) work on any property. Values are stored exactly as
|
|
363
|
+
`save_context` received them: a number stays a number, and a date sent as text
|
|
364
|
+
stays text. Text compares character by character, so a range filter on a date
|
|
365
|
+
stored as text only works when the date is ISO 8601 (`2026-10-15`); `10/15/2026`
|
|
366
|
+
sorts wrongly across months and years.
|
|
367
|
+
|
|
368
|
+
### Rows and time
|
|
369
|
+
|
|
370
|
+
- **Rows:** without a `LIMIT` the server adds `LIMIT 100`, and a `LIMIT` above
|
|
371
|
+
1000 is reduced to 1000. `limit=N` sets the `LIMIT` added when the query has
|
|
372
|
+
none and caps any `LIMIT` it has (1 or more; above 1000 it is reduced to 1000).
|
|
373
|
+
- **Time:** a call has about 25 seconds in total; past that it raises
|
|
374
|
+
`UpstreamError` with status 504. `timeout_ms` can only shorten that, so values
|
|
375
|
+
above about 25000 have no effect.
|
|
376
|
+
|
|
331
377
|
---
|
|
332
378
|
|
|
333
379
|
## What goes in a payload?
|
|
@@ -471,6 +517,61 @@ the ingestion path instead — see [Project mode](#project-mode-decides-your-ing
|
|
|
471
517
|
|
|
472
518
|
Needs `fabric:ontology.write`.
|
|
473
519
|
|
|
520
|
+
#### Check what was written
|
|
521
|
+
|
|
522
|
+
`save_context` raises only when nodes were sent and none was written. When some
|
|
523
|
+
items were written and others were not, it returns normally — and so does a
|
|
524
|
+
batch of only relationships, even when none of them was written:
|
|
525
|
+
|
|
526
|
+
```python
|
|
527
|
+
out = fabric.save_context(nodes=nodes, relationships=relationships)
|
|
528
|
+
if not out["success"]:
|
|
529
|
+
# e.g. ["relationship[3] (ISSUED_TO): endpoint node(s) not found"]
|
|
530
|
+
log.warning("partial save: %s nodes, %s relationships; %s",
|
|
531
|
+
out["nodes_merged"], out["relationships_merged"], out.get("errors"))
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
| Field | Meaning |
|
|
535
|
+
|---|---|
|
|
536
|
+
| `success` | `True` only when every node and relationship sent was written |
|
|
537
|
+
| `nodes_merged` | Nodes written (created or updated) |
|
|
538
|
+
| `relationships_merged` | Relationships written (created or updated) |
|
|
539
|
+
| `errors` | One message per item left out, naming it as `node[i]` or `relationship[i]`; absent when there are none |
|
|
540
|
+
| `ontology_extended` | A label or relationship type new to this project was added |
|
|
541
|
+
| `new_labels`, `new_rel_types` | Which ones |
|
|
542
|
+
|
|
543
|
+
What lands in `errors` rather than raising:
|
|
544
|
+
|
|
545
|
+
- **A relationship whose `from` or `to` node does not exist** —
|
|
546
|
+
`endpoint node(s) not found`. Endpoints are looked up, never created: send the
|
|
547
|
+
nodes in the same call or an earlier one.
|
|
548
|
+
- **A batch write that failed on the server** — `not confirmed written … re-sending
|
|
549
|
+
the save is safe`.
|
|
550
|
+
- **A node whose access scope cannot be worked out**, when the project has scope
|
|
551
|
+
tagging on.
|
|
552
|
+
|
|
553
|
+
A merge key (`key`, `from.key` or `to.key`) must start with a letter followed
|
|
554
|
+
only by letters, digits and underscores (`order_id`, not `order-id` or
|
|
555
|
+
`order id`). Any other key raises `ValidationError` (422) for the whole call before anything is
|
|
556
|
+
written, naming the item, e.g. `node[1] (Order): invalid merge key "my-key"`.
|
|
557
|
+
|
|
558
|
+
**Batch size.** At most 10,000 nodes + relationships per call; more raises
|
|
559
|
+
`ValidationError` with `status == 413`. A call has about 25 seconds;
|
|
560
|
+
a few thousand items per call is a comfortable size.
|
|
561
|
+
|
|
562
|
+
**Timeouts.** A call that runs past ~25 seconds raises `UpstreamError` with
|
|
563
|
+
`status == 504` (not `TimeoutError_`: the gateway reports it as an execute
|
|
564
|
+
failure). It may have written none, part or all of the batch — writing stops at
|
|
565
|
+
the timeout, but a batch already running on the server can still land. Re-send
|
|
566
|
+
the same batch: every write is an idempotent MERGE, so re-sending — after a
|
|
567
|
+
timeout, or to retry the items in `errors` — never duplicates anything. A
|
|
568
|
+
re-send can time out again: the server checks every relationship type that is
|
|
569
|
+
new to the project before writing anything, and that check is slow on a large
|
|
570
|
+
graph. If it does, split the batch into smaller calls with fewer new
|
|
571
|
+
relationship types in each. If you
|
|
572
|
+
passed an `idempotency_key`, re-send with a new key (or none): the timed-out key
|
|
573
|
+
answers 409 "outcome unknown" and is never run again.
|
|
574
|
+
|
|
474
575
|
### Run an agent or a process flow
|
|
475
576
|
|
|
476
577
|
These start real work and return without waiting for it.
|
|
@@ -544,9 +645,11 @@ models = fabric.list_models()
|
|
|
544
645
|
|
|
545
646
|
```
|
|
546
647
|
{'registry': [{'id': 'mdl_bx_nova', 'name': 'Nova Pro', 'provider': 'bedrock',
|
|
547
|
-
'health': 'healthy', 'default': True
|
|
648
|
+
'health': 'healthy', 'default': True,
|
|
649
|
+
'cost_per_1m': 0.8, 'cost_label': '$0.80 / 1M'},
|
|
548
650
|
{'id': 'mdl_ol_qwen', 'name': 'Qwen 2.5', 'provider': 'ollama',
|
|
549
|
-
'health': 'healthy', 'default': False
|
|
651
|
+
'health': 'healthy', 'default': False,
|
|
652
|
+
'cost_per_1m': None, 'cost_label': 'compute'}],
|
|
550
653
|
'available': [{'model_name': 'system_model', 'label_name': 'WEXA System Model'},
|
|
551
654
|
{'model_name': 'My-Azure#azure#org_7f2a#gpt-4o',
|
|
552
655
|
'label_name': 'My Azure gpt 4o'}],
|
|
@@ -617,7 +720,7 @@ answer = fabric.run_model(model="mdl_bx_nova", prompt="Summarize Q3 in one line.
|
|
|
617
720
|
{'output': 'Revenue grew 12% on flat headcount.',
|
|
618
721
|
'model': 'mdl_bx_nova', 'source': 'requested',
|
|
619
722
|
'tokens': 84, 'input_tokens': 61, 'output_tokens': 23,
|
|
620
|
-
'cached_input_tokens': 0, 'cost_usd': 0.
|
|
723
|
+
'cached_input_tokens': 0, 'cost_usd': 0.0000672, 'latency_ms': 940}
|
|
621
724
|
```
|
|
622
725
|
|
|
623
726
|
`tokens` is the total. `input_tokens` and `output_tokens` are the provider's split
|
|
@@ -636,6 +739,28 @@ it was chosen — `requested`, `organization default` or `platform default`. Rea
|
|
|
636
739
|
them before attributing a charge: they are what makes an unexpected bill
|
|
637
740
|
traceable.
|
|
638
741
|
|
|
742
|
+
#### What `cost_usd` is
|
|
743
|
+
|
|
744
|
+
`cost_usd` is an **estimate for comparing runs, not what you are billed.**
|
|
745
|
+
|
|
746
|
+
- For a model with a stored price, it is `tokens × cost_per_1m ÷ 1,000,000`. One
|
|
747
|
+
price covers input and output tokens alike, so a long answer is not costed
|
|
748
|
+
higher than a long prompt. `list_models` returns that price as `cost_per_1m` on
|
|
749
|
+
each `registry` entry. In the example above, 84 tokens on Nova Pro at $0.80 per
|
|
750
|
+
1M is $0.0000672.
|
|
751
|
+
- For a model with no stored price (`cost_per_1m` is `None`, for example
|
|
752
|
+
GPT-OSS), it is the model gateway's own reported cost, or `0` when the gateway
|
|
753
|
+
reports none.
|
|
754
|
+
- Credits are charged by a separate calculation, so the credits a call consumes
|
|
755
|
+
will not match `cost_usd`. Do not budget or bill on `cost_usd`.
|
|
756
|
+
|
|
757
|
+
#### Checking your usage
|
|
758
|
+
|
|
759
|
+
The SDK has no call that reads usage or credit charges, and an API key cannot
|
|
760
|
+
read them. Usage is only visible in the Fabric console: log in and open
|
|
761
|
+
`/settings/usage` for credits by project, model, agent and user, plus a table of
|
|
762
|
+
calls. There is no per-API-key breakdown.
|
|
763
|
+
|
|
639
764
|
```python
|
|
640
765
|
answer = fabric.run_model(prompt="Summarize Q3 in one line.")
|
|
641
766
|
if answer["source"] != "requested":
|
|
@@ -760,6 +885,59 @@ cannot report when its data is all in, so `ingestion` stays `"running"` while da
|
|
|
760
885
|
`"not_supported"` means the connector has nothing to pull. You can sync only a connector
|
|
761
886
|
provisioned in your project, and starting a sync needs `fabric:connector.sync`.
|
|
762
887
|
|
|
888
|
+
### Post to Slack through a connector
|
|
889
|
+
|
|
890
|
+
There is no Slack method in the SDK. Every connector action, such as posting a Slack
|
|
891
|
+
message, runs through `run_connector_action`, and your code looks up the connector and the
|
|
892
|
+
action's arguments at run time. It takes three steps:
|
|
893
|
+
|
|
894
|
+
```python
|
|
895
|
+
from wexa import ApprovalRequired
|
|
896
|
+
|
|
897
|
+
# 1. Find the connector. list_connectors() returns the connectors this project may use;
|
|
898
|
+
# one still waiting for its credentials is listed with no actions, so skip it.
|
|
899
|
+
connectors = fabric.list_connectors()["connectors"]
|
|
900
|
+
slack = next(c for c in connectors if c["category"] == "slack" and c["actions"])
|
|
901
|
+
connector_id = slack["connector_id"]
|
|
902
|
+
|
|
903
|
+
# 2. Find the action and read its arguments. input_schema is a JSON Schema.
|
|
904
|
+
action = next(a for a in slack["actions"] if a["name"] == "post_message")
|
|
905
|
+
action["input_schema"]["required"] # ['channel']
|
|
906
|
+
action["input_schema"]["properties"] # channel, text, thread_ts, blocks, as_bot, ...
|
|
907
|
+
|
|
908
|
+
# 3. Run it. Connector actions are consequential, so handle ApprovalRequired.
|
|
909
|
+
try:
|
|
910
|
+
sent = fabric.run_connector_action(
|
|
911
|
+
connector_id=connector_id,
|
|
912
|
+
action="post_message",
|
|
913
|
+
params={"channel": "C0123456789", "text": "Refund issued for order 1042"},
|
|
914
|
+
)
|
|
915
|
+
sent["data"]["ts"] # the message's Slack timestamp
|
|
916
|
+
except ApprovalRequired as e:
|
|
917
|
+
token = e.resume_token # keep it; resume once a person approves
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
`channel` takes a channel ID, a channel name, or a user ID (`U…` or `W…`) to send a direct
|
|
921
|
+
message. `text` is required unless you send `blocks` or `attachments`. The message is posted
|
|
922
|
+
**as the Slack user the connector was configured with**. Add `"as_bot": True` to `params` to
|
|
923
|
+
post as the Slack app instead.
|
|
924
|
+
|
|
925
|
+
After the approval, resume with the token: `fabric.run_connector_action(
|
|
926
|
+
connector_id=connector_id, action="post_message", resume_token=token)`. Only the token is sent; it stands for the call you
|
|
927
|
+
made, so the other arguments are not sent again. Or pass `wait_for_approval=True` to the first
|
|
928
|
+
call and it waits for the decision itself (see [Approvals](#approvals)).
|
|
929
|
+
|
|
930
|
+
Running an action needs `fabric:connector.run`, and a connector outside your access scope is
|
|
931
|
+
refused. `list_connectors` lists only connectors provisioned for you. To plan against Slack
|
|
932
|
+
before it is provisioned, read its actions and their fields from the catalog, then ask
|
|
933
|
+
for it with `request_connector`:
|
|
934
|
+
|
|
935
|
+
```python
|
|
936
|
+
catalog = fabric.list_connector_catalog(category="slack", schemas=True)
|
|
937
|
+
```
|
|
938
|
+
|
|
939
|
+
`list_connector_catalog` is in the SDK from 0.6.0.
|
|
940
|
+
|
|
763
941
|
### Connect a data source (Snowflake, databases, warehouses)
|
|
764
942
|
|
|
765
943
|
The console's **Data Sources** tab lists sources whose data is ingested into the graph
|
|
@@ -838,6 +1016,24 @@ matching an earlier registration of the number. A provider that rejects the link
|
|
|
838
1016
|
raises `UpstreamError`. Connecting needs `fabric:connector.connect`; reading the status
|
|
839
1017
|
needs `fabric:orchestrate.read`. `examples/whatsapp_connect.py` is the whole flow.
|
|
840
1018
|
|
|
1019
|
+
### Register a peer agent (an external agent)
|
|
1020
|
+
|
|
1021
|
+
```python
|
|
1022
|
+
fabric.handshake_peer_agent(endpoint="https://agents.example.com/a2a", protocol="a2a", secret=token)
|
|
1023
|
+
reg = fabric.register_peer_agent(name="invoice-reconciler", endpoint="https://agents.example.com/a2a",
|
|
1024
|
+
protocol="a2a", secret=token)
|
|
1025
|
+
```
|
|
1026
|
+
|
|
1027
|
+
When `secret` is set, Fabric sends it as `Authorization: Bearer <secret>` on every call to the
|
|
1028
|
+
external agent. With no secret, no header is sent. Only `auth="key"` (the default) works;
|
|
1029
|
+
`oauth` and `mtls` are refused. Fabric does not fetch or refresh tokens, so a short-lived
|
|
1030
|
+
token stops working when it expires.
|
|
1031
|
+
|
|
1032
|
+
There is no call that updates a secret. To rotate one: register a new connection, point every
|
|
1033
|
+
`interop_agent` node at the new connection id with `update_process_flow` (`registration_id`),
|
|
1034
|
+
then call `delete_peer_agent` on the old one. `delete_peer_agent` refuses while a node still
|
|
1035
|
+
uses the connection.
|
|
1036
|
+
|
|
841
1037
|
### Search code
|
|
842
1038
|
|
|
843
1039
|
```python
|
|
@@ -880,46 +1076,43 @@ everything you need to finish the call later.
|
|
|
880
1076
|
|
|
881
1077
|
### What gates
|
|
882
1078
|
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
amount threshold. A call gates when:
|
|
886
|
-
|
|
887
|
-
- any graph label or argument it touches contains `pii`, `sensitive`,
|
|
888
|
-
`confidential` or `personal` — substring match, case-insensitive; or
|
|
889
|
-
- the asset it touches is classified restricted in OpenMetadata.
|
|
1079
|
+
Four policy rules can hold a call. The rule that held yours is on the error:
|
|
1080
|
+
`e.rule` is its name and `e.reason` says why.
|
|
890
1081
|
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
1082
|
+
| `e.rule` | Held when |
|
|
1083
|
+
|---|---|
|
|
1084
|
+
| `consequential write requires approval for SDK callers` | The project's consequential write gate is on and the call is a consequential write made with an API key or an SDK session (admin keys included). |
|
|
1085
|
+
| `om-pii-classification gate` | The call touches an asset OpenMetadata has classified PII or Sensitive. Words such as "personal" or "pii" in a goal, prompt, label or query do **not** gate; only the classification does. An admin in a non-automated call is let through with an audit entry. |
|
|
1086
|
+
| `ontology commit requires gate` | A non-admin `create_ontology(mode="commit")` on an Advanced/manual project. |
|
|
1087
|
+
| `connector action requires approval` | A connector action the platform does not mark safe. |
|
|
894
1088
|
|
|
895
|
-
|
|
896
|
-
|
|
1089
|
+
`e.message` is the tool's own description of the action and differs per tool, so
|
|
1090
|
+
branch on `e.rule`, not on the text. Both are `None` against a server that does
|
|
1091
|
+
not send them.
|
|
897
1092
|
|
|
898
|
-
Reads are not exempt for being reads
|
|
899
|
-
|
|
1093
|
+
Reads are not exempt for being reads: a `query_context` that touches a
|
|
1094
|
+
classified asset gates too.
|
|
900
1095
|
|
|
901
|
-
### Consequential writes wait for approval
|
|
1096
|
+
### Consequential writes wait for approval when the gate is on
|
|
902
1097
|
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
are not held.
|
|
1098
|
+
The consequential write gate is **off by default**. A project admin turns it on,
|
|
1099
|
+
or back off, in the project's settings. While it is on, consequential writes made
|
|
1100
|
+
with an API key or an SDK session wait for a person to approve them, and that
|
|
1101
|
+
includes admin API keys. Actions taken by a person in the console are not held.
|
|
1102
|
+
`docs("governance")` reports the same default.
|
|
907
1103
|
|
|
908
1104
|
Consequential writes include table row inserts and updates (`insert_table_rows`,
|
|
909
1105
|
`update_table_row`), table create and rename (`create_table`, `rename_table`),
|
|
910
1106
|
trigger changes (`set_triggers`) and connector actions (`run_connector_action`),
|
|
911
1107
|
as well as the tools that were already consequential, such as
|
|
912
|
-
`delete_table_rows`, `save_context` and `run_agent`.
|
|
913
|
-
raises `ApprovalRequired
|
|
914
|
-
|
|
915
|
-
A project admin turns the gate off, or back on, in the project's settings. With
|
|
916
|
-
it off, consequential writes from API keys and SDK sessions run without approval
|
|
917
|
-
again. The data-driven gating above still applies either way.
|
|
1108
|
+
`delete_table_rows`, `save_context` and `run_agent`. With the gate on, each of
|
|
1109
|
+
these raises `ApprovalRequired`. With it off, they run without approval. The
|
|
1110
|
+
data-driven gating above applies either way.
|
|
918
1111
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
runtime, so a call that sailed through yesterday
|
|
922
|
-
change on your side.
|
|
1112
|
+
**Handle `ApprovalRequired` on every governed call**, not on the one step you
|
|
1113
|
+
expect to gate. A project admin can turn the write gate on at any time, and
|
|
1114
|
+
classification is populated at runtime, so a call that sailed through yesterday
|
|
1115
|
+
can start gating today with no change on your side.
|
|
923
1116
|
|
|
924
1117
|
### The complete round trip
|
|
925
1118
|
|
|
@@ -932,16 +1125,18 @@ from wexa import Fabric, ApprovalRequired
|
|
|
932
1125
|
|
|
933
1126
|
fabric = Fabric()
|
|
934
1127
|
|
|
935
|
-
# 1. The call
|
|
1128
|
+
# 1. The call is held. HTTP 202, no result — an ApprovalRequired instead.
|
|
936
1129
|
try:
|
|
937
1130
|
fabric.save_context(nodes=[
|
|
938
|
-
{"label": "
|
|
1131
|
+
{"label": "Customer", "key": "id",
|
|
939
1132
|
"properties": {"id": "cust_8841", "email": "ada@example.com"}},
|
|
940
1133
|
])
|
|
941
1134
|
except ApprovalRequired as e:
|
|
942
1135
|
print(e.approval_id) # apr_000012
|
|
943
1136
|
print(e.resume_token) # rtok_000012_17... single use, keep it safe
|
|
944
1137
|
print(e.lifecycle_id) # the lifecycle that parked
|
|
1138
|
+
print(e.rule) # consequential write requires approval for SDK callers
|
|
1139
|
+
print(e.reason) # why that rule held it
|
|
945
1140
|
token = e.resume_token
|
|
946
1141
|
```
|
|
947
1142
|
|
|
@@ -964,6 +1159,12 @@ The rule is the registry's, the same one the console Inbox applies, so the SDK a
|
|
|
964
1159
|
the console never disagree about who may approve. The approver is always taken
|
|
965
1160
|
from your credential: a request body naming one is refused.
|
|
966
1161
|
|
|
1162
|
+
Whoever may decide an approval may also decide one they raised themselves:
|
|
1163
|
+
self-approval is not blocked, and there is no setting that blocks it. When the
|
|
1164
|
+
approver is the requester, the decision still goes through, and it is recorded
|
|
1165
|
+
with `self_approved` set in the audit log so a reviewer can see it afterwards. If
|
|
1166
|
+
you need a second person to sign off, enforce that in your own workflow.
|
|
1167
|
+
|
|
967
1168
|
### Ask for an approval from your app
|
|
968
1169
|
|
|
969
1170
|
`request_approval` puts your app's own decision in front of a person in this
|
|
@@ -1037,7 +1238,7 @@ Sixty-four tools, plus five governance calls that need no grant.
|
|
|
1037
1238
|
| Execution control — restart, pause, resume | `restart_execution`, `pause_execution`, `resume_execution` | `fabric:agent.run` |
|
|
1038
1239
|
| Agents — read | `list_agents`, `get_agent`, `agent_versions` | `fabric:orchestrate.read` |
|
|
1039
1240
|
| Agents — write | `create_agent`, `update_agent`, `delete_agent`, `rollback_agent_version` | `fabric:orchestrate.write` |
|
|
1040
|
-
| Process flows — read | `get_process_flow`, `get_execution`, `flow_versions` | `fabric:orchestrate.read` |
|
|
1241
|
+
| Process flows — read | `list_process_flows`, `get_process_flow`, `get_execution`, `flow_versions` | `fabric:orchestrate.read` |
|
|
1041
1242
|
| Process flows — write | `create_process_flow`, `update_process_flow`, `promote_flow`, `rollback_flow_version` | `fabric:orchestrate.write` |
|
|
1042
1243
|
| Process flows — delete | `delete_process_flow` | `fabric:flow.delete` |
|
|
1043
1244
|
| Knowledge base — read | `knowledge_base_retrieve` | `fabric:orchestrate.read` |
|