blueskyagent-ai-client 1.46.0__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.
Files changed (113) hide show
  1. blueskyagent_ai_client-1.46.0/PKG-INFO +6 -0
  2. blueskyagent_ai_client-1.46.0/README.md +48 -0
  3. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/__init__.py +28 -0
  4. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/__main__.py +74 -0
  5. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/__init__.py +1 -0
  6. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/__init__.py +74 -0
  7. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/artifacts.py +114 -0
  8. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/document_notes.py +99 -0
  9. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/documents.py +342 -0
  10. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/harness_instance.py +78 -0
  11. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/issues.py +271 -0
  12. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/leads.py +35 -0
  13. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/logs.py +36 -0
  14. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/mcp_servers.py +55 -0
  15. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/me.py +60 -0
  16. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/oauth2_tokens.py +55 -0
  17. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/projects.py +163 -0
  18. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/recordings.py +79 -0
  19. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/reports.py +55 -0
  20. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/schedules.py +183 -0
  21. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/session_messages.py +45 -0
  22. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/skills.py +266 -0
  23. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/subagent_calls.py +36 -0
  24. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/wiki.py +283 -0
  25. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/agent/workflows.py +48 -0
  26. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/public/__init__.py +29 -0
  27. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/public/chat_widget.py +184 -0
  28. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/public/oauth_token.py +66 -0
  29. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/public/plans.py +47 -0
  30. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/public/webhooks.py +86 -0
  31. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/root/__init__.py +35 -0
  32. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/root/auth.py +53 -0
  33. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/root/oauth2_flow.py +139 -0
  34. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/root/oauth_discovery.py +34 -0
  35. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/root/openai_apps_challenge.py +33 -0
  36. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/root/system_ais.py +43 -0
  37. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/root/workflows.py +53 -0
  38. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/stream/__init__.py +23 -0
  39. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/stream/instances.py +44 -0
  40. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/stream/public_instances.py +44 -0
  41. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/__init__.py +203 -0
  42. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/analytics.py +323 -0
  43. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/api_keys.py +100 -0
  44. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/artifacts.py +134 -0
  45. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/auth.py +178 -0
  46. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/auto_recharge.py +50 -0
  47. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/canonical_providers.py +96 -0
  48. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/catalog.py +34 -0
  49. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/categories.py +144 -0
  50. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/commercial_products.py +105 -0
  51. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/companies.py +282 -0
  52. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/company_global_agents.py +93 -0
  53. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/cost_configurations.py +53 -0
  54. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/credentials.py +127 -0
  55. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/credit_packs.py +167 -0
  56. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/document_notes.py +99 -0
  57. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/documents.py +365 -0
  58. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/evals.py +72 -0
  59. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/global_config.py +60 -0
  60. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/harnesses.py +119 -0
  61. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/health.py +34 -0
  62. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/implementation_types.py +136 -0
  63. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/instances.py +73 -0
  64. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/issues.py +361 -0
  65. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/manifests.py +299 -0
  66. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/mcp_servers.py +300 -0
  67. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/mcp_showcase_categories.py +92 -0
  68. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/notifications.py +244 -0
  69. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/oauth1.py +54 -0
  70. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/oauth2_providers.py +102 -0
  71. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/oauth2_tokens.py +99 -0
  72. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/oauth_clients.py +113 -0
  73. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/oauth_consent.py +68 -0
  74. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/orders.py +127 -0
  75. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/payment_methods.py +104 -0
  76. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/payments.py +138 -0
  77. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/permissions.py +597 -0
  78. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/plan_purchases.py +192 -0
  79. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/plans.py +132 -0
  80. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/platform.py +48 -0
  81. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/platform_documents.py +108 -0
  82. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/projects.py +429 -0
  83. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/recordings.py +138 -0
  84. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/report_types.py +107 -0
  85. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/reports.py +142 -0
  86. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/servers.py +392 -0
  87. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/service_providers.py +114 -0
  88. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/services.py +171 -0
  89. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/sessions.py +183 -0
  90. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/skill_repositories.py +153 -0
  91. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/skills.py +270 -0
  92. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/stripe.py +35 -0
  93. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/system_ais.py +201 -0
  94. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/usage.py +73 -0
  95. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/users.py +186 -0
  96. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/voice.py +297 -0
  97. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/webhooks.py +130 -0
  98. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/widget_credentials.py +116 -0
  99. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/wiki.py +266 -0
  100. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/workflow_documents.py +90 -0
  101. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/workflow_personal_tokens.py +69 -0
  102. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/workflow_plans.py +38 -0
  103. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/v1/workflows.py +1189 -0
  104. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/web/__init__.py +23 -0
  105. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/web/documents.py +48 -0
  106. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/api/web/mcp_servers.py +37 -0
  107. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/catalog.json +19217 -0
  108. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/client.py +101 -0
  109. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/discovery.py +87 -0
  110. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/models.py +14116 -0
  111. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/py.typed +0 -0
  112. blueskyagent_ai_client-1.46.0/blueskyagent_ai_client/runtime.py +510 -0
  113. blueskyagent_ai_client-1.46.0/pyproject.toml +13 -0
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.5
2
+ Name: blueskyagent_ai_client
3
+ Version: 1.46.0
4
+ Summary: Typed client for the BlueSky API. Generated from its OpenAPI document.
5
+ Requires-Python: >=3.13
6
+ Requires-Dist: aiohttp>=3.10
@@ -0,0 +1,48 @@
1
+ # bluesky_client
2
+
3
+ A typed Python client for the BlueSky API. It is generated from the OpenAPI document. Do not edit it.
4
+
5
+ It needs Python 3.13 and `aiohttp`. To use it, copy the `bluesky_client` folder into your repo, or run
6
+ `pip install .` in this folder.
7
+
8
+ ```python
9
+ from bluesky_client import BlueSkyClient
10
+
11
+ async with BlueSkyClient("https://api.example.com", api_token="bsk_...") as client:
12
+ page = await client.v1.documents.list_documents(workflow_id="...")
13
+ ```
14
+
15
+ - `client.agent`, `client.v1`, `client.public` and `client.root` are the four surfaces. The path prefix of a route decides its surface.
16
+ - One route is one method. A method that returns a file takes `dest=` and returns a `FileBody`.
17
+ - A multipart body cannot hold an empty list. The client adds the field `_empty` (`_empty[0]=leads`) for each empty list
18
+ or object, and the API sets it to `[]`. Pass `[]` as you would in JSON. A key with a dot in it cannot be sent next to an empty list.
19
+ - `client.web` has the routes that a browser calls with its session cookie (documents, report documents, MCP server icons).
20
+ They need no token: pass the cookie as `cookie="name=value"`, or give the client a session that keeps cookies.
21
+ - A route that checks a CSRF token (the OAuth2 flow routes, marked `x-csrf` in the docs) gets one by itself: the client calls
22
+ `/sanctum/csrf-cookie` once, sends the token in `X-CSRF-TOKEN`, and tries again with a new token after a 419. The token
23
+ belongs to a web session, so the client must keep the cookies of that call (a normal `aiohttp` session does, for a host name).
24
+ - To read every item of a list route that pages with `page`, use `client.iter` with the method and its arguments.
25
+ It fetches one page at a time, and the items keep their type:
26
+
27
+ ```python
28
+ async for document in client.iter(client.v1.documents.list_documents, workflow_id=workflow_id, per_page=100):
29
+ print(document["name"])
30
+ ```
31
+
32
+ A `page=` argument says where to start. It works for any route that answers `{"data": [...], "meta": {"last_page": ...}}`.
33
+ - A route that streams server-sent events returns an async iterator of `SseEvent`. It is on the `stream` surface,
34
+ the streaming sidecar, which has its own base URL:
35
+
36
+ ```python
37
+ async with BlueSkyClient(url, api_token="bsk_...", stream_base_url="https://stream.example.com") as client:
38
+ async for event in client.stream.instances.read_stream(instance_id):
39
+ print(event.data) # parsed JSON, or the text when it is not JSON
40
+ ```
41
+
42
+ Stop early with `contextlib.aclosing(...)`, so the connection closes at once.
43
+ A surface that is a separate service takes its own `<surface>_base_url`, and fails with `MissingBaseUrlError` without it.
44
+ - `api_token` serves `v1` and `root`. `agent_token` serves `agent`. `public` needs no credential.
45
+ A route with its own credential, such as the WordPress widget config, takes `credential=`.
46
+ - File reads and writes run in a thread, so the event loop never waits for the disk.
47
+ - Browse it: `python -m bluesky_client`, `python -m bluesky_client v1.documents`, or `client.describe("v1.documents.list_documents")`.
48
+ - Type-check your code that calls it with pyright or mypy. A route that changes makes the check fail.
@@ -0,0 +1,28 @@
1
+ # Generated from the OpenAPI document. Do not edit.
2
+ from . import discovery
3
+ from .client import BlueSkyClient
4
+ from .runtime import (
5
+ ApiError,
6
+ FileBody,
7
+ MissingBaseUrlError,
8
+ MissingCredentialError,
9
+ ResponseTooLarge,
10
+ SseEvent,
11
+ UnexpectedContentType,
12
+ Upload,
13
+ ValidationError,
14
+ )
15
+
16
+ __all__ = [
17
+ "ApiError",
18
+ "BlueSkyClient",
19
+ "FileBody",
20
+ "MissingBaseUrlError",
21
+ "MissingCredentialError",
22
+ "ResponseTooLarge",
23
+ "SseEvent",
24
+ "UnexpectedContentType",
25
+ "Upload",
26
+ "ValidationError",
27
+ "discovery",
28
+ ]
@@ -0,0 +1,74 @@
1
+ """Browse the client from a terminal.
2
+
3
+ python -m bluesky_client list the surfaces
4
+ python -m bluesky_client v1 list the groups of a surface
5
+ python -m bluesky_client v1.documents list the methods of a group
6
+ python -m bluesky_client v1.documents.list_documents show one method
7
+ python -m bluesky_client --search wiki find methods by name, summary or path
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import sys
13
+
14
+ from . import discovery
15
+
16
+
17
+ def first_sentence(text: str) -> str:
18
+ return text.split(". ")[0].rstrip(".").strip()
19
+
20
+
21
+ def show_surfaces() -> None:
22
+ for surface in discovery.surfaces():
23
+ print(f"{surface['name']:<8} {len(surface['groups']):>3} groups {first_sentence(surface['description'])}")
24
+
25
+
26
+ def show_surface(name: str) -> None:
27
+ for group in discovery.groups(name):
28
+ print(f"{group['name']:<26} {len(group['methods']):>3} {first_sentence(group['description'])}")
29
+
30
+
31
+ def show_group(surface: str, name: str) -> None:
32
+ for method in discovery.method_names(surface, name):
33
+ info = discovery.describe(f"{surface}.{name}.{method}")
34
+ print(f"{method:<44} {info['http_method'].upper():<6} {info['path']} {info['summary']}")
35
+
36
+
37
+ def show_method(target: str) -> None:
38
+ info = discovery.describe(target)
39
+ needs = {"api": "api_token", "agent": "agent_token", "own": "its own credential=", None: "no credential"}[info["credential"]]
40
+ print(f"{target} ({info['http_method'].upper()} {info['path']}, needs {needs})")
41
+ if info["deprecated"]:
42
+ print("DEPRECATED")
43
+ print(f"\n{info['summary']}\n\n{info['description']}\n")
44
+ for p in info["params"]:
45
+ flag = "required" if p["required"] else "optional"
46
+ print(f" {p['name']} ({p['location']}, {flag}) {p['description']}")
47
+ if info["body"]:
48
+ print(f" body ({info['body']})")
49
+ print(f"\nreturns: {info['returns']}")
50
+
51
+
52
+ def main(argv: list[str]) -> int:
53
+ try:
54
+ if not argv:
55
+ show_surfaces()
56
+ elif argv[0] == "--search" and len(argv) == 2:
57
+ for info in discovery.search(argv[1]):
58
+ print(f"{info['surface']}.{info['group']}.{info['name']:<44} {info['http_method'].upper():<6} {info['path']}")
59
+ else:
60
+ parts = argv[0].split(".")
61
+ if len(parts) == 1:
62
+ show_surface(parts[0])
63
+ elif len(parts) == 2:
64
+ show_group(parts[0], parts[1])
65
+ else:
66
+ show_method(argv[0])
67
+ except KeyError as error:
68
+ print(error.args[0], file=sys.stderr)
69
+ return 1
70
+ return 0
71
+
72
+
73
+ if __name__ == "__main__":
74
+ raise SystemExit(main(sys.argv[1:]))
@@ -0,0 +1 @@
1
+ # Generated from the OpenAPI document. Do not edit.
@@ -0,0 +1,74 @@
1
+ # Generated from the OpenAPI document. Do not edit.
2
+ from __future__ import annotations
3
+
4
+ from ... import discovery
5
+ from ...runtime import Transport
6
+ from .artifacts import AgentArtifactsNamespace
7
+ from .document_notes import AgentDocumentNotesNamespace
8
+ from .documents import AgentDocumentsNamespace
9
+ from .harness_instance import AgentHarnessInstanceNamespace
10
+ from .issues import AgentIssuesNamespace
11
+ from .leads import AgentLeadsNamespace
12
+ from .logs import AgentLogsNamespace
13
+ from .mcp_servers import AgentMcpServersNamespace
14
+ from .me import AgentMeNamespace
15
+ from .oauth2_tokens import AgentOauth2TokensNamespace
16
+ from .projects import AgentProjectsNamespace
17
+ from .recordings import AgentRecordingsNamespace
18
+ from .reports import AgentReportsNamespace
19
+ from .schedules import AgentSchedulesNamespace
20
+ from .session_messages import AgentSessionMessagesNamespace
21
+ from .skills import AgentSkillsNamespace
22
+ from .subagent_calls import AgentSubagentCallsNamespace
23
+ from .wiki import AgentWikiNamespace
24
+ from .workflows import AgentWorkflowsNamespace
25
+
26
+
27
+ class AgentApi:
28
+ """Routes for a running agent instance, under /agent/. The credential is the instance JWT, and it sets the scope of every call."""
29
+
30
+ artifacts: AgentArtifactsNamespace
31
+ document_notes: AgentDocumentNotesNamespace
32
+ documents: AgentDocumentsNamespace
33
+ harness_instance: AgentHarnessInstanceNamespace
34
+ issues: AgentIssuesNamespace
35
+ leads: AgentLeadsNamespace
36
+ logs: AgentLogsNamespace
37
+ mcp_servers: AgentMcpServersNamespace
38
+ me: AgentMeNamespace
39
+ oauth2_tokens: AgentOauth2TokensNamespace
40
+ projects: AgentProjectsNamespace
41
+ recordings: AgentRecordingsNamespace
42
+ reports: AgentReportsNamespace
43
+ schedules: AgentSchedulesNamespace
44
+ session_messages: AgentSessionMessagesNamespace
45
+ skills: AgentSkillsNamespace
46
+ subagent_calls: AgentSubagentCallsNamespace
47
+ wiki: AgentWikiNamespace
48
+ workflows: AgentWorkflowsNamespace
49
+
50
+ def __init__(self, transport: Transport) -> None:
51
+ self.artifacts = AgentArtifactsNamespace(transport)
52
+ self.document_notes = AgentDocumentNotesNamespace(transport)
53
+ self.documents = AgentDocumentsNamespace(transport)
54
+ self.harness_instance = AgentHarnessInstanceNamespace(transport)
55
+ self.issues = AgentIssuesNamespace(transport)
56
+ self.leads = AgentLeadsNamespace(transport)
57
+ self.logs = AgentLogsNamespace(transport)
58
+ self.mcp_servers = AgentMcpServersNamespace(transport)
59
+ self.me = AgentMeNamespace(transport)
60
+ self.oauth2_tokens = AgentOauth2TokensNamespace(transport)
61
+ self.projects = AgentProjectsNamespace(transport)
62
+ self.recordings = AgentRecordingsNamespace(transport)
63
+ self.reports = AgentReportsNamespace(transport)
64
+ self.schedules = AgentSchedulesNamespace(transport)
65
+ self.session_messages = AgentSessionMessagesNamespace(transport)
66
+ self.skills = AgentSkillsNamespace(transport)
67
+ self.subagent_calls = AgentSubagentCallsNamespace(transport)
68
+ self.wiki = AgentWikiNamespace(transport)
69
+ self.workflows = AgentWorkflowsNamespace(transport)
70
+
71
+ @property
72
+ def namespaces(self) -> list[str]:
73
+ """The names of the groups of this surface."""
74
+ return discovery.group_names("agent")
@@ -0,0 +1,114 @@
1
+ # Generated from the OpenAPI document. Do not edit.
2
+ from __future__ import annotations
3
+
4
+ from collections.abc import AsyncIterator
5
+ from pathlib import Path
6
+ from typing import Any, Literal
7
+
8
+ from ...runtime import BaseNamespace, FileBody, Op, SseEvent, Upload
9
+ from ...models import (
10
+ ArtifactDetail,
11
+ ArtifactInput,
12
+ ArtifactWithOptions,
13
+ DecideArtifactApprovalRequest,
14
+ DecidedArtifact,
15
+ DeliverAgentArtifactRequest,
16
+ DeliveredArtifact,
17
+ RedoArtifactRequest,
18
+ RedoneArtifact,
19
+ )
20
+
21
+
22
+ _OPS: dict[str, Op] = {
23
+ "create_agent_issue_artifact": Op("create_agent_issue_artifact", "post", "/agent/issues/{issueId}/artifacts", 'json', "json", "agent", 'agent'),
24
+ "decide_agent_artifact_approval": Op("decide_agent_artifact_approval", "post", "/agent/artifacts/{artifactId}/approvals", 'json', "json", "agent", 'agent'),
25
+ "deliver_agent_artifact": Op("deliver_agent_artifact", "patch", "/agent/artifacts/{artifactId}", 'multipart', "json", "agent", 'agent', json_fields=('record',)),
26
+ "redo_agent_artifact": Op("redo_agent_artifact", "post", "/agent/artifacts/{artifactId}/redo", 'json', "json", "agent", 'agent'),
27
+ "show_agent_artifact": Op("show_agent_artifact", "get", "/agent/artifacts/{artifactId}", None, "json", "agent", 'agent'),
28
+ }
29
+
30
+
31
+ class AgentArtifactsNamespace(BaseNamespace):
32
+ """Artifacts: the deliverables an issue produces. An agent declares an artifact on an issue, delivers its content, and asks for a redo. A reviewer approves or rejects it. Routes exist under /api/v1/ and under /agent/."""
33
+
34
+ _surface = "agent"
35
+ _group = "artifacts"
36
+
37
+ async def create_agent_issue_artifact(
38
+ self,
39
+ issue_id: str,
40
+ body: ArtifactInput,
41
+ ) -> ArtifactWithOptions:
42
+ """Declare an artifact on an existing issue.
43
+
44
+ Declares one artifact the issue must produce, for example a parent's own deliverable. Same input as an artifact on creation. A `choice` needs its options (2 to 50) and a `record` its schema, which is checked like every other structured schema of the platform (three levels at most). `approvals` declares the approval chain: each step lists agents included in the project or members of its company, with a quorum. The chain cannot change later. The key must be new on the issue. An issue holds at most 20 own artifacts in total: a declare on an issue that has 20 is a 422 keyed on `artifacts`, for example `An issue may have at most 20 artifacts. It has 20, and this request adds 1.` The issue becomes coordinated, an `artifact_declared` activity row is written, and the reconciler runs on the tree. The issue's assigned agent can then not `complete` it until the artifact is produced. Any agent included in the issue's project may declare. The gate is the calling workflow's inclusion in the issue's project: a project the workflow is not included in answers 404. An issue of an archived tree (its root has `archived_at` set) is read-only: this write answers 409 `{message}` `This issue is archived. Restore it first.` and nothing is written.
45
+
46
+ POST /agent/issues/{issueId}/artifacts
47
+
48
+ Args:
49
+ issue_id: The UUID of the issue that must produce the artifact
50
+ """
51
+ return await self._t.call(_OPS["create_agent_issue_artifact"], path={'issueId': issue_id}, query={}, body=body)
52
+
53
+ async def decide_agent_artifact_approval(
54
+ self,
55
+ artifact_id: str,
56
+ body: DecideArtifactApprovalRequest,
57
+ ) -> DecidedArtifact:
58
+ """Approve or reject an artifact.
59
+
60
+ An agent approver decides on the current version of the artifact, usually from its review sub-issue (a subtask assigned to it, with a `produced` need on the artifact). Read the artifact first with `GET /agent/artifacts/{artifactId}` and send the `version` you read. The decision counts at the next undecided step, where the caller must be an actor. Steps run in order: a step passes when it holds no reject and its approvals reach its quorum (all actors when the quorum is null), counted over the actors who can still decide: an agent deleted, no longer included in the project, or whose review sub-issue was cancelled or deleted, and a person deleted or no longer a member of the company, is left out of the step, nothing is written, and the step needs at most as many approvals as actors left. A step with no actor left passes. Approvals given before an actor was left out still count. Then the next step opens and its agents get their review sub-issues. The artifact is approved when every step passed. A version that is not the current one, an artifact that is not produced, or a pending redo answers 409 and writes nothing. A decision on a step that is already decided (its quorum met, or a reject on it), or a second decision by the same agent on the same version, is stored with `counted = false` and answers 409: read the artifact again. `approve` writes an `artifact_approved` activity row on the producing issue, which points at the decision. `reject` needs a `reason` and writes an `artifact_rejected` row; it starts a redo that cascades, as `POST /agent/artifacts/{artifactId}/redo` does, with the reason: `version` goes up, issues that started on the old version go `stale`, the producing agent runs again and reads the reason through the activity route, and the chain starts again from the first step on the next delivery. The rejects of agents count toward the project's agent redo cap (3 by default): when the agents' rejects on this artifact since the last decision by a person already reached it, the reject starts no redo, and the producing issue goes `blocked` with `blocked_reason` `approval_rejected`. A decision by a person on the artifact, a redo a person asks for, or a person's unblock (`POST /api/v1/issues/{issueId}/unblock`, which asks a redo in the person's name) starts the count again. A blocked producer leaves `blocked` only when a person unblocks it, or cancels it. A review sub-issue that is `done` while its agent still owes a decision on the current version runs again. After the call, call `complete` on your review sub-issue. The gate is the calling workflow's inclusion in the project of the artifact's issue: a project the workflow is not included in answers 404. An issue of an archived tree (its root has `archived_at` set) is read-only: this write answers 409 `{message}` `This issue is archived. Restore it first.` and nothing is written.
61
+
62
+ POST /agent/artifacts/{artifactId}/approvals
63
+
64
+ Args:
65
+ artifact_id: The UUID of the artifact to decide on
66
+ """
67
+ return await self._t.call(_OPS["decide_agent_artifact_approval"], path={'artifactId': artifact_id}, query={}, body=body)
68
+
69
+ async def deliver_agent_artifact(
70
+ self,
71
+ artifact_id: str,
72
+ body: DeliverAgentArtifactRequest,
73
+ ) -> DeliveredArtifact:
74
+ """Deliver an artifact's content.
75
+
76
+ The producer writes the content: this is the delivery. The first delivery sets `produced_at`. Every delivery sets `delivered_at`. A delivery that nobody asked for (the artifact was already produced and no redo is pending) raises `version` by one, so issues that started on the old version go `stale` and run again. A delivery that answers a pending redo ends the redo and does not raise `version` again: a redo that cascades already raised it, and a minor redo keeps it. When the artifact has an approval chain, the delivery opens its first step: each agent of the step gets a review sub-issue (a subtask of the producing issue), and approvals of an older version do not count. Send only the content fields of the artifact's kind: `body` or `file` for `text`, never both, `file` for `file`, `url` for `link`, `record` for `record`, `option_ids` for `choice`. On every kind, a free-text `response` may come instead of the content or with it: a delivery with only a response clears the content fields and counts as produced, and the kind's checks run only on content that is sent. Another content field, a text delivery with both `body` and `file` (the message `Send the text or a file, not both.` under `body`), a delivery with neither content nor a response, a record that does not validate against the schema, an option of another artifact, or several options on a single choice answers 422. To send a file, use `multipart/form-data` through `POST /agent/artifacts/{artifactId}` with the form field `_method=PATCH` (method spoofing: a multipart `PATCH` body is not read); in multipart, send `record` as a JSON string. The file is stored with the artifact, and the file of the delivery before is removed; readers download it through the signed `download_url` of the artifact's detail. An `artifact_delivered` activity row is written on the producing issue and the reconciler runs on the tree: issues that need the artifact may start. Only the agent assigned to the artifact's issue may deliver. The gate is the calling workflow's inclusion in the project: a project the workflow is not included in answers 404. An issue of an archived tree (its root has `archived_at` set) is read-only: this write answers 409 `{message}` `This issue is archived. Restore it first.` and nothing is written.
77
+
78
+ PATCH /agent/artifacts/{artifactId}
79
+
80
+ Args:
81
+ artifact_id: The UUID of the artifact to deliver
82
+ """
83
+ return await self._t.call(_OPS["deliver_agent_artifact"], path={'artifactId': artifact_id}, query={}, body=body)
84
+
85
+ async def redo_agent_artifact(
86
+ self,
87
+ artifact_id: str,
88
+ body: RedoArtifactRequest,
89
+ ) -> RedoneArtifact:
90
+ """Ask for an artifact to be redone.
91
+
92
+ Asks the producer for new content. It records a redo request (who asked, the reason, `cascade`), sets `redo_requested_at` to its time, clears a choice's selected options, and writes an `artifact_redo` activity row on the producing issue that points at the request: the producer reads the reason there, through the activity route. `cascade` (default true) raises `version`, so every issue that started on the old version goes `stale`: its live run is cancelled, and it runs again when the new content is delivered. A minor redo (`cascade: false`) keeps `version`, so no issue goes stale, and revokes the approvals of the current version, so the chain starts again on the next delivery. Either way the redo is pending until the next delivery: a `produced` need on the artifact is not met, and the producing issue's agent cannot `complete`. If the producing agent had already completed its work, it runs again, and a `done` issue goes back to `in_progress`. An artifact never delivered answers 409. The caller must be an agent assigned to an issue of the same tree. The gate is the calling workflow's inclusion in the project: a project the workflow is not included in answers 404. An issue of an archived tree (its root has `archived_at` set) is read-only: this write answers 409 with `This issue is archived. Restore it first.` and nothing is written.
93
+
94
+ POST /agent/artifacts/{artifactId}/redo
95
+
96
+ Args:
97
+ artifact_id: The UUID of the artifact to redo
98
+ """
99
+ return await self._t.call(_OPS["redo_agent_artifact"], path={'artifactId': artifact_id}, query={}, body=body)
100
+
101
+ async def show_agent_artifact(
102
+ self,
103
+ artifact_id: str,
104
+ ) -> ArtifactDetail:
105
+ """Read one artifact.
106
+
107
+ The artifact with its current content, its `version`, its options, for a `record` its schema, the approval state of its current version and its approval chain. The approval state is the one of the artifact list rows (`GET /api/v1/issues/{issueId}/artifacts`): `approved`, `steps_passed` out of `step_count`, and `approvers` with the counted approvals and rejects of the current version and the actors of the open step who still owe a decision (`pending`). `can_decide` says whether the calling agent may decide now with `POST /agent/artifacts/{artifactId}/approvals`. `download_url` is a signed file URL valid for one hour, null when the artifact holds no file. The chain lists each step with all its actors and, for an agent, its review sub-issue; an actor that can no longer decide has `left_out` true. An agent that needs the artifact reads it here, after `GET /agent/issues/{issueId}` named it in `needs`. A reviewer reads it here after `GET /agent/issues/{issueId}` on its review sub-issue named it in `reviews`: it owes a decision while it is in `approvers.pending` with that review sub-issue. The gate is the calling workflow's inclusion in the project of the artifact's issue: a project the workflow is not included in answers 404.
108
+
109
+ GET /agent/artifacts/{artifactId}
110
+
111
+ Args:
112
+ artifact_id: The UUID of the artifact to read
113
+ """
114
+ return await self._t.call(_OPS["show_agent_artifact"], path={'artifactId': artifact_id}, query={})
@@ -0,0 +1,99 @@
1
+ # Generated from the OpenAPI document. Do not edit.
2
+ from __future__ import annotations
3
+
4
+ from collections.abc import AsyncIterator
5
+ from pathlib import Path
6
+ from typing import Any, Literal
7
+
8
+ from ...runtime import BaseNamespace, FileBody, Op, SseEvent, Upload
9
+ from ...models import (
10
+ AgentListDocumentNotesResponse,
11
+ DocumentNote,
12
+ DocumentNoteEdited,
13
+ StoreDocumentNoteRequest,
14
+ UpdateDocumentNoteRequest,
15
+ )
16
+
17
+
18
+ _OPS: dict[str, Op] = {
19
+ "create_document_note": Op("create_document_note", "post", "/agent/documents/{documentId}/notes", 'json', "json", "agent", 'agent'),
20
+ "delete_document_note": Op("delete_document_note", "delete", "/agent/documents/{documentId}/notes/{noteId}", None, "none", "agent", 'agent'),
21
+ "dismiss_document_note": Op("dismiss_document_note", "post", "/agent/documents/{documentId}/notes/{noteId}/dismiss", None, "none", "agent", 'agent'),
22
+ "list_document_notes": Op("list_document_notes", "get", "/agent/documents/{documentId}/notes", None, "json", "agent", 'agent'),
23
+ "patch_document_note": Op("patch_document_note", "patch", "/agent/documents/{documentId}/notes/{noteId}", 'json', "json", "agent", 'agent'),
24
+ }
25
+
26
+
27
+ class AgentDocumentNotesNamespace(BaseNamespace):
28
+ """Notes attached to a filesystem document. A note can be created, edited, dismissed and deleted. Each route exists under /api/v1/ and under /agent/."""
29
+
30
+ _surface = "agent"
31
+ _group = "document_notes"
32
+
33
+ async def create_document_note(
34
+ self,
35
+ document_id: str,
36
+ body: StoreDocumentNoteRequest,
37
+ ) -> DocumentNote:
38
+ """Add a note to a document.
39
+
40
+ Adds a note to a document — the suggestion mechanism for an instance whose user may not manage the document's notes. The instance acts for its session user, who needs document.notes:create on the document's scope; a system platform role bypasses this check. A note does not change the document, so a locked document still accepts notes. The note always keeps the calling instance in instance_id. It also keeps a user in user_id whenever one can be attributed: an instance on a linked user session, or a user-owned scheduled subagent, acts for that user. A system subagent, or a company-owned scheduled subagent, acts for no user and leaves user_id empty. An instance that resolves to none of the three is rejected with 403. user_id and instance_id sent in the body are ignored. Returns 404 when the document does not exist, or when the calling instance cannot read it. The instance acts for its session user, who needs document.notes.own:manage on the document's scope; a system platform role bypasses this check.
41
+
42
+ POST /agent/documents/{documentId}/notes
43
+ """
44
+ return await self._t.call(_OPS["create_document_note"], path={'documentId': document_id}, query={}, body=body)
45
+
46
+ async def delete_document_note(
47
+ self,
48
+ document_id: str,
49
+ note_id: str,
50
+ ) -> None:
51
+ """Delete a note.
52
+
53
+ Deletes a note. Only the note author may delete it, with the same proxy match the edit route uses. This is a hard delete: the row does not exist afterwards. Returns 403 when the calling instance is not the author, and 404 when the document is not readable or the note does not exist on that document. The instance acts for its session user, who needs document.notes.own:manage on the document's scope; a system platform role bypasses this check.
54
+
55
+ DELETE /agent/documents/{documentId}/notes/{noteId}
56
+ """
57
+ await self._t.call(_OPS["delete_document_note"], path={'documentId': document_id, 'noteId': note_id}, query={})
58
+
59
+ async def dismiss_document_note(
60
+ self,
61
+ document_id: str,
62
+ note_id: str,
63
+ ) -> None:
64
+ """Dismiss a note.
65
+
66
+ Removes any note on a document, whoever wrote it. Only a bypass-role agent instance, or an instance acting for an admin or for a holder of document.notes:manage on the document's entity, may dismiss. Every other instance gets 403, including the note author when they do not hold that key. A dismiss is a hard delete, the same as the delete route. Returns 404 when the document is not readable, or when the note does not exist on that document. The instance acts for its session user, who needs document.notes:manage on the document's scope; a system platform role bypasses this check.
67
+
68
+ POST /agent/documents/{documentId}/notes/{noteId}/dismiss
69
+ """
70
+ await self._t.call(_OPS["dismiss_document_note"], path={'documentId': document_id, 'noteId': note_id}, query={})
71
+
72
+ async def list_document_notes(
73
+ self,
74
+ document_id: str,
75
+ *,
76
+ page: int | None = None,
77
+ per_page: int | None = None,
78
+ ) -> AgentListDocumentNotesResponse:
79
+ """List the notes on a document.
80
+
81
+ Returns the notes on a document, oldest first. Reading the notes follows reading the document: the instance acts for its session user, who needs document:view on the document's scope; a system platform role bypasses this check. A note is a plain comment: it does not change the document, and a locked document still shows and accepts notes. The author field is resolved from the note itself: a note with a user behind it returns that user, a note with no user behind it returns the acting subagent and its workflow. Returns 404 when the document does not exist, or when the calling instance cannot read it. The instance acts for its session user, who needs document.notes.own:manage on the document's scope; a system platform role bypasses this check.
82
+
83
+ GET /agent/documents/{documentId}/notes
84
+ """
85
+ return await self._t.call(_OPS["list_document_notes"], path={'documentId': document_id}, query={'page': page, 'per_page': per_page})
86
+
87
+ async def patch_document_note(
88
+ self,
89
+ document_id: str,
90
+ note_id: str,
91
+ body: UpdateDocumentNoteRequest,
92
+ ) -> DocumentNoteEdited:
93
+ """Edit a note.
94
+
95
+ Changes the body of a note. Only the note author may edit it. When the note has a user behind it, the check is a proxy match: any instance that acts for that same user may edit it, not only the exact instance that wrote it. When the note has no user behind it, only the exact instance that wrote it may edit it. Returns 403 when the calling instance is not the author — it can already read the note through the list route, so hiding it would be pointless. Returns 404 when the document is not readable, or when the note does not exist on that document. The instance acts for its session user, who needs document.notes.own:manage on the document's scope; a system platform role bypasses this check.
96
+
97
+ PATCH /agent/documents/{documentId}/notes/{noteId}
98
+ """
99
+ return await self._t.call(_OPS["patch_document_note"], path={'documentId': document_id, 'noteId': note_id}, query={}, body=body)