darwin-sdk 0.1.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.
- darwin_sdk-0.1.0/LICENSE +21 -0
- darwin_sdk-0.1.0/PKG-INFO +49 -0
- darwin_sdk-0.1.0/README.md +21 -0
- darwin_sdk-0.1.0/pyproject.toml +43 -0
- darwin_sdk-0.1.0/setup.cfg +4 -0
- darwin_sdk-0.1.0/src/darwin_sdk/__init__.py +96 -0
- darwin_sdk-0.1.0/src/darwin_sdk/_default_clients.py +30 -0
- darwin_sdk-0.1.0/src/darwin_sdk/agent/__init__.py +3 -0
- darwin_sdk-0.1.0/src/darwin_sdk/agent/client.py +212 -0
- darwin_sdk-0.1.0/src/darwin_sdk/agent/raw_client.py +379 -0
- darwin_sdk-0.1.0/src/darwin_sdk/approvals/__init__.py +37 -0
- darwin_sdk-0.1.0/src/darwin_sdk/approvals/client.py +200 -0
- darwin_sdk-0.1.0/src/darwin_sdk/approvals/raw_client.py +364 -0
- darwin_sdk-0.1.0/src/darwin_sdk/approvals/types/__init__.py +38 -0
- darwin_sdk-0.1.0/src/darwin_sdk/approvals/types/approval_decision_request_decision.py +5 -0
- darwin_sdk-0.1.0/src/darwin_sdk/approvals/types/list_approvals_response.py +20 -0
- darwin_sdk-0.1.0/src/darwin_sdk/client.py +309 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/__init__.py +127 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/api_error.py +23 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/client_wrapper.py +144 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/datetime_utils.py +70 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/file.py +67 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/force_multipart.py +18 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/http_client.py +885 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/http_response.py +59 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/http_sse/__init__.py +42 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/http_sse/_api.py +455 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/http_sse/_decoders.py +74 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/http_sse/_exceptions.py +7 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/http_sse/_models.py +17 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/jsonable_encoder.py +120 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/logging.py +107 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/parse_error.py +36 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/pydantic_utilities.py +508 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/query_encoder.py +58 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/remove_none_from_dict.py +11 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/request_options.py +40 -0
- darwin_sdk-0.1.0/src/darwin_sdk/core/serialization.py +347 -0
- darwin_sdk-0.1.0/src/darwin_sdk/environment.py +7 -0
- darwin_sdk-0.1.0/src/darwin_sdk/errors/__init__.py +42 -0
- darwin_sdk-0.1.0/src/darwin_sdk/errors/bad_request_error.py +11 -0
- darwin_sdk-0.1.0/src/darwin_sdk/errors/forbidden_error.py +11 -0
- darwin_sdk-0.1.0/src/darwin_sdk/errors/not_found_error.py +11 -0
- darwin_sdk-0.1.0/src/darwin_sdk/errors/unauthorized_error.py +11 -0
- darwin_sdk-0.1.0/src/darwin_sdk/goals/__init__.py +34 -0
- darwin_sdk-0.1.0/src/darwin_sdk/goals/client.py +264 -0
- darwin_sdk-0.1.0/src/darwin_sdk/goals/raw_client.py +531 -0
- darwin_sdk-0.1.0/src/darwin_sdk/goals/types/__init__.py +38 -0
- darwin_sdk-0.1.0/src/darwin_sdk/goals/types/create_goal_request_kind.py +5 -0
- darwin_sdk-0.1.0/src/darwin_sdk/goals/types/list_goals_response.py +20 -0
- darwin_sdk-0.1.0/src/darwin_sdk/integrations/__init__.py +3 -0
- darwin_sdk-0.1.0/src/darwin_sdk/integrations/client.py +99 -0
- darwin_sdk-0.1.0/src/darwin_sdk/integrations/raw_client.py +168 -0
- darwin_sdk-0.1.0/src/darwin_sdk/py.typed +0 -0
- darwin_sdk-0.1.0/src/darwin_sdk/tools/__init__.py +34 -0
- darwin_sdk-0.1.0/src/darwin_sdk/tools/client.py +188 -0
- darwin_sdk-0.1.0/src/darwin_sdk/tools/raw_client.py +352 -0
- darwin_sdk-0.1.0/src/darwin_sdk/tools/types/__init__.py +34 -0
- darwin_sdk-0.1.0/src/darwin_sdk/tools/types/list_tools_response.py +20 -0
- darwin_sdk-0.1.0/src/darwin_sdk/types/__init__.py +48 -0
- darwin_sdk-0.1.0/src/darwin_sdk/types/approval.py +5 -0
- darwin_sdk-0.1.0/src/darwin_sdk/types/error.py +26 -0
- darwin_sdk-0.1.0/src/darwin_sdk/types/error_message.py +5 -0
- darwin_sdk-0.1.0/src/darwin_sdk/types/execute_tool_response.py +23 -0
- darwin_sdk-0.1.0/src/darwin_sdk/types/goal.py +5 -0
- darwin_sdk-0.1.0/src/darwin_sdk/types/tool.py +29 -0
- darwin_sdk-0.1.0/src/darwin_sdk/types/tool_risk.py +5 -0
- darwin_sdk-0.1.0/src/darwin_sdk.egg-info/PKG-INFO +49 -0
- darwin_sdk-0.1.0/src/darwin_sdk.egg-info/SOURCES.txt +70 -0
- darwin_sdk-0.1.0/src/darwin_sdk.egg-info/dependency_links.txt +1 -0
- darwin_sdk-0.1.0/src/darwin_sdk.egg-info/requires.txt +4 -0
- darwin_sdk-0.1.0/src/darwin_sdk.egg-info/top_level.txt +1 -0
darwin_sdk-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Darwin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: darwin-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official Python SDK for Darwin
|
|
5
|
+
Author: Darwin
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Documentation, https://docs.darwin.so/sdks/python
|
|
8
|
+
Project-URL: Issues, https://github.com/darwin-studios/darwin/issues
|
|
9
|
+
Project-URL: Repository, https://github.com/darwin-studios/darwin-python
|
|
10
|
+
Keywords: darwin,agent,sdk
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: anyio>=3.0.0
|
|
24
|
+
Requires-Dist: httpx>=0.23.0
|
|
25
|
+
Requires-Dist: pydantic<3,>=1.9.2
|
|
26
|
+
Requires-Dist: typing-extensions>=4.0.0
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# Darwin Python SDK
|
|
30
|
+
|
|
31
|
+
The official Python client for the Darwin API. Fern generates the client from Darwin's reviewed
|
|
32
|
+
public OpenAPI contract.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install darwin-sdk
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
import os
|
|
40
|
+
|
|
41
|
+
from darwin_sdk import Darwin
|
|
42
|
+
|
|
43
|
+
darwin = Darwin(token=os.environ["DARWIN_API_KEY"])
|
|
44
|
+
turn = darwin.agent.create_message(
|
|
45
|
+
content="Help me plan a product launch.",
|
|
46
|
+
)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
See [docs.darwin.so](https://docs.darwin.so/sdks/python) for authentication and API guides.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Darwin Python SDK
|
|
2
|
+
|
|
3
|
+
The official Python client for the Darwin API. Fern generates the client from Darwin's reviewed
|
|
4
|
+
public OpenAPI contract.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pip install darwin-sdk
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```python
|
|
11
|
+
import os
|
|
12
|
+
|
|
13
|
+
from darwin_sdk import Darwin
|
|
14
|
+
|
|
15
|
+
darwin = Darwin(token=os.environ["DARWIN_API_KEY"])
|
|
16
|
+
turn = darwin.agent.create_message(
|
|
17
|
+
content="Help me plan a product launch.",
|
|
18
|
+
)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
See [docs.darwin.so](https://docs.darwin.so/sdks/python) for authentication and API guides.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0.3"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "darwin-sdk"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Official Python SDK for Darwin"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "Darwin" }]
|
|
13
|
+
keywords = ["darwin", "agent", "sdk"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Typing :: Typed",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"anyio>=3.0.0",
|
|
27
|
+
"httpx>=0.23.0",
|
|
28
|
+
"pydantic>=1.9.2,<3",
|
|
29
|
+
"typing-extensions>=4.0.0",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Documentation = "https://docs.darwin.so/sdks/python"
|
|
34
|
+
Issues = "https://github.com/darwin-studios/darwin/issues"
|
|
35
|
+
Repository = "https://github.com/darwin-studios/darwin-python"
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.packages.find]
|
|
38
|
+
where = ["src"]
|
|
39
|
+
include = ["darwin_sdk*"]
|
|
40
|
+
exclude = ["darwin_sdk.tests*"]
|
|
41
|
+
|
|
42
|
+
[tool.setuptools.package-data]
|
|
43
|
+
darwin_sdk = ["py.typed"]
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .types import Approval, Error, ErrorMessage, ExecuteToolResponse, Goal, Tool, ToolRisk
|
|
10
|
+
from .errors import BadRequestError, ForbiddenError, NotFoundError, UnauthorizedError
|
|
11
|
+
from . import agent, approvals, goals, integrations, tools
|
|
12
|
+
from ._default_clients import DefaultAioHttpClient, DefaultAsyncHttpxClient
|
|
13
|
+
from .approvals import ApprovalDecisionRequestDecision, ListApprovalsResponse
|
|
14
|
+
from .client import AsyncDarwin, Darwin
|
|
15
|
+
from .environment import DarwinEnvironment
|
|
16
|
+
from .goals import CreateGoalRequestKind, ListGoalsResponse
|
|
17
|
+
from .tools import ListToolsResponse
|
|
18
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
19
|
+
"Approval": ".types",
|
|
20
|
+
"ApprovalDecisionRequestDecision": ".approvals",
|
|
21
|
+
"AsyncDarwin": ".client",
|
|
22
|
+
"BadRequestError": ".errors",
|
|
23
|
+
"CreateGoalRequestKind": ".goals",
|
|
24
|
+
"Darwin": ".client",
|
|
25
|
+
"DarwinEnvironment": ".environment",
|
|
26
|
+
"DefaultAioHttpClient": "._default_clients",
|
|
27
|
+
"DefaultAsyncHttpxClient": "._default_clients",
|
|
28
|
+
"Error": ".types",
|
|
29
|
+
"ErrorMessage": ".types",
|
|
30
|
+
"ExecuteToolResponse": ".types",
|
|
31
|
+
"ForbiddenError": ".errors",
|
|
32
|
+
"Goal": ".types",
|
|
33
|
+
"ListApprovalsResponse": ".approvals",
|
|
34
|
+
"ListGoalsResponse": ".goals",
|
|
35
|
+
"ListToolsResponse": ".tools",
|
|
36
|
+
"NotFoundError": ".errors",
|
|
37
|
+
"Tool": ".types",
|
|
38
|
+
"ToolRisk": ".types",
|
|
39
|
+
"UnauthorizedError": ".errors",
|
|
40
|
+
"agent": ".agent",
|
|
41
|
+
"approvals": ".approvals",
|
|
42
|
+
"goals": ".goals",
|
|
43
|
+
"integrations": ".integrations",
|
|
44
|
+
"tools": ".tools",
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
49
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
50
|
+
if module_name is None:
|
|
51
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
52
|
+
try:
|
|
53
|
+
module = import_module(module_name, __package__)
|
|
54
|
+
if module_name == f".{attr_name}":
|
|
55
|
+
return module
|
|
56
|
+
else:
|
|
57
|
+
return getattr(module, attr_name)
|
|
58
|
+
except ImportError as e:
|
|
59
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
60
|
+
except AttributeError as e:
|
|
61
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def __dir__():
|
|
65
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
66
|
+
return sorted(lazy_attrs)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
__all__ = [
|
|
70
|
+
"Approval",
|
|
71
|
+
"ApprovalDecisionRequestDecision",
|
|
72
|
+
"AsyncDarwin",
|
|
73
|
+
"BadRequestError",
|
|
74
|
+
"CreateGoalRequestKind",
|
|
75
|
+
"Darwin",
|
|
76
|
+
"DarwinEnvironment",
|
|
77
|
+
"DefaultAioHttpClient",
|
|
78
|
+
"DefaultAsyncHttpxClient",
|
|
79
|
+
"Error",
|
|
80
|
+
"ErrorMessage",
|
|
81
|
+
"ExecuteToolResponse",
|
|
82
|
+
"ForbiddenError",
|
|
83
|
+
"Goal",
|
|
84
|
+
"ListApprovalsResponse",
|
|
85
|
+
"ListGoalsResponse",
|
|
86
|
+
"ListToolsResponse",
|
|
87
|
+
"NotFoundError",
|
|
88
|
+
"Tool",
|
|
89
|
+
"ToolRisk",
|
|
90
|
+
"UnauthorizedError",
|
|
91
|
+
"agent",
|
|
92
|
+
"approvals",
|
|
93
|
+
"goals",
|
|
94
|
+
"integrations",
|
|
95
|
+
"tools",
|
|
96
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
SDK_DEFAULT_TIMEOUT = 60
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
import httpx_aiohttp # type: ignore[import-not-found]
|
|
11
|
+
except ImportError:
|
|
12
|
+
|
|
13
|
+
class DefaultAioHttpClient(httpx.AsyncClient): # type: ignore
|
|
14
|
+
def __init__(self, **kwargs: typing.Any) -> None:
|
|
15
|
+
raise RuntimeError("To use the aiohttp client, install the aiohttp extra: pip install darwin_sdk[aiohttp]")
|
|
16
|
+
|
|
17
|
+
else:
|
|
18
|
+
|
|
19
|
+
class DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
|
|
20
|
+
def __init__(self, **kwargs: typing.Any) -> None:
|
|
21
|
+
kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
|
|
22
|
+
kwargs.setdefault("follow_redirects", True)
|
|
23
|
+
super().__init__(**kwargs)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class DefaultAsyncHttpxClient(httpx.AsyncClient):
|
|
27
|
+
def __init__(self, **kwargs: typing.Any) -> None:
|
|
28
|
+
kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
|
|
29
|
+
kwargs.setdefault("follow_redirects", True)
|
|
30
|
+
super().__init__(**kwargs)
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
+
from ..core.request_options import RequestOptions
|
|
7
|
+
from .raw_client import AsyncRawAgentClient, RawAgentClient
|
|
8
|
+
|
|
9
|
+
# this is used as the default value for optional parameters
|
|
10
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class AgentClient:
|
|
14
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
15
|
+
self._raw_client = RawAgentClient(client_wrapper=client_wrapper)
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def with_raw_response(self) -> RawAgentClient:
|
|
19
|
+
"""
|
|
20
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
21
|
+
|
|
22
|
+
Returns
|
|
23
|
+
-------
|
|
24
|
+
RawAgentClient
|
|
25
|
+
"""
|
|
26
|
+
return self._raw_client
|
|
27
|
+
|
|
28
|
+
def get_conversation(
|
|
29
|
+
self,
|
|
30
|
+
*,
|
|
31
|
+
limit: typing.Optional[int] = None,
|
|
32
|
+
cursor: typing.Optional[str] = None,
|
|
33
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
34
|
+
) -> typing.Dict[str, typing.Any]:
|
|
35
|
+
"""
|
|
36
|
+
Returns the conversation for the agent currently selected on the developer/MCP channel. Natural-language routing in createMessage updates this selection.
|
|
37
|
+
|
|
38
|
+
Parameters
|
|
39
|
+
----------
|
|
40
|
+
limit : typing.Optional[int]
|
|
41
|
+
|
|
42
|
+
cursor : typing.Optional[str]
|
|
43
|
+
|
|
44
|
+
request_options : typing.Optional[RequestOptions]
|
|
45
|
+
Request-specific configuration.
|
|
46
|
+
|
|
47
|
+
Returns
|
|
48
|
+
-------
|
|
49
|
+
typing.Dict[str, typing.Any]
|
|
50
|
+
The conversation page.
|
|
51
|
+
|
|
52
|
+
Examples
|
|
53
|
+
--------
|
|
54
|
+
from darwin_sdk import Darwin
|
|
55
|
+
|
|
56
|
+
client = Darwin(
|
|
57
|
+
token="YOUR_TOKEN",
|
|
58
|
+
)
|
|
59
|
+
client.agent.get_conversation()
|
|
60
|
+
"""
|
|
61
|
+
_response = self._raw_client.get_conversation(limit=limit, cursor=cursor, request_options=request_options)
|
|
62
|
+
return _response.data
|
|
63
|
+
|
|
64
|
+
def create_message(
|
|
65
|
+
self,
|
|
66
|
+
*,
|
|
67
|
+
content: str,
|
|
68
|
+
request_id: typing.Optional[str] = OMIT,
|
|
69
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
70
|
+
) -> typing.Dict[str, typing.Any]:
|
|
71
|
+
"""
|
|
72
|
+
Darwin infers the intended accessible personal or business agent from the message and current conversation. Name an agent naturally when changing context; ambiguous requests return a clarification without running tools.
|
|
73
|
+
|
|
74
|
+
Parameters
|
|
75
|
+
----------
|
|
76
|
+
content : str
|
|
77
|
+
|
|
78
|
+
request_id : typing.Optional[str]
|
|
79
|
+
An optional caller-generated idempotency and correlation identifier.
|
|
80
|
+
|
|
81
|
+
request_options : typing.Optional[RequestOptions]
|
|
82
|
+
Request-specific configuration.
|
|
83
|
+
|
|
84
|
+
Returns
|
|
85
|
+
-------
|
|
86
|
+
typing.Dict[str, typing.Any]
|
|
87
|
+
The completed agent turn.
|
|
88
|
+
|
|
89
|
+
Examples
|
|
90
|
+
--------
|
|
91
|
+
from darwin_sdk import Darwin
|
|
92
|
+
|
|
93
|
+
client = Darwin(
|
|
94
|
+
token="YOUR_TOKEN",
|
|
95
|
+
)
|
|
96
|
+
client.agent.create_message(
|
|
97
|
+
content="content",
|
|
98
|
+
)
|
|
99
|
+
"""
|
|
100
|
+
_response = self._raw_client.create_message(
|
|
101
|
+
content=content, request_id=request_id, request_options=request_options
|
|
102
|
+
)
|
|
103
|
+
return _response.data
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class AsyncAgentClient:
|
|
107
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
108
|
+
self._raw_client = AsyncRawAgentClient(client_wrapper=client_wrapper)
|
|
109
|
+
|
|
110
|
+
@property
|
|
111
|
+
def with_raw_response(self) -> AsyncRawAgentClient:
|
|
112
|
+
"""
|
|
113
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
114
|
+
|
|
115
|
+
Returns
|
|
116
|
+
-------
|
|
117
|
+
AsyncRawAgentClient
|
|
118
|
+
"""
|
|
119
|
+
return self._raw_client
|
|
120
|
+
|
|
121
|
+
async def get_conversation(
|
|
122
|
+
self,
|
|
123
|
+
*,
|
|
124
|
+
limit: typing.Optional[int] = None,
|
|
125
|
+
cursor: typing.Optional[str] = None,
|
|
126
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
127
|
+
) -> typing.Dict[str, typing.Any]:
|
|
128
|
+
"""
|
|
129
|
+
Returns the conversation for the agent currently selected on the developer/MCP channel. Natural-language routing in createMessage updates this selection.
|
|
130
|
+
|
|
131
|
+
Parameters
|
|
132
|
+
----------
|
|
133
|
+
limit : typing.Optional[int]
|
|
134
|
+
|
|
135
|
+
cursor : typing.Optional[str]
|
|
136
|
+
|
|
137
|
+
request_options : typing.Optional[RequestOptions]
|
|
138
|
+
Request-specific configuration.
|
|
139
|
+
|
|
140
|
+
Returns
|
|
141
|
+
-------
|
|
142
|
+
typing.Dict[str, typing.Any]
|
|
143
|
+
The conversation page.
|
|
144
|
+
|
|
145
|
+
Examples
|
|
146
|
+
--------
|
|
147
|
+
import asyncio
|
|
148
|
+
|
|
149
|
+
from darwin_sdk import AsyncDarwin
|
|
150
|
+
|
|
151
|
+
client = AsyncDarwin(
|
|
152
|
+
token="YOUR_TOKEN",
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
async def main() -> None:
|
|
157
|
+
await client.agent.get_conversation()
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
asyncio.run(main())
|
|
161
|
+
"""
|
|
162
|
+
_response = await self._raw_client.get_conversation(limit=limit, cursor=cursor, request_options=request_options)
|
|
163
|
+
return _response.data
|
|
164
|
+
|
|
165
|
+
async def create_message(
|
|
166
|
+
self,
|
|
167
|
+
*,
|
|
168
|
+
content: str,
|
|
169
|
+
request_id: typing.Optional[str] = OMIT,
|
|
170
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
171
|
+
) -> typing.Dict[str, typing.Any]:
|
|
172
|
+
"""
|
|
173
|
+
Darwin infers the intended accessible personal or business agent from the message and current conversation. Name an agent naturally when changing context; ambiguous requests return a clarification without running tools.
|
|
174
|
+
|
|
175
|
+
Parameters
|
|
176
|
+
----------
|
|
177
|
+
content : str
|
|
178
|
+
|
|
179
|
+
request_id : typing.Optional[str]
|
|
180
|
+
An optional caller-generated idempotency and correlation identifier.
|
|
181
|
+
|
|
182
|
+
request_options : typing.Optional[RequestOptions]
|
|
183
|
+
Request-specific configuration.
|
|
184
|
+
|
|
185
|
+
Returns
|
|
186
|
+
-------
|
|
187
|
+
typing.Dict[str, typing.Any]
|
|
188
|
+
The completed agent turn.
|
|
189
|
+
|
|
190
|
+
Examples
|
|
191
|
+
--------
|
|
192
|
+
import asyncio
|
|
193
|
+
|
|
194
|
+
from darwin_sdk import AsyncDarwin
|
|
195
|
+
|
|
196
|
+
client = AsyncDarwin(
|
|
197
|
+
token="YOUR_TOKEN",
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
async def main() -> None:
|
|
202
|
+
await client.agent.create_message(
|
|
203
|
+
content="content",
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
asyncio.run(main())
|
|
208
|
+
"""
|
|
209
|
+
_response = await self._raw_client.create_message(
|
|
210
|
+
content=content, request_id=request_id, request_options=request_options
|
|
211
|
+
)
|
|
212
|
+
return _response.data
|