agent-ops-otel-sdk 0.1.0__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.
- agent_ops/__init__.py +54 -0
- agent_ops/_version.py +1 -0
- agent_ops/attributes.py +97 -0
- agent_ops/content.py +75 -0
- agent_ops/generated.py +168 -0
- agent_ops/py.typed +1 -0
- agent_ops/runtime.py +120 -0
- agent_ops/tracing.py +446 -0
- agent_ops_otel_sdk-0.1.0.dist-info/METADATA +109 -0
- agent_ops_otel_sdk-0.1.0.dist-info/RECORD +13 -0
- agent_ops_otel_sdk-0.1.0.dist-info/WHEEL +5 -0
- agent_ops_otel_sdk-0.1.0.dist-info/licenses/LICENSE +201 -0
- agent_ops_otel_sdk-0.1.0.dist-info/top_level.txt +1 -0
agent_ops/__init__.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from ._version import __version__
|
|
2
|
+
from .generated import Attr, Environment, RunStatus, SpanType, TaskType
|
|
3
|
+
from .runtime import (
|
|
4
|
+
TracingConfig,
|
|
5
|
+
configure_tracing,
|
|
6
|
+
get_tracer,
|
|
7
|
+
shutdown_tracing,
|
|
8
|
+
)
|
|
9
|
+
from .tracing import (
|
|
10
|
+
AgentRunHandle,
|
|
11
|
+
LlmCallHandle,
|
|
12
|
+
ToolCallHandle,
|
|
13
|
+
agent_run,
|
|
14
|
+
async_agent_run,
|
|
15
|
+
async_llm_call,
|
|
16
|
+
async_retrieval,
|
|
17
|
+
async_sub_agent,
|
|
18
|
+
async_tool_call,
|
|
19
|
+
current_span_id,
|
|
20
|
+
current_trace_id,
|
|
21
|
+
llm_call,
|
|
22
|
+
retrieval,
|
|
23
|
+
sub_agent,
|
|
24
|
+
tool_call,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
__all__ = [
|
|
28
|
+
"AgentRunHandle",
|
|
29
|
+
"Attr",
|
|
30
|
+
"Environment",
|
|
31
|
+
"LlmCallHandle",
|
|
32
|
+
"RunStatus",
|
|
33
|
+
"SpanType",
|
|
34
|
+
"TaskType",
|
|
35
|
+
"ToolCallHandle",
|
|
36
|
+
"TracingConfig",
|
|
37
|
+
"__version__",
|
|
38
|
+
"agent_run",
|
|
39
|
+
"async_agent_run",
|
|
40
|
+
"async_llm_call",
|
|
41
|
+
"async_retrieval",
|
|
42
|
+
"async_sub_agent",
|
|
43
|
+
"async_tool_call",
|
|
44
|
+
"configure_tracing",
|
|
45
|
+
"current_span_id",
|
|
46
|
+
"current_trace_id",
|
|
47
|
+
"get_tracer",
|
|
48
|
+
"llm_call",
|
|
49
|
+
"retrieval",
|
|
50
|
+
"shutdown_tracing",
|
|
51
|
+
"sub_agent",
|
|
52
|
+
"tool_call",
|
|
53
|
+
]
|
|
54
|
+
|
agent_ops/_version.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
agent_ops/attributes.py
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from .generated import Attr, ContentRecorded, ErrorCategory
|
|
8
|
+
|
|
9
|
+
REDACTION_RULE_VERSION = "agent-ops-redaction-v1"
|
|
10
|
+
SUMMARY_MAX_CHARS = 256
|
|
11
|
+
|
|
12
|
+
_EMAIL = re.compile(r"\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b", re.IGNORECASE)
|
|
13
|
+
_PHONE = re.compile(r"\b1[3-9]\d{9}\b")
|
|
14
|
+
_IDENTITY = re.compile(r"\b\d{17}[\dXx]\b")
|
|
15
|
+
_BEARER = re.compile(
|
|
16
|
+
r"\b(Bearer\s+)[A-Za-z0-9._~+/=-]{8,}\b",
|
|
17
|
+
re.IGNORECASE,
|
|
18
|
+
)
|
|
19
|
+
_API_KEY = re.compile(r"\bsk-[A-Za-z0-9_-]{8,}\b")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def redact(value: str) -> str:
|
|
23
|
+
return _API_KEY.sub(
|
|
24
|
+
"[REDACTED_API_KEY]",
|
|
25
|
+
_BEARER.sub(
|
|
26
|
+
r"\1[REDACTED_TOKEN]",
|
|
27
|
+
_IDENTITY.sub(
|
|
28
|
+
"[REDACTED_ID]",
|
|
29
|
+
_PHONE.sub(
|
|
30
|
+
"[REDACTED_PHONE]",
|
|
31
|
+
_EMAIL.sub("[REDACTED_EMAIL]", value),
|
|
32
|
+
),
|
|
33
|
+
),
|
|
34
|
+
),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def summarize(value: str | None) -> str | None:
|
|
39
|
+
if value is None:
|
|
40
|
+
return None
|
|
41
|
+
return redact(value)[:SUMMARY_MAX_CHARS]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def common_attributes(
|
|
45
|
+
span_type: str,
|
|
46
|
+
*,
|
|
47
|
+
content_recorded: ContentRecorded | str = ContentRecorded.METADATA_ONLY,
|
|
48
|
+
input_summary: str | None = None,
|
|
49
|
+
output_summary: str | None = None,
|
|
50
|
+
input_ref: str | None = None,
|
|
51
|
+
output_ref: str | None = None,
|
|
52
|
+
) -> dict[str, Any]:
|
|
53
|
+
mode = (
|
|
54
|
+
content_recorded
|
|
55
|
+
if isinstance(content_recorded, ContentRecorded)
|
|
56
|
+
else ContentRecorded(content_recorded)
|
|
57
|
+
)
|
|
58
|
+
attributes: dict[str, Any] = {
|
|
59
|
+
Attr.AGENT_SPAN_TYPE: span_type,
|
|
60
|
+
Attr.AGENT_CONTENT_RECORDED: mode.value,
|
|
61
|
+
Attr.AGENT_REDACTION_APPLIED: REDACTION_RULE_VERSION,
|
|
62
|
+
}
|
|
63
|
+
_set_optional(attributes, Attr.AGENT_INPUT_SUMMARY, summarize(input_summary))
|
|
64
|
+
_set_optional(attributes, Attr.AGENT_OUTPUT_SUMMARY, summarize(output_summary))
|
|
65
|
+
_set_optional(attributes, Attr.AGENT_INPUT_REF, input_ref)
|
|
66
|
+
_set_optional(attributes, Attr.AGENT_OUTPUT_REF, output_ref)
|
|
67
|
+
return attributes
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def record_error(
|
|
71
|
+
span: Any,
|
|
72
|
+
error: BaseException,
|
|
73
|
+
category: ErrorCategory | str = ErrorCategory.OTHER,
|
|
74
|
+
) -> None:
|
|
75
|
+
normalized_category = (
|
|
76
|
+
category if isinstance(category, ErrorCategory) else ErrorCategory(category)
|
|
77
|
+
)
|
|
78
|
+
span.record_exception(error)
|
|
79
|
+
span.set_attribute(Attr.ERROR_TYPE, type(error).__name__)
|
|
80
|
+
span.set_attribute(Attr.AGENT_ERROR_CATEGORY, normalized_category.value)
|
|
81
|
+
span.set_attribute("agent.error.message", redact(str(error))[:1024])
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def merge_optional(
|
|
85
|
+
attributes: Mapping[str, Any],
|
|
86
|
+
key: str,
|
|
87
|
+
value: Any | None,
|
|
88
|
+
) -> dict[str, Any]:
|
|
89
|
+
merged = dict(attributes)
|
|
90
|
+
_set_optional(merged, key, value)
|
|
91
|
+
return merged
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def _set_optional(attributes: dict[str, Any], key: str, value: Any | None) -> None:
|
|
95
|
+
if value is not None:
|
|
96
|
+
attributes[key] = value
|
|
97
|
+
|
agent_ops/content.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
|
|
6
|
+
import requests
|
|
7
|
+
|
|
8
|
+
from .attributes import REDACTION_RULE_VERSION, redact
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class ContentCaptureConfig:
|
|
13
|
+
enabled: bool
|
|
14
|
+
endpoint: str
|
|
15
|
+
owner_app: str
|
|
16
|
+
token: str | None = None
|
|
17
|
+
timeout_seconds: float = 1.0
|
|
18
|
+
max_bytes: int = 2 * 1024 * 1024
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
_active_config: ContentCaptureConfig | None = None
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def configure_content_capture(config: ContentCaptureConfig) -> None:
|
|
25
|
+
global _active_config
|
|
26
|
+
_active_config = config
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def clear_content_capture() -> None:
|
|
30
|
+
global _active_config
|
|
31
|
+
_active_config = None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def capture_content(
|
|
35
|
+
content_kind: str,
|
|
36
|
+
value: object | None,
|
|
37
|
+
) -> str | None:
|
|
38
|
+
config = _active_config
|
|
39
|
+
if not config or not config.enabled or value is None:
|
|
40
|
+
return None
|
|
41
|
+
|
|
42
|
+
if isinstance(value, str):
|
|
43
|
+
media_type = "text/plain; charset=utf-8"
|
|
44
|
+
content = value
|
|
45
|
+
else:
|
|
46
|
+
media_type = "application/json"
|
|
47
|
+
content = json.dumps(value, ensure_ascii=False, default=str, indent=2)
|
|
48
|
+
content = redact(content)
|
|
49
|
+
if not content or len(content.encode("utf-8")) > config.max_bytes:
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
headers = {"content-type": "application/json"}
|
|
53
|
+
if config.token:
|
|
54
|
+
headers["authorization"] = f"Bearer {config.token}"
|
|
55
|
+
|
|
56
|
+
try:
|
|
57
|
+
response = requests.post(
|
|
58
|
+
config.endpoint,
|
|
59
|
+
headers=headers,
|
|
60
|
+
json={
|
|
61
|
+
"ownerApp": config.owner_app,
|
|
62
|
+
"contentKind": content_kind,
|
|
63
|
+
"mediaType": media_type,
|
|
64
|
+
"captureMode": "full",
|
|
65
|
+
"redactionRuleVersion": REDACTION_RULE_VERSION,
|
|
66
|
+
"content": content,
|
|
67
|
+
},
|
|
68
|
+
timeout=config.timeout_seconds,
|
|
69
|
+
)
|
|
70
|
+
response.raise_for_status()
|
|
71
|
+
content_id = response.json().get("contentId")
|
|
72
|
+
return content_id if isinstance(content_id, str) and content_id else None
|
|
73
|
+
except (requests.RequestException, ValueError, TypeError):
|
|
74
|
+
return None
|
|
75
|
+
|
agent_ops/generated.py
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"""Generated by packages/contracts/scripts/generate.ts. Do not edit."""
|
|
2
|
+
|
|
3
|
+
from enum import StrEnum
|
|
4
|
+
|
|
5
|
+
SCHEMA_VERSION = "0.1"
|
|
6
|
+
NAMESPACE_PREFIX = "agent"
|
|
7
|
+
SDK_NAME = "agent-ops-otel-sdk"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ContentRecorded(StrEnum):
|
|
11
|
+
FULL = "full"
|
|
12
|
+
METADATA_ONLY = "metadata_only"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class SpanType(StrEnum):
|
|
16
|
+
AGENT_RUN = "agent.run"
|
|
17
|
+
AGENT_STEP = "agent.step"
|
|
18
|
+
LLM_CALL = "llm.call"
|
|
19
|
+
TOOL_CALL = "tool.call"
|
|
20
|
+
RETRIEVAL = "retrieval"
|
|
21
|
+
SUB_AGENT = "sub_agent"
|
|
22
|
+
CUSTOM = "custom"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class RunStatus(StrEnum):
|
|
26
|
+
SUCCESS = "success"
|
|
27
|
+
FAILED = "failed"
|
|
28
|
+
PARTIAL = "partial"
|
|
29
|
+
CANCELLED = "cancelled"
|
|
30
|
+
TIMEOUT = "timeout"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class StopReason(StrEnum):
|
|
34
|
+
FINAL_ANSWER = "final_answer"
|
|
35
|
+
MAX_STEPS = "max_steps"
|
|
36
|
+
ERROR = "error"
|
|
37
|
+
USER_ABORT = "user_abort"
|
|
38
|
+
BUDGET_EXCEEDED = "budget_exceeded"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class ErrorCategory(StrEnum):
|
|
42
|
+
MODEL = "model"
|
|
43
|
+
TOOL = "tool"
|
|
44
|
+
TIMEOUT = "timeout"
|
|
45
|
+
RATE_LIMIT = "rate_limit"
|
|
46
|
+
VALIDATION = "validation"
|
|
47
|
+
POLICY = "policy"
|
|
48
|
+
OTHER = "other"
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class ToolType(StrEnum):
|
|
52
|
+
FUNCTION = "function"
|
|
53
|
+
MCP = "mcp"
|
|
54
|
+
HTTP = "http"
|
|
55
|
+
CODE_EXEC = "code_exec"
|
|
56
|
+
BROWSER = "browser"
|
|
57
|
+
OTHER = "other"
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class ScoreSource(StrEnum):
|
|
61
|
+
RULE = "rule"
|
|
62
|
+
LLM = "llm"
|
|
63
|
+
HUMAN = "human"
|
|
64
|
+
USER = "user"
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class FeedbackType(StrEnum):
|
|
68
|
+
THUMBS_UP = "thumbs_up"
|
|
69
|
+
THUMBS_DOWN = "thumbs_down"
|
|
70
|
+
RETRY = "retry"
|
|
71
|
+
ABANDON = "abandon"
|
|
72
|
+
COMMENT = "comment"
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class Environment(StrEnum):
|
|
76
|
+
PROD = "prod"
|
|
77
|
+
STAGING = "staging"
|
|
78
|
+
DEV = "dev"
|
|
79
|
+
TEST = "test"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class TraceIngestState(StrEnum):
|
|
83
|
+
OPEN = "open"
|
|
84
|
+
SEALED_COMPLETE = "sealed_complete"
|
|
85
|
+
SEALED_PARTIAL = "sealed_partial"
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class ContentStatus(StrEnum):
|
|
89
|
+
UPLOADING = "uploading"
|
|
90
|
+
AVAILABLE = "available"
|
|
91
|
+
QUARANTINED = "quarantined"
|
|
92
|
+
UNAVAILABLE = "unavailable"
|
|
93
|
+
EXPIRED = "expired"
|
|
94
|
+
DELETED = "deleted"
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class TaskType(StrEnum):
|
|
98
|
+
REFUND = "refund"
|
|
99
|
+
SUPPORT = "support"
|
|
100
|
+
RESEARCH = "research"
|
|
101
|
+
CODE_CHANGE = "code_change"
|
|
102
|
+
DATA_ANALYSIS = "data_analysis"
|
|
103
|
+
OTHER = "other"
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class Attr:
|
|
107
|
+
AGENT_APP_NAME = "agent.app.name"
|
|
108
|
+
AGENT_CONTENT_RECORDED = "agent.content.recorded"
|
|
109
|
+
AGENT_COST_CURRENCY = "agent.cost.currency"
|
|
110
|
+
AGENT_ERROR_CATEGORY = "agent.error.category"
|
|
111
|
+
AGENT_EVAL_CASE_ID = "agent.eval.case_id"
|
|
112
|
+
AGENT_INPUT_REF = "agent.input.ref"
|
|
113
|
+
AGENT_INPUT_SUMMARY = "agent.input.summary"
|
|
114
|
+
AGENT_LLM_COST = "agent.llm.cost"
|
|
115
|
+
AGENT_LLM_RETRY_COUNT = "agent.llm.retry_count"
|
|
116
|
+
AGENT_LLM_STREAMING = "agent.llm.streaming"
|
|
117
|
+
AGENT_LLM_TOKENS_CACHED = "agent.llm.tokens.cached"
|
|
118
|
+
AGENT_LLM_TOKENS_REASONING = "agent.llm.tokens.reasoning"
|
|
119
|
+
AGENT_LLM_TTFT_MS = "agent.llm.ttft_ms"
|
|
120
|
+
AGENT_OUTPUT_REF = "agent.output.ref"
|
|
121
|
+
AGENT_OUTPUT_SUMMARY = "agent.output.summary"
|
|
122
|
+
AGENT_PROMPT_ID = "agent.prompt.id"
|
|
123
|
+
AGENT_PROMPT_VERSION = "agent.prompt.version"
|
|
124
|
+
AGENT_REDACTION_APPLIED = "agent.redaction.applied"
|
|
125
|
+
AGENT_RETRIEVAL_DOC_IDS = "agent.retrieval.doc_ids"
|
|
126
|
+
AGENT_RETRIEVAL_QUERY_SUMMARY = "agent.retrieval.query.summary"
|
|
127
|
+
AGENT_RETRIEVAL_RESULT_COUNT = "agent.retrieval.result_count"
|
|
128
|
+
AGENT_RETRIEVAL_SCORES = "agent.retrieval.scores"
|
|
129
|
+
AGENT_RETRIEVAL_SOURCE = "agent.retrieval.source"
|
|
130
|
+
AGENT_RETRIEVAL_TOP_K = "agent.retrieval.top_k"
|
|
131
|
+
AGENT_RUN_COST_TOTAL = "agent.run.cost.total"
|
|
132
|
+
AGENT_RUN_ID = "agent.run.id"
|
|
133
|
+
AGENT_RUN_STATUS = "agent.run.status"
|
|
134
|
+
AGENT_RUN_STEPS = "agent.run.steps"
|
|
135
|
+
AGENT_RUN_STOP_REASON = "agent.run.stop_reason"
|
|
136
|
+
AGENT_RUN_TOKENS_INPUT = "agent.run.tokens.input"
|
|
137
|
+
AGENT_RUN_TOKENS_OUTPUT = "agent.run.tokens.output"
|
|
138
|
+
AGENT_SCHEMA_VERSION = "agent.schema.version"
|
|
139
|
+
AGENT_SDK_NAME = "agent.sdk.name"
|
|
140
|
+
AGENT_SDK_VERSION = "agent.sdk.version"
|
|
141
|
+
AGENT_SESSION_ID = "agent.session.id"
|
|
142
|
+
AGENT_SPAN_SUBTYPE = "agent.span.subtype"
|
|
143
|
+
AGENT_SPAN_TYPE = "agent.span.type"
|
|
144
|
+
AGENT_STEP_INDEX = "agent.step.index"
|
|
145
|
+
AGENT_SUB_AGENT_NAME = "agent.sub_agent.name"
|
|
146
|
+
AGENT_SUB_AGENT_ROLE = "agent.sub_agent.role"
|
|
147
|
+
AGENT_TASK_TYPE = "agent.task.type"
|
|
148
|
+
AGENT_TEAM = "agent.team"
|
|
149
|
+
AGENT_TOOL_ARGS_SUMMARY = "agent.tool.args.summary"
|
|
150
|
+
AGENT_TOOL_CALL_ID = "agent.tool.call_id"
|
|
151
|
+
AGENT_TOOL_ERROR_RETRYABLE = "agent.tool.error.retryable"
|
|
152
|
+
AGENT_TOOL_NAME = "agent.tool.name"
|
|
153
|
+
AGENT_TOOL_RETRY_COUNT = "agent.tool.retry_count"
|
|
154
|
+
AGENT_TOOL_TYPE = "agent.tool.type"
|
|
155
|
+
AGENT_USER_ID = "agent.user.id"
|
|
156
|
+
DEPLOYMENT_ENVIRONMENT_NAME = "deployment.environment.name"
|
|
157
|
+
ERROR_TYPE = "error.type"
|
|
158
|
+
GEN_AI_PROVIDER_NAME = "gen_ai.provider.name"
|
|
159
|
+
GEN_AI_REQUEST_MAX_TOKENS = "gen_ai.request.max_tokens"
|
|
160
|
+
GEN_AI_REQUEST_MODEL = "gen_ai.request.model"
|
|
161
|
+
GEN_AI_REQUEST_TEMPERATURE = "gen_ai.request.temperature"
|
|
162
|
+
GEN_AI_REQUEST_TOP_P = "gen_ai.request.top_p"
|
|
163
|
+
GEN_AI_RESPONSE_FINISH_REASONS = "gen_ai.response.finish_reasons"
|
|
164
|
+
GEN_AI_RESPONSE_MODEL = "gen_ai.response.model"
|
|
165
|
+
GEN_AI_USAGE_INPUT_TOKENS = "gen_ai.usage.input_tokens"
|
|
166
|
+
GEN_AI_USAGE_OUTPUT_TOKENS = "gen_ai.usage.output_tokens"
|
|
167
|
+
SERVICE_NAME = "service.name"
|
|
168
|
+
SERVICE_VERSION = "service.version"
|
agent_ops/py.typed
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# PEP 561 type information marker
|
agent_ops/runtime.py
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from threading import Lock
|
|
6
|
+
from urllib.parse import urlparse, urlunparse
|
|
7
|
+
|
|
8
|
+
from opentelemetry import trace
|
|
9
|
+
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
|
10
|
+
from opentelemetry.sdk.resources import Resource
|
|
11
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
12
|
+
from opentelemetry.sdk.trace.export import (
|
|
13
|
+
BatchSpanProcessor,
|
|
14
|
+
SimpleSpanProcessor,
|
|
15
|
+
SpanExporter,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
from ._version import __version__ as _SDK_VERSION
|
|
19
|
+
from .content import (
|
|
20
|
+
ContentCaptureConfig,
|
|
21
|
+
clear_content_capture,
|
|
22
|
+
configure_content_capture,
|
|
23
|
+
)
|
|
24
|
+
from .generated import SCHEMA_VERSION, SDK_NAME, Environment
|
|
25
|
+
|
|
26
|
+
_lock = Lock()
|
|
27
|
+
_provider: TracerProvider | None = None
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@dataclass(frozen=True, slots=True)
|
|
31
|
+
class TracingConfig:
|
|
32
|
+
service_name: str
|
|
33
|
+
service_version: str
|
|
34
|
+
app_name: str
|
|
35
|
+
environment: Environment
|
|
36
|
+
endpoint: str
|
|
37
|
+
headers: Mapping[str, str] | None = None
|
|
38
|
+
team: str | None = None
|
|
39
|
+
span_exporter: SpanExporter | None = None
|
|
40
|
+
simple_exporter: bool = False
|
|
41
|
+
content_capture: bool = False
|
|
42
|
+
content_endpoint: str | None = None
|
|
43
|
+
content_token: str | None = None
|
|
44
|
+
content_timeout_seconds: float = 1.0
|
|
45
|
+
content_max_bytes: int = 2 * 1024 * 1024
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def configure_tracing(config: TracingConfig) -> None:
|
|
49
|
+
global _provider
|
|
50
|
+
|
|
51
|
+
with _lock:
|
|
52
|
+
if _provider is not None:
|
|
53
|
+
raise RuntimeError("Agent Ops tracing has already been configured")
|
|
54
|
+
|
|
55
|
+
attributes = {
|
|
56
|
+
"service.name": config.service_name,
|
|
57
|
+
"service.version": config.service_version,
|
|
58
|
+
"deployment.environment.name": config.environment.value,
|
|
59
|
+
"agent.app.name": config.app_name,
|
|
60
|
+
"agent.sdk.name": SDK_NAME,
|
|
61
|
+
"agent.sdk.version": _SDK_VERSION,
|
|
62
|
+
"agent.schema.version": SCHEMA_VERSION,
|
|
63
|
+
}
|
|
64
|
+
if config.team is not None:
|
|
65
|
+
attributes["agent.team"] = config.team
|
|
66
|
+
|
|
67
|
+
exporter = config.span_exporter or OTLPSpanExporter(
|
|
68
|
+
endpoint=config.endpoint,
|
|
69
|
+
headers=dict(config.headers or {}),
|
|
70
|
+
)
|
|
71
|
+
provider = TracerProvider(resource=Resource.create(attributes))
|
|
72
|
+
processor = (
|
|
73
|
+
SimpleSpanProcessor(exporter)
|
|
74
|
+
if config.simple_exporter
|
|
75
|
+
else BatchSpanProcessor(exporter)
|
|
76
|
+
)
|
|
77
|
+
provider.add_span_processor(processor)
|
|
78
|
+
trace.set_tracer_provider(provider)
|
|
79
|
+
_provider = provider
|
|
80
|
+
configure_content_capture(
|
|
81
|
+
ContentCaptureConfig(
|
|
82
|
+
enabled=config.content_capture,
|
|
83
|
+
endpoint=config.content_endpoint
|
|
84
|
+
or _content_endpoint(config.endpoint),
|
|
85
|
+
owner_app=config.app_name,
|
|
86
|
+
token=config.content_token,
|
|
87
|
+
timeout_seconds=config.content_timeout_seconds,
|
|
88
|
+
max_bytes=config.content_max_bytes,
|
|
89
|
+
)
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def get_tracer() -> trace.Tracer:
|
|
94
|
+
return trace.get_tracer(SDK_NAME, _SDK_VERSION)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def shutdown_tracing() -> None:
|
|
98
|
+
global _provider
|
|
99
|
+
|
|
100
|
+
with _lock:
|
|
101
|
+
if _provider is None:
|
|
102
|
+
return
|
|
103
|
+
_provider.shutdown()
|
|
104
|
+
_provider = None
|
|
105
|
+
clear_content_capture()
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _content_endpoint(trace_endpoint: str) -> str:
|
|
109
|
+
parsed = urlparse(trace_endpoint)
|
|
110
|
+
return urlunparse(
|
|
111
|
+
(
|
|
112
|
+
parsed.scheme,
|
|
113
|
+
parsed.netloc,
|
|
114
|
+
"/api/v1/content",
|
|
115
|
+
"",
|
|
116
|
+
"",
|
|
117
|
+
"",
|
|
118
|
+
)
|
|
119
|
+
)
|
|
120
|
+
|
agent_ops/tracing.py
ADDED
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import AsyncIterator, Iterator
|
|
4
|
+
from contextlib import asynccontextmanager, contextmanager
|
|
5
|
+
from contextvars import Token
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from opentelemetry import context as otel_context
|
|
10
|
+
from opentelemetry import trace
|
|
11
|
+
from opentelemetry.trace import Span, Status, StatusCode
|
|
12
|
+
|
|
13
|
+
from .attributes import common_attributes, record_error, summarize
|
|
14
|
+
from .content import capture_content
|
|
15
|
+
from .generated import Attr, ErrorCategory, RunStatus, ToolType
|
|
16
|
+
from .runtime import get_tracer
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class _ContentCaptureMixin:
|
|
20
|
+
_span: Span
|
|
21
|
+
_content_prefix: str
|
|
22
|
+
|
|
23
|
+
def capture_input_content(
|
|
24
|
+
self,
|
|
25
|
+
content: object,
|
|
26
|
+
) -> str | None:
|
|
27
|
+
return _capture_span_content(
|
|
28
|
+
self._span,
|
|
29
|
+
f"{self._content_prefix}_input",
|
|
30
|
+
Attr.AGENT_INPUT_REF,
|
|
31
|
+
content,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
def capture_output_content(
|
|
35
|
+
self,
|
|
36
|
+
content: object,
|
|
37
|
+
) -> str | None:
|
|
38
|
+
return _capture_span_content(
|
|
39
|
+
self._span,
|
|
40
|
+
f"{self._content_prefix}_output",
|
|
41
|
+
Attr.AGENT_OUTPUT_REF,
|
|
42
|
+
content,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(slots=True)
|
|
47
|
+
class AgentRunHandle(_ContentCaptureMixin):
|
|
48
|
+
_span: Span
|
|
49
|
+
status: RunStatus | None = None
|
|
50
|
+
stop_reason: str | None = None
|
|
51
|
+
_content_prefix: str = "agent"
|
|
52
|
+
|
|
53
|
+
def complete(self, status: RunStatus | str, stop_reason: str | None = None) -> None:
|
|
54
|
+
self.status = status if isinstance(status, RunStatus) else RunStatus(status)
|
|
55
|
+
self.stop_reason = stop_reason
|
|
56
|
+
|
|
57
|
+
def set_user_id(self, user_id: str) -> None:
|
|
58
|
+
self._span.set_attribute(Attr.AGENT_USER_ID, user_id)
|
|
59
|
+
|
|
60
|
+
def set_cost(self, cost_micros: int, currency: str) -> None:
|
|
61
|
+
self._span.set_attribute(Attr.AGENT_RUN_COST_TOTAL, cost_micros)
|
|
62
|
+
self._span.set_attribute(Attr.AGENT_COST_CURRENCY, currency)
|
|
63
|
+
|
|
64
|
+
def set_output_summary(self, output_summary: str) -> None:
|
|
65
|
+
self._span.set_attribute(
|
|
66
|
+
Attr.AGENT_OUTPUT_SUMMARY,
|
|
67
|
+
summarize(output_summary) or "",
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass(slots=True)
|
|
72
|
+
class LlmCallHandle(_ContentCaptureMixin):
|
|
73
|
+
_span: Span
|
|
74
|
+
_content_prefix: str = "llm"
|
|
75
|
+
|
|
76
|
+
def record_usage(
|
|
77
|
+
self,
|
|
78
|
+
*,
|
|
79
|
+
input_tokens: int | None = None,
|
|
80
|
+
output_tokens: int | None = None,
|
|
81
|
+
response_model: str | None = None,
|
|
82
|
+
finish_reasons: list[str] | None = None,
|
|
83
|
+
cached_tokens: int | None = None,
|
|
84
|
+
reasoning_tokens: int | None = None,
|
|
85
|
+
ttft_ms: int | None = None,
|
|
86
|
+
streaming: bool | None = None,
|
|
87
|
+
retry_count: int | None = None,
|
|
88
|
+
cost_micros: int | None = None,
|
|
89
|
+
output_summary: str | None = None,
|
|
90
|
+
) -> None:
|
|
91
|
+
_set_optional(
|
|
92
|
+
self._span,
|
|
93
|
+
Attr.AGENT_OUTPUT_SUMMARY,
|
|
94
|
+
summarize(output_summary),
|
|
95
|
+
)
|
|
96
|
+
_set_optional(self._span, Attr.GEN_AI_USAGE_INPUT_TOKENS, input_tokens)
|
|
97
|
+
_set_optional(self._span, Attr.GEN_AI_USAGE_OUTPUT_TOKENS, output_tokens)
|
|
98
|
+
_set_optional(self._span, Attr.GEN_AI_RESPONSE_MODEL, response_model)
|
|
99
|
+
_set_optional(
|
|
100
|
+
self._span,
|
|
101
|
+
Attr.GEN_AI_RESPONSE_FINISH_REASONS,
|
|
102
|
+
finish_reasons,
|
|
103
|
+
)
|
|
104
|
+
_set_optional(self._span, Attr.AGENT_LLM_TOKENS_CACHED, cached_tokens)
|
|
105
|
+
_set_optional(
|
|
106
|
+
self._span,
|
|
107
|
+
Attr.AGENT_LLM_TOKENS_REASONING,
|
|
108
|
+
reasoning_tokens,
|
|
109
|
+
)
|
|
110
|
+
_set_optional(self._span, Attr.AGENT_LLM_TTFT_MS, ttft_ms)
|
|
111
|
+
_set_optional(self._span, Attr.AGENT_LLM_STREAMING, streaming)
|
|
112
|
+
_set_optional(self._span, Attr.AGENT_LLM_RETRY_COUNT, retry_count)
|
|
113
|
+
_set_optional(self._span, Attr.AGENT_LLM_COST, cost_micros)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
@dataclass(slots=True)
|
|
117
|
+
class ToolCallHandle(_ContentCaptureMixin):
|
|
118
|
+
_span: Span
|
|
119
|
+
_content_prefix: str = "tool"
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@contextmanager
|
|
123
|
+
def agent_run(
|
|
124
|
+
*,
|
|
125
|
+
name: str = "agent.run",
|
|
126
|
+
session_id: str,
|
|
127
|
+
task_type: str,
|
|
128
|
+
run_id: str | None = None,
|
|
129
|
+
user_id: str | None = None,
|
|
130
|
+
prompt_version: str | None = None,
|
|
131
|
+
eval_case_id: str | None = None,
|
|
132
|
+
content_recorded: str = "metadata_only",
|
|
133
|
+
input_summary: str | None = None,
|
|
134
|
+
output_summary: str | None = None,
|
|
135
|
+
input_ref: str | None = None,
|
|
136
|
+
output_ref: str | None = None,
|
|
137
|
+
) -> Iterator[AgentRunHandle]:
|
|
138
|
+
attributes = common_attributes(
|
|
139
|
+
"agent.run",
|
|
140
|
+
content_recorded=content_recorded,
|
|
141
|
+
input_summary=input_summary,
|
|
142
|
+
output_summary=output_summary,
|
|
143
|
+
input_ref=input_ref,
|
|
144
|
+
output_ref=output_ref,
|
|
145
|
+
)
|
|
146
|
+
attributes[Attr.AGENT_SESSION_ID] = session_id
|
|
147
|
+
attributes[Attr.AGENT_TASK_TYPE] = task_type
|
|
148
|
+
_set_optional(attributes, Attr.AGENT_RUN_ID, run_id)
|
|
149
|
+
_set_optional(attributes, Attr.AGENT_USER_ID, user_id)
|
|
150
|
+
_set_optional(attributes, Attr.AGENT_PROMPT_VERSION, prompt_version)
|
|
151
|
+
_set_optional(attributes, Attr.AGENT_EVAL_CASE_ID, eval_case_id)
|
|
152
|
+
|
|
153
|
+
span = get_tracer().start_span(name, attributes=attributes)
|
|
154
|
+
token = _attach(span)
|
|
155
|
+
handle = AgentRunHandle(_span=span)
|
|
156
|
+
try:
|
|
157
|
+
yield handle
|
|
158
|
+
except BaseException as error:
|
|
159
|
+
span.set_attributes(
|
|
160
|
+
{
|
|
161
|
+
Attr.AGENT_RUN_STATUS: RunStatus.FAILED.value,
|
|
162
|
+
Attr.AGENT_RUN_STOP_REASON: "error",
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
span.set_status(Status(StatusCode.ERROR, str(error)))
|
|
166
|
+
record_error(span, error)
|
|
167
|
+
raise
|
|
168
|
+
else:
|
|
169
|
+
final_status = handle.status or RunStatus.PARTIAL
|
|
170
|
+
span.set_attribute(Attr.AGENT_RUN_STATUS, final_status.value)
|
|
171
|
+
_set_optional(span, Attr.AGENT_RUN_STOP_REASON, handle.stop_reason)
|
|
172
|
+
span.set_status(
|
|
173
|
+
Status(
|
|
174
|
+
StatusCode.OK
|
|
175
|
+
if final_status is RunStatus.SUCCESS
|
|
176
|
+
else StatusCode.ERROR,
|
|
177
|
+
None if final_status is RunStatus.SUCCESS else final_status.value,
|
|
178
|
+
)
|
|
179
|
+
)
|
|
180
|
+
finally:
|
|
181
|
+
otel_context.detach(token)
|
|
182
|
+
span.end()
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
@asynccontextmanager
|
|
186
|
+
async def async_agent_run(
|
|
187
|
+
**options: Any,
|
|
188
|
+
) -> AsyncIterator[AgentRunHandle]:
|
|
189
|
+
with agent_run(**options) as handle:
|
|
190
|
+
yield handle
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
@contextmanager
|
|
194
|
+
def llm_call(
|
|
195
|
+
*,
|
|
196
|
+
name: str = "chat",
|
|
197
|
+
provider: str,
|
|
198
|
+
request_model: str,
|
|
199
|
+
input_tokens: int | None = None,
|
|
200
|
+
output_tokens: int | None = None,
|
|
201
|
+
response_model: str | None = None,
|
|
202
|
+
temperature: float | None = None,
|
|
203
|
+
top_p: float | None = None,
|
|
204
|
+
max_tokens: int | None = None,
|
|
205
|
+
finish_reasons: list[str] | None = None,
|
|
206
|
+
cached_tokens: int | None = None,
|
|
207
|
+
reasoning_tokens: int | None = None,
|
|
208
|
+
ttft_ms: int | None = None,
|
|
209
|
+
streaming: bool | None = None,
|
|
210
|
+
retry_count: int | None = None,
|
|
211
|
+
prompt_id: str | None = None,
|
|
212
|
+
prompt_version: str | None = None,
|
|
213
|
+
cost_micros: int | None = None,
|
|
214
|
+
**common: Any,
|
|
215
|
+
) -> Iterator[LlmCallHandle]:
|
|
216
|
+
attributes = common_attributes("llm.call", **common)
|
|
217
|
+
attributes[Attr.GEN_AI_PROVIDER_NAME] = provider
|
|
218
|
+
attributes[Attr.GEN_AI_REQUEST_MODEL] = request_model
|
|
219
|
+
_set_optional(attributes, Attr.GEN_AI_USAGE_INPUT_TOKENS, input_tokens)
|
|
220
|
+
_set_optional(attributes, Attr.GEN_AI_USAGE_OUTPUT_TOKENS, output_tokens)
|
|
221
|
+
_set_optional(attributes, Attr.GEN_AI_RESPONSE_MODEL, response_model)
|
|
222
|
+
_set_optional(attributes, Attr.GEN_AI_REQUEST_TEMPERATURE, temperature)
|
|
223
|
+
_set_optional(attributes, Attr.GEN_AI_REQUEST_TOP_P, top_p)
|
|
224
|
+
_set_optional(attributes, Attr.GEN_AI_REQUEST_MAX_TOKENS, max_tokens)
|
|
225
|
+
_set_optional(
|
|
226
|
+
attributes,
|
|
227
|
+
Attr.GEN_AI_RESPONSE_FINISH_REASONS,
|
|
228
|
+
finish_reasons,
|
|
229
|
+
)
|
|
230
|
+
_set_optional(attributes, Attr.AGENT_LLM_TOKENS_CACHED, cached_tokens)
|
|
231
|
+
_set_optional(attributes, Attr.AGENT_LLM_TOKENS_REASONING, reasoning_tokens)
|
|
232
|
+
_set_optional(attributes, Attr.AGENT_LLM_TTFT_MS, ttft_ms)
|
|
233
|
+
_set_optional(attributes, Attr.AGENT_LLM_STREAMING, streaming)
|
|
234
|
+
_set_optional(attributes, Attr.AGENT_LLM_RETRY_COUNT, retry_count)
|
|
235
|
+
_set_optional(attributes, Attr.AGENT_PROMPT_ID, prompt_id)
|
|
236
|
+
_set_optional(attributes, Attr.AGENT_PROMPT_VERSION, prompt_version)
|
|
237
|
+
_set_optional(attributes, Attr.AGENT_LLM_COST, cost_micros)
|
|
238
|
+
with _span_handle(name, attributes, ErrorCategory.MODEL) as handle:
|
|
239
|
+
yield handle
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
@contextmanager
|
|
243
|
+
def tool_call(
|
|
244
|
+
*,
|
|
245
|
+
name: str,
|
|
246
|
+
tool_type: ToolType | str | None = None,
|
|
247
|
+
call_id: str | None = None,
|
|
248
|
+
args_summary: str | None = None,
|
|
249
|
+
retry_count: int | None = None,
|
|
250
|
+
**common: Any,
|
|
251
|
+
) -> Iterator[ToolCallHandle]:
|
|
252
|
+
attributes = common_attributes("tool.call", **common)
|
|
253
|
+
attributes[Attr.AGENT_TOOL_NAME] = name
|
|
254
|
+
_set_optional(attributes, Attr.AGENT_TOOL_TYPE, _enum_value(tool_type))
|
|
255
|
+
_set_optional(attributes, Attr.AGENT_TOOL_CALL_ID, call_id)
|
|
256
|
+
_set_optional(attributes, Attr.AGENT_TOOL_RETRY_COUNT, retry_count)
|
|
257
|
+
_set_optional(attributes, Attr.AGENT_TOOL_ARGS_SUMMARY, summarize(args_summary))
|
|
258
|
+
with _tool_span_handle(name, attributes) as handle:
|
|
259
|
+
yield handle
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
@contextmanager
|
|
263
|
+
def retrieval(
|
|
264
|
+
*,
|
|
265
|
+
name: str = "retrieval",
|
|
266
|
+
source: str | None = None,
|
|
267
|
+
query: str | None = None,
|
|
268
|
+
top_k: int | None = None,
|
|
269
|
+
result_count: int | None = None,
|
|
270
|
+
document_ids: list[str] | None = None,
|
|
271
|
+
scores: list[float] | None = None,
|
|
272
|
+
**common: Any,
|
|
273
|
+
) -> Iterator[None]:
|
|
274
|
+
attributes = common_attributes("retrieval", **common)
|
|
275
|
+
_set_optional(attributes, Attr.AGENT_RETRIEVAL_SOURCE, source)
|
|
276
|
+
_set_optional(
|
|
277
|
+
attributes,
|
|
278
|
+
Attr.AGENT_RETRIEVAL_QUERY_SUMMARY,
|
|
279
|
+
summarize(query),
|
|
280
|
+
)
|
|
281
|
+
_set_optional(attributes, Attr.AGENT_RETRIEVAL_TOP_K, top_k)
|
|
282
|
+
_set_optional(attributes, Attr.AGENT_RETRIEVAL_RESULT_COUNT, result_count)
|
|
283
|
+
_set_optional(
|
|
284
|
+
attributes,
|
|
285
|
+
Attr.AGENT_RETRIEVAL_DOC_IDS,
|
|
286
|
+
document_ids[:20] if document_ids is not None else None,
|
|
287
|
+
)
|
|
288
|
+
_set_optional(
|
|
289
|
+
attributes,
|
|
290
|
+
Attr.AGENT_RETRIEVAL_SCORES,
|
|
291
|
+
scores[:20] if scores is not None else None,
|
|
292
|
+
)
|
|
293
|
+
with _span(name, attributes, ErrorCategory.OTHER):
|
|
294
|
+
yield
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
@contextmanager
|
|
298
|
+
def sub_agent(
|
|
299
|
+
*,
|
|
300
|
+
name: str,
|
|
301
|
+
role: str | None = None,
|
|
302
|
+
**common: Any,
|
|
303
|
+
) -> Iterator[None]:
|
|
304
|
+
attributes = common_attributes("sub_agent", **common)
|
|
305
|
+
attributes[Attr.AGENT_SUB_AGENT_NAME] = name
|
|
306
|
+
_set_optional(attributes, Attr.AGENT_SUB_AGENT_ROLE, role)
|
|
307
|
+
with _span(name, attributes, ErrorCategory.OTHER):
|
|
308
|
+
yield
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
@asynccontextmanager
|
|
312
|
+
async def async_llm_call(**options: Any) -> AsyncIterator[LlmCallHandle]:
|
|
313
|
+
with llm_call(**options) as handle:
|
|
314
|
+
yield handle
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
@asynccontextmanager
|
|
318
|
+
async def async_tool_call(**options: Any) -> AsyncIterator[ToolCallHandle]:
|
|
319
|
+
with tool_call(**options) as handle:
|
|
320
|
+
yield handle
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
@asynccontextmanager
|
|
324
|
+
async def async_retrieval(**options: Any) -> AsyncIterator[None]:
|
|
325
|
+
with retrieval(**options):
|
|
326
|
+
yield
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
@asynccontextmanager
|
|
330
|
+
async def async_sub_agent(**options: Any) -> AsyncIterator[None]:
|
|
331
|
+
with sub_agent(**options):
|
|
332
|
+
yield
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def current_trace_id() -> str | None:
|
|
336
|
+
span = trace.get_current_span()
|
|
337
|
+
span_context = span.get_span_context()
|
|
338
|
+
return f"{span_context.trace_id:032x}" if span_context.is_valid else None
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
def current_span_id() -> str | None:
|
|
342
|
+
span = trace.get_current_span()
|
|
343
|
+
span_context = span.get_span_context()
|
|
344
|
+
return f"{span_context.span_id:016x}" if span_context.is_valid else None
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
@contextmanager
|
|
348
|
+
def _span(
|
|
349
|
+
name: str,
|
|
350
|
+
attributes: dict[str, Any],
|
|
351
|
+
category: ErrorCategory,
|
|
352
|
+
) -> Iterator[None]:
|
|
353
|
+
span = get_tracer().start_span(name, attributes=attributes)
|
|
354
|
+
token = _attach(span)
|
|
355
|
+
try:
|
|
356
|
+
yield
|
|
357
|
+
except BaseException as error:
|
|
358
|
+
span.set_status(Status(StatusCode.ERROR, str(error)))
|
|
359
|
+
record_error(span, error, category)
|
|
360
|
+
raise
|
|
361
|
+
else:
|
|
362
|
+
span.set_status(Status(StatusCode.OK))
|
|
363
|
+
finally:
|
|
364
|
+
otel_context.detach(token)
|
|
365
|
+
span.end()
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
@contextmanager
|
|
369
|
+
def _span_handle(
|
|
370
|
+
name: str,
|
|
371
|
+
attributes: dict[str, Any],
|
|
372
|
+
category: ErrorCategory,
|
|
373
|
+
) -> Iterator[LlmCallHandle]:
|
|
374
|
+
span = get_tracer().start_span(name, attributes=attributes)
|
|
375
|
+
token = _attach(span)
|
|
376
|
+
handle = LlmCallHandle(_span=span)
|
|
377
|
+
try:
|
|
378
|
+
yield handle
|
|
379
|
+
except BaseException as error:
|
|
380
|
+
span.set_status(Status(StatusCode.ERROR, str(error)))
|
|
381
|
+
record_error(span, error, category)
|
|
382
|
+
raise
|
|
383
|
+
else:
|
|
384
|
+
span.set_status(Status(StatusCode.OK))
|
|
385
|
+
finally:
|
|
386
|
+
otel_context.detach(token)
|
|
387
|
+
span.end()
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
@contextmanager
|
|
391
|
+
def _tool_span_handle(
|
|
392
|
+
name: str,
|
|
393
|
+
attributes: dict[str, Any],
|
|
394
|
+
) -> Iterator[ToolCallHandle]:
|
|
395
|
+
span = get_tracer().start_span(name, attributes=attributes)
|
|
396
|
+
token = _attach(span)
|
|
397
|
+
handle = ToolCallHandle(_span=span)
|
|
398
|
+
try:
|
|
399
|
+
yield handle
|
|
400
|
+
except BaseException as error:
|
|
401
|
+
span.set_status(Status(StatusCode.ERROR, str(error)))
|
|
402
|
+
record_error(span, error, ErrorCategory.TOOL)
|
|
403
|
+
raise
|
|
404
|
+
else:
|
|
405
|
+
span.set_status(Status(StatusCode.OK))
|
|
406
|
+
finally:
|
|
407
|
+
otel_context.detach(token)
|
|
408
|
+
span.end()
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
def _capture_span_content(
|
|
412
|
+
span: Span,
|
|
413
|
+
content_kind: str,
|
|
414
|
+
reference_attribute: str,
|
|
415
|
+
content: object,
|
|
416
|
+
) -> str | None:
|
|
417
|
+
content_id = capture_content(content_kind, content)
|
|
418
|
+
if content_id is None:
|
|
419
|
+
return None
|
|
420
|
+
span.set_attribute(reference_attribute, content_id)
|
|
421
|
+
span.set_attribute(Attr.AGENT_CONTENT_RECORDED, "full")
|
|
422
|
+
return content_id
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
def _attach(span: Span) -> Token[Any]:
|
|
426
|
+
return otel_context.attach(trace.set_span_in_context(span))
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
def _set_optional(
|
|
430
|
+
target: dict[str, Any] | Span,
|
|
431
|
+
key: str,
|
|
432
|
+
value: Any | None,
|
|
433
|
+
) -> None:
|
|
434
|
+
if value is None:
|
|
435
|
+
return
|
|
436
|
+
if isinstance(target, dict):
|
|
437
|
+
target[key] = value
|
|
438
|
+
else:
|
|
439
|
+
target.set_attribute(key, value)
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
def _enum_value(value: ToolType | str | None) -> str | None:
|
|
443
|
+
if value is None:
|
|
444
|
+
return None
|
|
445
|
+
return value.value if isinstance(value, ToolType) else value
|
|
446
|
+
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-ops-otel-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Thin OpenTelemetry SDK for Agent Ops
|
|
5
|
+
Author: Agent Ops Contributors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/DraskyChen/Agent-Ops#readme
|
|
8
|
+
Project-URL: Repository, https://github.com/DraskyChen/Agent-Ops
|
|
9
|
+
Project-URL: Issues, https://github.com/DraskyChen/Agent-Ops/issues
|
|
10
|
+
Keywords: agent,observability,opentelemetry,tracing,llm
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: opentelemetry-api<2,>=1.38
|
|
22
|
+
Requires-Dist: opentelemetry-sdk<2,>=1.38
|
|
23
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-http<2,>=1.38
|
|
24
|
+
Requires-Dist: requests<3,>=2.32
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: mypy>=1.15; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest>=8.3; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff>=0.11; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# Agent Ops Python SDK
|
|
32
|
+
|
|
33
|
+
OpenTelemetry tracing helpers for Python agents that send traces to Agent Ops.
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
|
|
37
|
+
- Python 3.11 or newer
|
|
38
|
+
- An Agent Ops OTLP endpoint and ingest token
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install agent-ops-otel-sdk
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Quick start
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
import os
|
|
50
|
+
|
|
51
|
+
from agent_ops import (
|
|
52
|
+
Environment,
|
|
53
|
+
TracingConfig,
|
|
54
|
+
agent_run,
|
|
55
|
+
configure_tracing,
|
|
56
|
+
llm_call,
|
|
57
|
+
shutdown_tracing,
|
|
58
|
+
tool_call,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
configure_tracing(
|
|
62
|
+
TracingConfig(
|
|
63
|
+
service_name="support-agent",
|
|
64
|
+
service_version="1.4.0",
|
|
65
|
+
app_name="customer-support",
|
|
66
|
+
environment=Environment.PROD,
|
|
67
|
+
endpoint="https://agent-ops.example.com/v1/traces",
|
|
68
|
+
headers={
|
|
69
|
+
"authorization": f"Bearer {os.environ['AGENT_OPS_INGEST_TOKEN']}"
|
|
70
|
+
},
|
|
71
|
+
)
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
try:
|
|
75
|
+
with agent_run(
|
|
76
|
+
session_id="session-123",
|
|
77
|
+
task_type="support",
|
|
78
|
+
input_summary="Resolve a duplicate subscription",
|
|
79
|
+
) as run:
|
|
80
|
+
with llm_call(
|
|
81
|
+
provider="deepseek",
|
|
82
|
+
request_model="deepseek-flash",
|
|
83
|
+
input_tokens=420,
|
|
84
|
+
output_tokens=80,
|
|
85
|
+
):
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
with tool_call(
|
|
89
|
+
name="cancel_subscription",
|
|
90
|
+
args_summary='{"subscriptionId":"sub-b"}',
|
|
91
|
+
):
|
|
92
|
+
pass
|
|
93
|
+
|
|
94
|
+
run.complete("success", "final_answer")
|
|
95
|
+
finally:
|
|
96
|
+
shutdown_tracing()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
To capture complete input and output content, set `content_capture=True` and
|
|
100
|
+
provide `content_token`. Captured content is redacted and uploaded through the
|
|
101
|
+
Agent Ops server before its content ID is attached to the span.
|
|
102
|
+
|
|
103
|
+
The package exposes `__version__`, contract constants such as `Attr`, and
|
|
104
|
+
helpers for `agent.run`, `llm.call`, `tool.call`, `retrieval`, and `sub_agent`
|
|
105
|
+
spans.
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
agent_ops/__init__.py,sha256=8lIm5xt0sfRAPPptF4s6uq6-ZF_dzeJZMcqY5RepT8Y,1029
|
|
2
|
+
agent_ops/_version.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
|
|
3
|
+
agent_ops/attributes.py,sha256=dvMiPJrdcGe8wyAvooI6naPhY1_EjxffyrII46PhSdE,2858
|
|
4
|
+
agent_ops/content.py,sha256=P_XmsY2m2mBpq-k73lz21hTcQNN9oDj7xVuAKH9acc0,2044
|
|
5
|
+
agent_ops/generated.py,sha256=Mim4zC2ow9GI5SfRHYAxoEI9IwFBQUWW7yIE-m3lnIo,5101
|
|
6
|
+
agent_ops/py.typed,sha256=FYDI2vFGQtWaDD5yD-7Vye9D2pEtC9laT6OlUDWE9vQ,34
|
|
7
|
+
agent_ops/runtime.py,sha256=FMOhK1N8MnpZ0IHUCu2BH2tFgH-Lu_DMlq0wAGdlqZc,3520
|
|
8
|
+
agent_ops/tracing.py,sha256=Fvof0tuxSTeottwiouLRpOFYJ94KGQS4RRqiPj_urTc,13921
|
|
9
|
+
agent_ops_otel_sdk-0.1.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
10
|
+
agent_ops_otel_sdk-0.1.0.dist-info/METADATA,sha256=BZxAjKS4eGOWnB71NknSnct97unGWqKOGYwVyXD0mKU,2990
|
|
11
|
+
agent_ops_otel_sdk-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
12
|
+
agent_ops_otel_sdk-0.1.0.dist-info/top_level.txt,sha256=_7kmbmMSEKvT9fYv98vQE1Cq3Qc7kDz3oiCJ1BMWpOM,10
|
|
13
|
+
agent_ops_otel_sdk-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
agent_ops
|