agentex-sdk 0.1.0a6__py3-none-any.whl
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.
- agentex/__init__.py +103 -0
- agentex/_base_client.py +1992 -0
- agentex/_client.py +506 -0
- agentex/_compat.py +219 -0
- agentex/_constants.py +14 -0
- agentex/_exceptions.py +108 -0
- agentex/_files.py +123 -0
- agentex/_models.py +829 -0
- agentex/_qs.py +150 -0
- agentex/_resource.py +43 -0
- agentex/_response.py +830 -0
- agentex/_streaming.py +333 -0
- agentex/_types.py +219 -0
- agentex/_utils/__init__.py +57 -0
- agentex/_utils/_logs.py +25 -0
- agentex/_utils/_proxy.py +65 -0
- agentex/_utils/_reflection.py +42 -0
- agentex/_utils/_resources_proxy.py +24 -0
- agentex/_utils/_streams.py +12 -0
- agentex/_utils/_sync.py +86 -0
- agentex/_utils/_transform.py +447 -0
- agentex/_utils/_typing.py +151 -0
- agentex/_utils/_utils.py +422 -0
- agentex/_version.py +4 -0
- agentex/lib/.keep +4 -0
- agentex/lib/__init__.py +0 -0
- agentex/lib/adk/__init__.py +41 -0
- agentex/lib/adk/_modules/__init__.py +0 -0
- agentex/lib/adk/_modules/acp.py +247 -0
- agentex/lib/adk/_modules/agent_task_tracker.py +176 -0
- agentex/lib/adk/_modules/agents.py +77 -0
- agentex/lib/adk/_modules/events.py +141 -0
- agentex/lib/adk/_modules/messages.py +285 -0
- agentex/lib/adk/_modules/state.py +291 -0
- agentex/lib/adk/_modules/streaming.py +75 -0
- agentex/lib/adk/_modules/tasks.py +124 -0
- agentex/lib/adk/_modules/tracing.py +194 -0
- agentex/lib/adk/providers/__init__.py +9 -0
- agentex/lib/adk/providers/_modules/__init__.py +0 -0
- agentex/lib/adk/providers/_modules/litellm.py +232 -0
- agentex/lib/adk/providers/_modules/openai.py +416 -0
- agentex/lib/adk/providers/_modules/sgp.py +85 -0
- agentex/lib/adk/utils/__init__.py +5 -0
- agentex/lib/adk/utils/_modules/__init__.py +0 -0
- agentex/lib/adk/utils/_modules/templating.py +94 -0
- agentex/lib/cli/__init__.py +0 -0
- agentex/lib/cli/commands/__init__.py +0 -0
- agentex/lib/cli/commands/agents.py +328 -0
- agentex/lib/cli/commands/init.py +227 -0
- agentex/lib/cli/commands/main.py +33 -0
- agentex/lib/cli/commands/secrets.py +169 -0
- agentex/lib/cli/commands/tasks.py +118 -0
- agentex/lib/cli/commands/uv.py +133 -0
- agentex/lib/cli/handlers/__init__.py +0 -0
- agentex/lib/cli/handlers/agent_handlers.py +160 -0
- agentex/lib/cli/handlers/cleanup_handlers.py +186 -0
- agentex/lib/cli/handlers/deploy_handlers.py +351 -0
- agentex/lib/cli/handlers/run_handlers.py +452 -0
- agentex/lib/cli/handlers/secret_handlers.py +670 -0
- agentex/lib/cli/templates/default/.dockerignore.j2 +43 -0
- agentex/lib/cli/templates/default/Dockerfile-uv.j2 +42 -0
- agentex/lib/cli/templates/default/Dockerfile.j2 +42 -0
- agentex/lib/cli/templates/default/README.md.j2 +193 -0
- agentex/lib/cli/templates/default/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/default/manifest.yaml.j2 +116 -0
- agentex/lib/cli/templates/default/project/acp.py.j2 +29 -0
- agentex/lib/cli/templates/default/pyproject.toml.j2 +33 -0
- agentex/lib/cli/templates/default/requirements.txt.j2 +5 -0
- agentex/lib/cli/templates/deploy/Screenshot 2025-03-19 at 10.36.57/342/200/257AM.png +0 -0
- agentex/lib/cli/templates/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/sync/.dockerignore.j2 +43 -0
- agentex/lib/cli/templates/sync/Dockerfile-uv.j2 +42 -0
- agentex/lib/cli/templates/sync/Dockerfile.j2 +42 -0
- agentex/lib/cli/templates/sync/README.md.j2 +293 -0
- agentex/lib/cli/templates/sync/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/sync/manifest.yaml.j2 +116 -0
- agentex/lib/cli/templates/sync/project/acp.py.j2 +26 -0
- agentex/lib/cli/templates/sync/pyproject.toml.j2 +33 -0
- agentex/lib/cli/templates/sync/requirements.txt.j2 +5 -0
- agentex/lib/cli/templates/temporal/.dockerignore.j2 +43 -0
- agentex/lib/cli/templates/temporal/Dockerfile-uv.j2 +48 -0
- agentex/lib/cli/templates/temporal/Dockerfile.j2 +48 -0
- agentex/lib/cli/templates/temporal/README.md.j2 +316 -0
- agentex/lib/cli/templates/temporal/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/temporal/manifest.yaml.j2 +137 -0
- agentex/lib/cli/templates/temporal/project/acp.py.j2 +30 -0
- agentex/lib/cli/templates/temporal/project/run_worker.py.j2 +33 -0
- agentex/lib/cli/templates/temporal/project/workflow.py.j2 +66 -0
- agentex/lib/cli/templates/temporal/pyproject.toml.j2 +34 -0
- agentex/lib/cli/templates/temporal/requirements.txt.j2 +5 -0
- agentex/lib/cli/utils/cli_utils.py +14 -0
- agentex/lib/cli/utils/credential_utils.py +103 -0
- agentex/lib/cli/utils/exceptions.py +6 -0
- agentex/lib/cli/utils/kubectl_utils.py +135 -0
- agentex/lib/cli/utils/kubernetes_secrets_utils.py +185 -0
- agentex/lib/core/__init__.py +0 -0
- agentex/lib/core/adapters/__init__.py +0 -0
- agentex/lib/core/adapters/llm/__init__.py +1 -0
- agentex/lib/core/adapters/llm/adapter_litellm.py +46 -0
- agentex/lib/core/adapters/llm/adapter_sgp.py +55 -0
- agentex/lib/core/adapters/llm/port.py +24 -0
- agentex/lib/core/adapters/streams/adapter_redis.py +128 -0
- agentex/lib/core/adapters/streams/port.py +50 -0
- agentex/lib/core/clients/__init__.py +1 -0
- agentex/lib/core/clients/temporal/__init__.py +0 -0
- agentex/lib/core/clients/temporal/temporal_client.py +181 -0
- agentex/lib/core/clients/temporal/types.py +47 -0
- agentex/lib/core/clients/temporal/utils.py +56 -0
- agentex/lib/core/services/__init__.py +0 -0
- agentex/lib/core/services/adk/__init__.py +0 -0
- agentex/lib/core/services/adk/acp/__init__.py +0 -0
- agentex/lib/core/services/adk/acp/acp.py +210 -0
- agentex/lib/core/services/adk/agent_task_tracker.py +85 -0
- agentex/lib/core/services/adk/agents.py +43 -0
- agentex/lib/core/services/adk/events.py +61 -0
- agentex/lib/core/services/adk/messages.py +164 -0
- agentex/lib/core/services/adk/providers/__init__.py +0 -0
- agentex/lib/core/services/adk/providers/litellm.py +256 -0
- agentex/lib/core/services/adk/providers/openai.py +723 -0
- agentex/lib/core/services/adk/providers/sgp.py +99 -0
- agentex/lib/core/services/adk/state.py +120 -0
- agentex/lib/core/services/adk/streaming.py +262 -0
- agentex/lib/core/services/adk/tasks.py +69 -0
- agentex/lib/core/services/adk/tracing.py +36 -0
- agentex/lib/core/services/adk/utils/__init__.py +0 -0
- agentex/lib/core/services/adk/utils/templating.py +58 -0
- agentex/lib/core/temporal/__init__.py +0 -0
- agentex/lib/core/temporal/activities/__init__.py +207 -0
- agentex/lib/core/temporal/activities/activity_helpers.py +37 -0
- agentex/lib/core/temporal/activities/adk/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/acp/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/acp/acp_activities.py +86 -0
- agentex/lib/core/temporal/activities/adk/agent_task_tracker_activities.py +76 -0
- agentex/lib/core/temporal/activities/adk/agents_activities.py +35 -0
- agentex/lib/core/temporal/activities/adk/events_activities.py +50 -0
- agentex/lib/core/temporal/activities/adk/messages_activities.py +94 -0
- agentex/lib/core/temporal/activities/adk/providers/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/providers/litellm_activities.py +71 -0
- agentex/lib/core/temporal/activities/adk/providers/openai_activities.py +210 -0
- agentex/lib/core/temporal/activities/adk/providers/sgp_activities.py +42 -0
- agentex/lib/core/temporal/activities/adk/state_activities.py +85 -0
- agentex/lib/core/temporal/activities/adk/streaming_activities.py +33 -0
- agentex/lib/core/temporal/activities/adk/tasks_activities.py +48 -0
- agentex/lib/core/temporal/activities/adk/tracing_activities.py +55 -0
- agentex/lib/core/temporal/activities/adk/utils/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/utils/templating_activities.py +41 -0
- agentex/lib/core/temporal/services/__init__.py +0 -0
- agentex/lib/core/temporal/services/temporal_task_service.py +69 -0
- agentex/lib/core/temporal/types/__init__.py +0 -0
- agentex/lib/core/temporal/types/workflow.py +5 -0
- agentex/lib/core/temporal/workers/__init__.py +0 -0
- agentex/lib/core/temporal/workers/worker.py +162 -0
- agentex/lib/core/temporal/workflows/workflow.py +26 -0
- agentex/lib/core/tracing/__init__.py +5 -0
- agentex/lib/core/tracing/processors/agentex_tracing_processor.py +117 -0
- agentex/lib/core/tracing/processors/sgp_tracing_processor.py +119 -0
- agentex/lib/core/tracing/processors/tracing_processor_interface.py +40 -0
- agentex/lib/core/tracing/trace.py +311 -0
- agentex/lib/core/tracing/tracer.py +70 -0
- agentex/lib/core/tracing/tracing_processor_manager.py +62 -0
- agentex/lib/environment_variables.py +87 -0
- agentex/lib/py.typed +0 -0
- agentex/lib/sdk/__init__.py +0 -0
- agentex/lib/sdk/config/__init__.py +0 -0
- agentex/lib/sdk/config/agent_config.py +61 -0
- agentex/lib/sdk/config/agent_manifest.py +219 -0
- agentex/lib/sdk/config/build_config.py +35 -0
- agentex/lib/sdk/config/deployment_config.py +117 -0
- agentex/lib/sdk/config/local_development_config.py +56 -0
- agentex/lib/sdk/config/project_config.py +103 -0
- agentex/lib/sdk/fastacp/__init__.py +3 -0
- agentex/lib/sdk/fastacp/base/base_acp_server.py +406 -0
- agentex/lib/sdk/fastacp/fastacp.py +74 -0
- agentex/lib/sdk/fastacp/impl/agentic_base_acp.py +72 -0
- agentex/lib/sdk/fastacp/impl/sync_acp.py +109 -0
- agentex/lib/sdk/fastacp/impl/temporal_acp.py +97 -0
- agentex/lib/sdk/fastacp/tests/README.md +297 -0
- agentex/lib/sdk/fastacp/tests/conftest.py +307 -0
- agentex/lib/sdk/fastacp/tests/pytest.ini +10 -0
- agentex/lib/sdk/fastacp/tests/run_tests.py +227 -0
- agentex/lib/sdk/fastacp/tests/test_base_acp_server.py +450 -0
- agentex/lib/sdk/fastacp/tests/test_fastacp_factory.py +344 -0
- agentex/lib/sdk/fastacp/tests/test_integration.py +477 -0
- agentex/lib/sdk/state_machine/__init__.py +6 -0
- agentex/lib/sdk/state_machine/noop_workflow.py +21 -0
- agentex/lib/sdk/state_machine/state.py +10 -0
- agentex/lib/sdk/state_machine/state_machine.py +189 -0
- agentex/lib/sdk/state_machine/state_workflow.py +16 -0
- agentex/lib/sdk/utils/__init__.py +0 -0
- agentex/lib/sdk/utils/messages.py +223 -0
- agentex/lib/types/__init__.py +0 -0
- agentex/lib/types/acp.py +94 -0
- agentex/lib/types/agent_configs.py +79 -0
- agentex/lib/types/agent_results.py +29 -0
- agentex/lib/types/credentials.py +34 -0
- agentex/lib/types/fastacp.py +61 -0
- agentex/lib/types/files.py +13 -0
- agentex/lib/types/json_rpc.py +49 -0
- agentex/lib/types/llm_messages.py +354 -0
- agentex/lib/types/task_message_updates.py +171 -0
- agentex/lib/types/tracing.py +34 -0
- agentex/lib/utils/__init__.py +0 -0
- agentex/lib/utils/completions.py +131 -0
- agentex/lib/utils/console.py +14 -0
- agentex/lib/utils/io.py +29 -0
- agentex/lib/utils/iterables.py +14 -0
- agentex/lib/utils/json_schema.py +23 -0
- agentex/lib/utils/logging.py +31 -0
- agentex/lib/utils/mcp.py +17 -0
- agentex/lib/utils/model_utils.py +46 -0
- agentex/lib/utils/parsing.py +15 -0
- agentex/lib/utils/regex.py +6 -0
- agentex/lib/utils/temporal.py +13 -0
- agentex/py.typed +0 -0
- agentex/resources/__init__.py +103 -0
- agentex/resources/agents.py +707 -0
- agentex/resources/events.py +294 -0
- agentex/resources/messages/__init__.py +33 -0
- agentex/resources/messages/batch.py +271 -0
- agentex/resources/messages/messages.py +492 -0
- agentex/resources/spans.py +557 -0
- agentex/resources/states.py +544 -0
- agentex/resources/tasks.py +615 -0
- agentex/resources/tracker.py +384 -0
- agentex/types/__init__.py +56 -0
- agentex/types/acp_type.py +7 -0
- agentex/types/agent.py +29 -0
- agentex/types/agent_list_params.py +13 -0
- agentex/types/agent_list_response.py +10 -0
- agentex/types/agent_rpc_by_name_params.py +21 -0
- agentex/types/agent_rpc_params.py +51 -0
- agentex/types/agent_rpc_params1.py +21 -0
- agentex/types/agent_rpc_response.py +20 -0
- agentex/types/agent_rpc_result.py +90 -0
- agentex/types/agent_task_tracker.py +34 -0
- agentex/types/data_content.py +30 -0
- agentex/types/data_content_param.py +31 -0
- agentex/types/data_delta.py +14 -0
- agentex/types/event.py +29 -0
- agentex/types/event_list_params.py +22 -0
- agentex/types/event_list_response.py +10 -0
- agentex/types/message_author.py +7 -0
- agentex/types/message_create_params.py +18 -0
- agentex/types/message_list_params.py +14 -0
- agentex/types/message_list_response.py +10 -0
- agentex/types/message_style.py +7 -0
- agentex/types/message_update_params.py +18 -0
- agentex/types/messages/__init__.py +8 -0
- agentex/types/messages/batch_create_params.py +16 -0
- agentex/types/messages/batch_create_response.py +10 -0
- agentex/types/messages/batch_update_params.py +16 -0
- agentex/types/messages/batch_update_response.py +10 -0
- agentex/types/shared/__init__.py +3 -0
- agentex/types/shared/task_message_update.py +83 -0
- agentex/types/span.py +36 -0
- agentex/types/span_create_params.py +40 -0
- agentex/types/span_list_params.py +12 -0
- agentex/types/span_list_response.py +10 -0
- agentex/types/span_update_params.py +37 -0
- agentex/types/state.py +25 -0
- agentex/types/state_create_params.py +16 -0
- agentex/types/state_list_params.py +16 -0
- agentex/types/state_list_response.py +10 -0
- agentex/types/state_update_params.py +16 -0
- agentex/types/task.py +23 -0
- agentex/types/task_delete_by_name_response.py +8 -0
- agentex/types/task_delete_response.py +8 -0
- agentex/types/task_list_response.py +10 -0
- agentex/types/task_message.py +33 -0
- agentex/types/task_message_content.py +16 -0
- agentex/types/task_message_content_param.py +17 -0
- agentex/types/task_message_delta.py +16 -0
- agentex/types/text_content.py +53 -0
- agentex/types/text_content_param.py +54 -0
- agentex/types/text_delta.py +14 -0
- agentex/types/tool_request_content.py +36 -0
- agentex/types/tool_request_content_param.py +37 -0
- agentex/types/tool_request_delta.py +18 -0
- agentex/types/tool_response_content.py +36 -0
- agentex/types/tool_response_content_param.py +36 -0
- agentex/types/tool_response_delta.py +18 -0
- agentex/types/tracker_list_params.py +16 -0
- agentex/types/tracker_list_response.py +10 -0
- agentex/types/tracker_update_params.py +19 -0
- agentex_sdk-0.1.0a6.dist-info/METADATA +426 -0
- agentex_sdk-0.1.0a6.dist-info/RECORD +289 -0
- agentex_sdk-0.1.0a6.dist-info/WHEEL +4 -0
- agentex_sdk-0.1.0a6.dist-info/entry_points.txt +2 -0
- agentex_sdk-0.1.0a6.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,557 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from typing import Dict, Union, Iterable, Optional
|
6
|
+
from datetime import datetime
|
7
|
+
|
8
|
+
import httpx
|
9
|
+
|
10
|
+
from ..types import span_list_params, span_create_params, span_update_params
|
11
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
12
|
+
from .._utils import maybe_transform, async_maybe_transform
|
13
|
+
from .._compat import cached_property
|
14
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
15
|
+
from .._response import (
|
16
|
+
to_raw_response_wrapper,
|
17
|
+
to_streamed_response_wrapper,
|
18
|
+
async_to_raw_response_wrapper,
|
19
|
+
async_to_streamed_response_wrapper,
|
20
|
+
)
|
21
|
+
from ..types.span import Span
|
22
|
+
from .._base_client import make_request_options
|
23
|
+
from ..types.span_list_response import SpanListResponse
|
24
|
+
|
25
|
+
__all__ = ["SpansResource", "AsyncSpansResource"]
|
26
|
+
|
27
|
+
|
28
|
+
class SpansResource(SyncAPIResource):
|
29
|
+
@cached_property
|
30
|
+
def with_raw_response(self) -> SpansResourceWithRawResponse:
|
31
|
+
"""
|
32
|
+
This property can be used as a prefix for any HTTP method call to return
|
33
|
+
the raw response object instead of the parsed content.
|
34
|
+
|
35
|
+
For more information, see https://www.github.com/scaleapi/agentex-python#accessing-raw-response-data-eg-headers
|
36
|
+
"""
|
37
|
+
return SpansResourceWithRawResponse(self)
|
38
|
+
|
39
|
+
@cached_property
|
40
|
+
def with_streaming_response(self) -> SpansResourceWithStreamingResponse:
|
41
|
+
"""
|
42
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
43
|
+
|
44
|
+
For more information, see https://www.github.com/scaleapi/agentex-python#with_streaming_response
|
45
|
+
"""
|
46
|
+
return SpansResourceWithStreamingResponse(self)
|
47
|
+
|
48
|
+
def create(
|
49
|
+
self,
|
50
|
+
*,
|
51
|
+
name: str,
|
52
|
+
start_time: Union[str, datetime],
|
53
|
+
trace_id: str,
|
54
|
+
id: Optional[str] | NotGiven = NOT_GIVEN,
|
55
|
+
data: Union[Dict[str, object], Iterable[Dict[str, object]], None] | NotGiven = NOT_GIVEN,
|
56
|
+
end_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
57
|
+
input: Union[Dict[str, object], Iterable[Dict[str, object]], None] | NotGiven = NOT_GIVEN,
|
58
|
+
output: Union[Dict[str, object], Iterable[Dict[str, object]], None] | NotGiven = NOT_GIVEN,
|
59
|
+
parent_id: Optional[str] | NotGiven = NOT_GIVEN,
|
60
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
61
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
62
|
+
extra_headers: Headers | None = None,
|
63
|
+
extra_query: Query | None = None,
|
64
|
+
extra_body: Body | None = None,
|
65
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
66
|
+
) -> Span:
|
67
|
+
"""
|
68
|
+
Create a new span with the provided parameters
|
69
|
+
|
70
|
+
Args:
|
71
|
+
name: Name that describes what operation this span represents
|
72
|
+
|
73
|
+
start_time: The time the span started
|
74
|
+
|
75
|
+
trace_id: Unique identifier for the trace this span belongs to
|
76
|
+
|
77
|
+
id: Unique identifier for the span. If not provided, an ID will be generated.
|
78
|
+
|
79
|
+
data: Any additional metadata or context for the span
|
80
|
+
|
81
|
+
end_time: The time the span ended
|
82
|
+
|
83
|
+
input: Input parameters or data for the operation
|
84
|
+
|
85
|
+
output: Output data resulting from the operation
|
86
|
+
|
87
|
+
parent_id: ID of the parent span if this is a child span in a trace
|
88
|
+
|
89
|
+
extra_headers: Send extra headers
|
90
|
+
|
91
|
+
extra_query: Add additional query parameters to the request
|
92
|
+
|
93
|
+
extra_body: Add additional JSON properties to the request
|
94
|
+
|
95
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
96
|
+
"""
|
97
|
+
return self._post(
|
98
|
+
"/spans",
|
99
|
+
body=maybe_transform(
|
100
|
+
{
|
101
|
+
"name": name,
|
102
|
+
"start_time": start_time,
|
103
|
+
"trace_id": trace_id,
|
104
|
+
"id": id,
|
105
|
+
"data": data,
|
106
|
+
"end_time": end_time,
|
107
|
+
"input": input,
|
108
|
+
"output": output,
|
109
|
+
"parent_id": parent_id,
|
110
|
+
},
|
111
|
+
span_create_params.SpanCreateParams,
|
112
|
+
),
|
113
|
+
options=make_request_options(
|
114
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
115
|
+
),
|
116
|
+
cast_to=Span,
|
117
|
+
)
|
118
|
+
|
119
|
+
def retrieve(
|
120
|
+
self,
|
121
|
+
span_id: str,
|
122
|
+
*,
|
123
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
124
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
125
|
+
extra_headers: Headers | None = None,
|
126
|
+
extra_query: Query | None = None,
|
127
|
+
extra_body: Body | None = None,
|
128
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
129
|
+
) -> Span:
|
130
|
+
"""
|
131
|
+
Get a span by ID
|
132
|
+
|
133
|
+
Args:
|
134
|
+
extra_headers: Send extra headers
|
135
|
+
|
136
|
+
extra_query: Add additional query parameters to the request
|
137
|
+
|
138
|
+
extra_body: Add additional JSON properties to the request
|
139
|
+
|
140
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
141
|
+
"""
|
142
|
+
if not span_id:
|
143
|
+
raise ValueError(f"Expected a non-empty value for `span_id` but received {span_id!r}")
|
144
|
+
return self._get(
|
145
|
+
f"/spans/{span_id}",
|
146
|
+
options=make_request_options(
|
147
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
148
|
+
),
|
149
|
+
cast_to=Span,
|
150
|
+
)
|
151
|
+
|
152
|
+
def update(
|
153
|
+
self,
|
154
|
+
span_id: str,
|
155
|
+
*,
|
156
|
+
data: Union[Dict[str, object], Iterable[Dict[str, object]], None] | NotGiven = NOT_GIVEN,
|
157
|
+
end_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
158
|
+
input: Union[Dict[str, object], Iterable[Dict[str, object]], None] | NotGiven = NOT_GIVEN,
|
159
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
160
|
+
output: Union[Dict[str, object], Iterable[Dict[str, object]], None] | NotGiven = NOT_GIVEN,
|
161
|
+
parent_id: Optional[str] | NotGiven = NOT_GIVEN,
|
162
|
+
start_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
163
|
+
trace_id: Optional[str] | NotGiven = NOT_GIVEN,
|
164
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
165
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
166
|
+
extra_headers: Headers | None = None,
|
167
|
+
extra_query: Query | None = None,
|
168
|
+
extra_body: Body | None = None,
|
169
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
170
|
+
) -> Span:
|
171
|
+
"""
|
172
|
+
Update a span with the provided output data and mark it as complete
|
173
|
+
|
174
|
+
Args:
|
175
|
+
data: Any additional metadata or context for the span
|
176
|
+
|
177
|
+
end_time: The time the span ended
|
178
|
+
|
179
|
+
input: Input parameters or data for the operation
|
180
|
+
|
181
|
+
name: Name that describes what operation this span represents
|
182
|
+
|
183
|
+
output: Output data resulting from the operation
|
184
|
+
|
185
|
+
parent_id: ID of the parent span if this is a child span in a trace
|
186
|
+
|
187
|
+
start_time: The time the span started
|
188
|
+
|
189
|
+
trace_id: Unique identifier for the trace this span belongs to
|
190
|
+
|
191
|
+
extra_headers: Send extra headers
|
192
|
+
|
193
|
+
extra_query: Add additional query parameters to the request
|
194
|
+
|
195
|
+
extra_body: Add additional JSON properties to the request
|
196
|
+
|
197
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
198
|
+
"""
|
199
|
+
if not span_id:
|
200
|
+
raise ValueError(f"Expected a non-empty value for `span_id` but received {span_id!r}")
|
201
|
+
return self._patch(
|
202
|
+
f"/spans/{span_id}",
|
203
|
+
body=maybe_transform(
|
204
|
+
{
|
205
|
+
"data": data,
|
206
|
+
"end_time": end_time,
|
207
|
+
"input": input,
|
208
|
+
"name": name,
|
209
|
+
"output": output,
|
210
|
+
"parent_id": parent_id,
|
211
|
+
"start_time": start_time,
|
212
|
+
"trace_id": trace_id,
|
213
|
+
},
|
214
|
+
span_update_params.SpanUpdateParams,
|
215
|
+
),
|
216
|
+
options=make_request_options(
|
217
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
218
|
+
),
|
219
|
+
cast_to=Span,
|
220
|
+
)
|
221
|
+
|
222
|
+
def list(
|
223
|
+
self,
|
224
|
+
*,
|
225
|
+
trace_id: Optional[str] | NotGiven = NOT_GIVEN,
|
226
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
227
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
228
|
+
extra_headers: Headers | None = None,
|
229
|
+
extra_query: Query | None = None,
|
230
|
+
extra_body: Body | None = None,
|
231
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
232
|
+
) -> SpanListResponse:
|
233
|
+
"""
|
234
|
+
List all spans for a given trace ID
|
235
|
+
|
236
|
+
Args:
|
237
|
+
extra_headers: Send extra headers
|
238
|
+
|
239
|
+
extra_query: Add additional query parameters to the request
|
240
|
+
|
241
|
+
extra_body: Add additional JSON properties to the request
|
242
|
+
|
243
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
244
|
+
"""
|
245
|
+
return self._get(
|
246
|
+
"/spans",
|
247
|
+
options=make_request_options(
|
248
|
+
extra_headers=extra_headers,
|
249
|
+
extra_query=extra_query,
|
250
|
+
extra_body=extra_body,
|
251
|
+
timeout=timeout,
|
252
|
+
query=maybe_transform({"trace_id": trace_id}, span_list_params.SpanListParams),
|
253
|
+
),
|
254
|
+
cast_to=SpanListResponse,
|
255
|
+
)
|
256
|
+
|
257
|
+
|
258
|
+
class AsyncSpansResource(AsyncAPIResource):
|
259
|
+
@cached_property
|
260
|
+
def with_raw_response(self) -> AsyncSpansResourceWithRawResponse:
|
261
|
+
"""
|
262
|
+
This property can be used as a prefix for any HTTP method call to return
|
263
|
+
the raw response object instead of the parsed content.
|
264
|
+
|
265
|
+
For more information, see https://www.github.com/scaleapi/agentex-python#accessing-raw-response-data-eg-headers
|
266
|
+
"""
|
267
|
+
return AsyncSpansResourceWithRawResponse(self)
|
268
|
+
|
269
|
+
@cached_property
|
270
|
+
def with_streaming_response(self) -> AsyncSpansResourceWithStreamingResponse:
|
271
|
+
"""
|
272
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
273
|
+
|
274
|
+
For more information, see https://www.github.com/scaleapi/agentex-python#with_streaming_response
|
275
|
+
"""
|
276
|
+
return AsyncSpansResourceWithStreamingResponse(self)
|
277
|
+
|
278
|
+
async def create(
|
279
|
+
self,
|
280
|
+
*,
|
281
|
+
name: str,
|
282
|
+
start_time: Union[str, datetime],
|
283
|
+
trace_id: str,
|
284
|
+
id: Optional[str] | NotGiven = NOT_GIVEN,
|
285
|
+
data: Union[Dict[str, object], Iterable[Dict[str, object]], None] | NotGiven = NOT_GIVEN,
|
286
|
+
end_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
287
|
+
input: Union[Dict[str, object], Iterable[Dict[str, object]], None] | NotGiven = NOT_GIVEN,
|
288
|
+
output: Union[Dict[str, object], Iterable[Dict[str, object]], None] | NotGiven = NOT_GIVEN,
|
289
|
+
parent_id: Optional[str] | NotGiven = NOT_GIVEN,
|
290
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
291
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
292
|
+
extra_headers: Headers | None = None,
|
293
|
+
extra_query: Query | None = None,
|
294
|
+
extra_body: Body | None = None,
|
295
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
296
|
+
) -> Span:
|
297
|
+
"""
|
298
|
+
Create a new span with the provided parameters
|
299
|
+
|
300
|
+
Args:
|
301
|
+
name: Name that describes what operation this span represents
|
302
|
+
|
303
|
+
start_time: The time the span started
|
304
|
+
|
305
|
+
trace_id: Unique identifier for the trace this span belongs to
|
306
|
+
|
307
|
+
id: Unique identifier for the span. If not provided, an ID will be generated.
|
308
|
+
|
309
|
+
data: Any additional metadata or context for the span
|
310
|
+
|
311
|
+
end_time: The time the span ended
|
312
|
+
|
313
|
+
input: Input parameters or data for the operation
|
314
|
+
|
315
|
+
output: Output data resulting from the operation
|
316
|
+
|
317
|
+
parent_id: ID of the parent span if this is a child span in a trace
|
318
|
+
|
319
|
+
extra_headers: Send extra headers
|
320
|
+
|
321
|
+
extra_query: Add additional query parameters to the request
|
322
|
+
|
323
|
+
extra_body: Add additional JSON properties to the request
|
324
|
+
|
325
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
326
|
+
"""
|
327
|
+
return await self._post(
|
328
|
+
"/spans",
|
329
|
+
body=await async_maybe_transform(
|
330
|
+
{
|
331
|
+
"name": name,
|
332
|
+
"start_time": start_time,
|
333
|
+
"trace_id": trace_id,
|
334
|
+
"id": id,
|
335
|
+
"data": data,
|
336
|
+
"end_time": end_time,
|
337
|
+
"input": input,
|
338
|
+
"output": output,
|
339
|
+
"parent_id": parent_id,
|
340
|
+
},
|
341
|
+
span_create_params.SpanCreateParams,
|
342
|
+
),
|
343
|
+
options=make_request_options(
|
344
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
345
|
+
),
|
346
|
+
cast_to=Span,
|
347
|
+
)
|
348
|
+
|
349
|
+
async def retrieve(
|
350
|
+
self,
|
351
|
+
span_id: str,
|
352
|
+
*,
|
353
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
354
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
355
|
+
extra_headers: Headers | None = None,
|
356
|
+
extra_query: Query | None = None,
|
357
|
+
extra_body: Body | None = None,
|
358
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
359
|
+
) -> Span:
|
360
|
+
"""
|
361
|
+
Get a span by ID
|
362
|
+
|
363
|
+
Args:
|
364
|
+
extra_headers: Send extra headers
|
365
|
+
|
366
|
+
extra_query: Add additional query parameters to the request
|
367
|
+
|
368
|
+
extra_body: Add additional JSON properties to the request
|
369
|
+
|
370
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
371
|
+
"""
|
372
|
+
if not span_id:
|
373
|
+
raise ValueError(f"Expected a non-empty value for `span_id` but received {span_id!r}")
|
374
|
+
return await self._get(
|
375
|
+
f"/spans/{span_id}",
|
376
|
+
options=make_request_options(
|
377
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
378
|
+
),
|
379
|
+
cast_to=Span,
|
380
|
+
)
|
381
|
+
|
382
|
+
async def update(
|
383
|
+
self,
|
384
|
+
span_id: str,
|
385
|
+
*,
|
386
|
+
data: Union[Dict[str, object], Iterable[Dict[str, object]], None] | NotGiven = NOT_GIVEN,
|
387
|
+
end_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
388
|
+
input: Union[Dict[str, object], Iterable[Dict[str, object]], None] | NotGiven = NOT_GIVEN,
|
389
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
390
|
+
output: Union[Dict[str, object], Iterable[Dict[str, object]], None] | NotGiven = NOT_GIVEN,
|
391
|
+
parent_id: Optional[str] | NotGiven = NOT_GIVEN,
|
392
|
+
start_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
393
|
+
trace_id: Optional[str] | NotGiven = NOT_GIVEN,
|
394
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
395
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
396
|
+
extra_headers: Headers | None = None,
|
397
|
+
extra_query: Query | None = None,
|
398
|
+
extra_body: Body | None = None,
|
399
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
400
|
+
) -> Span:
|
401
|
+
"""
|
402
|
+
Update a span with the provided output data and mark it as complete
|
403
|
+
|
404
|
+
Args:
|
405
|
+
data: Any additional metadata or context for the span
|
406
|
+
|
407
|
+
end_time: The time the span ended
|
408
|
+
|
409
|
+
input: Input parameters or data for the operation
|
410
|
+
|
411
|
+
name: Name that describes what operation this span represents
|
412
|
+
|
413
|
+
output: Output data resulting from the operation
|
414
|
+
|
415
|
+
parent_id: ID of the parent span if this is a child span in a trace
|
416
|
+
|
417
|
+
start_time: The time the span started
|
418
|
+
|
419
|
+
trace_id: Unique identifier for the trace this span belongs to
|
420
|
+
|
421
|
+
extra_headers: Send extra headers
|
422
|
+
|
423
|
+
extra_query: Add additional query parameters to the request
|
424
|
+
|
425
|
+
extra_body: Add additional JSON properties to the request
|
426
|
+
|
427
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
428
|
+
"""
|
429
|
+
if not span_id:
|
430
|
+
raise ValueError(f"Expected a non-empty value for `span_id` but received {span_id!r}")
|
431
|
+
return await self._patch(
|
432
|
+
f"/spans/{span_id}",
|
433
|
+
body=await async_maybe_transform(
|
434
|
+
{
|
435
|
+
"data": data,
|
436
|
+
"end_time": end_time,
|
437
|
+
"input": input,
|
438
|
+
"name": name,
|
439
|
+
"output": output,
|
440
|
+
"parent_id": parent_id,
|
441
|
+
"start_time": start_time,
|
442
|
+
"trace_id": trace_id,
|
443
|
+
},
|
444
|
+
span_update_params.SpanUpdateParams,
|
445
|
+
),
|
446
|
+
options=make_request_options(
|
447
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
448
|
+
),
|
449
|
+
cast_to=Span,
|
450
|
+
)
|
451
|
+
|
452
|
+
async def list(
|
453
|
+
self,
|
454
|
+
*,
|
455
|
+
trace_id: Optional[str] | NotGiven = NOT_GIVEN,
|
456
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
457
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
458
|
+
extra_headers: Headers | None = None,
|
459
|
+
extra_query: Query | None = None,
|
460
|
+
extra_body: Body | None = None,
|
461
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
462
|
+
) -> SpanListResponse:
|
463
|
+
"""
|
464
|
+
List all spans for a given trace ID
|
465
|
+
|
466
|
+
Args:
|
467
|
+
extra_headers: Send extra headers
|
468
|
+
|
469
|
+
extra_query: Add additional query parameters to the request
|
470
|
+
|
471
|
+
extra_body: Add additional JSON properties to the request
|
472
|
+
|
473
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
474
|
+
"""
|
475
|
+
return await self._get(
|
476
|
+
"/spans",
|
477
|
+
options=make_request_options(
|
478
|
+
extra_headers=extra_headers,
|
479
|
+
extra_query=extra_query,
|
480
|
+
extra_body=extra_body,
|
481
|
+
timeout=timeout,
|
482
|
+
query=await async_maybe_transform({"trace_id": trace_id}, span_list_params.SpanListParams),
|
483
|
+
),
|
484
|
+
cast_to=SpanListResponse,
|
485
|
+
)
|
486
|
+
|
487
|
+
|
488
|
+
class SpansResourceWithRawResponse:
|
489
|
+
def __init__(self, spans: SpansResource) -> None:
|
490
|
+
self._spans = spans
|
491
|
+
|
492
|
+
self.create = to_raw_response_wrapper(
|
493
|
+
spans.create,
|
494
|
+
)
|
495
|
+
self.retrieve = to_raw_response_wrapper(
|
496
|
+
spans.retrieve,
|
497
|
+
)
|
498
|
+
self.update = to_raw_response_wrapper(
|
499
|
+
spans.update,
|
500
|
+
)
|
501
|
+
self.list = to_raw_response_wrapper(
|
502
|
+
spans.list,
|
503
|
+
)
|
504
|
+
|
505
|
+
|
506
|
+
class AsyncSpansResourceWithRawResponse:
|
507
|
+
def __init__(self, spans: AsyncSpansResource) -> None:
|
508
|
+
self._spans = spans
|
509
|
+
|
510
|
+
self.create = async_to_raw_response_wrapper(
|
511
|
+
spans.create,
|
512
|
+
)
|
513
|
+
self.retrieve = async_to_raw_response_wrapper(
|
514
|
+
spans.retrieve,
|
515
|
+
)
|
516
|
+
self.update = async_to_raw_response_wrapper(
|
517
|
+
spans.update,
|
518
|
+
)
|
519
|
+
self.list = async_to_raw_response_wrapper(
|
520
|
+
spans.list,
|
521
|
+
)
|
522
|
+
|
523
|
+
|
524
|
+
class SpansResourceWithStreamingResponse:
|
525
|
+
def __init__(self, spans: SpansResource) -> None:
|
526
|
+
self._spans = spans
|
527
|
+
|
528
|
+
self.create = to_streamed_response_wrapper(
|
529
|
+
spans.create,
|
530
|
+
)
|
531
|
+
self.retrieve = to_streamed_response_wrapper(
|
532
|
+
spans.retrieve,
|
533
|
+
)
|
534
|
+
self.update = to_streamed_response_wrapper(
|
535
|
+
spans.update,
|
536
|
+
)
|
537
|
+
self.list = to_streamed_response_wrapper(
|
538
|
+
spans.list,
|
539
|
+
)
|
540
|
+
|
541
|
+
|
542
|
+
class AsyncSpansResourceWithStreamingResponse:
|
543
|
+
def __init__(self, spans: AsyncSpansResource) -> None:
|
544
|
+
self._spans = spans
|
545
|
+
|
546
|
+
self.create = async_to_streamed_response_wrapper(
|
547
|
+
spans.create,
|
548
|
+
)
|
549
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
550
|
+
spans.retrieve,
|
551
|
+
)
|
552
|
+
self.update = async_to_streamed_response_wrapper(
|
553
|
+
spans.update,
|
554
|
+
)
|
555
|
+
self.list = async_to_streamed_response_wrapper(
|
556
|
+
spans.list,
|
557
|
+
)
|