acp-sdk 0.9.0__py3-none-any.whl → 0.9.1__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.
acp_sdk/client/client.py CHANGED
@@ -8,7 +8,6 @@ from typing import Self
8
8
 
9
9
  import httpx
10
10
  from httpx_sse import EventSource, aconnect_sse
11
- from opentelemetry.instrumentation.httpx import HTTPXClientInstrumentor
12
11
  from pydantic import TypeAdapter
13
12
 
14
13
  from acp_sdk.client.types import Input
@@ -44,7 +43,6 @@ class Client:
44
43
  *,
45
44
  session_id: SessionId | None = None,
46
45
  client: httpx.AsyncClient | None = None,
47
- instrument: bool = True,
48
46
  auth: httpx._types.AuthTypes | None = None,
49
47
  params: httpx._types.QueryParamTypes | None = None,
50
48
  headers: httpx._types.HeaderTypes | None = None,
@@ -85,8 +83,6 @@ class Client:
85
83
  transport=transport,
86
84
  trust_env=trust_env,
87
85
  )
88
- if instrument:
89
- HTTPXClientInstrumentor.instrument_client(self._client)
90
86
 
91
87
  @property
92
88
  def client(self) -> httpx.AsyncClient:
@@ -108,7 +104,7 @@ class Client:
108
104
  async def session(self, session_id: SessionId | None = None) -> AsyncGenerator[Self]:
109
105
  session_id = session_id or uuid.uuid4()
110
106
  with get_tracer().start_as_current_span("session", attributes={"acp.session": str(session_id)}):
111
- yield Client(client=self._client, session_id=session_id, instrument=False)
107
+ yield Client(client=self._client, session_id=session_id)
112
108
 
113
109
  async def agents(self) -> AsyncIterator[Agent]:
114
110
  response = await self._client.get("/agents")
acp_sdk/server/app.py CHANGED
@@ -9,7 +9,6 @@ from fastapi import Depends, FastAPI, HTTPException, status
9
9
  from fastapi.applications import AppType, Lifespan
10
10
  from fastapi.encoders import jsonable_encoder
11
11
  from fastapi.responses import JSONResponse, StreamingResponse
12
- from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
13
12
 
14
13
  from acp_sdk.models import (
15
14
  Agent as AgentModel,
@@ -75,8 +74,6 @@ def create_app(
75
74
  dependencies=dependencies,
76
75
  )
77
76
 
78
- FastAPIInstrumentor.instrument_app(app)
79
-
80
77
  agents: dict[AgentName, Agent] = {agent.name: agent for agent in agents}
81
78
  runs: TTLCache[RunId, RunBundle] = TTLCache(maxsize=run_limit, ttl=run_ttl, timer=datetime.now)
82
79
  sessions: TTLCache[SessionId, Session] = TTLCache(maxsize=run_limit, ttl=run_ttl, timer=datetime.now)
acp_sdk/server/server.py CHANGED
@@ -118,13 +118,15 @@ class Server:
118
118
 
119
119
  import uvicorn
120
120
 
121
+ app = create_app(*self.agents, lifespan=self.lifespan, run_limit=run_limit, run_ttl=run_ttl)
122
+
121
123
  if configure_logger:
122
124
  configure_logger_func()
123
125
  if configure_telemetry:
124
- configure_telemetry_func()
126
+ configure_telemetry_func(app)
125
127
 
126
128
  config = uvicorn.Config(
127
- create_app(*self.agents, lifespan=self.lifespan, run_limit=run_limit, run_ttl=run_ttl),
129
+ app,
128
130
  host,
129
131
  port,
130
132
  uds,
@@ -1,9 +1,11 @@
1
1
  import logging
2
2
 
3
+ from fastapi import FastAPI
3
4
  from opentelemetry import metrics, trace
4
5
  from opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter
5
6
  from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter
6
7
  from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
8
+ from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
7
9
  from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler
8
10
  from opentelemetry.sdk._logs.export import BatchLogRecordProcessor
9
11
  from opentelemetry.sdk.metrics import MeterProvider
@@ -22,8 +24,10 @@ from acp_sdk.version import __version__
22
24
  root_logger = logging.getLogger()
23
25
 
24
26
 
25
- def configure_telemetry() -> None:
26
- """Utility that configures opentelemetry with OTLP exporter"""
27
+ def configure_telemetry(app: FastAPI) -> None:
28
+ """Utility that configures opentelemetry with OTLP exporter and FastAPI instrumentation"""
29
+
30
+ FastAPIInstrumentor.instrument_app(app)
27
31
 
28
32
  resource = Resource(
29
33
  attributes={
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: acp-sdk
3
- Version: 0.9.0
3
+ Version: 0.9.1
4
4
  Summary: Agent Communication Protocol SDK
5
5
  Author: IBM Corp.
6
6
  Maintainer-email: Tomas Pilar <thomas7pilar@gmail.com>
@@ -3,7 +3,7 @@ acp_sdk/instrumentation.py,sha256=JqSyvILN3sGAfOZrmckQq4-M_4_5alyPn95DK0o5lfA,16
3
3
  acp_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  acp_sdk/version.py,sha256=Niy83rgvigB4hL_rR-O4ySvI7dj6xnqkyOe_JTymi9s,73
5
5
  acp_sdk/client/__init__.py,sha256=Bca1DORrswxzZsrR2aUFpATuNG2xNSmYvF1Z2WJaVbc,51
6
- acp_sdk/client/client.py,sha256=xQWBVJZuT7JmPS3dw6W1CidT9Uqi-XqZ6R-Xj04IefA,8718
6
+ acp_sdk/client/client.py,sha256=7GVD7eVlaSU78O3puMlyoOTqKjTwZYaBKLHyYvbvr3I,8504
7
7
  acp_sdk/client/types.py,sha256=_H6zYt-2OHOOYRtssRnbDIiwmgsl2-KIXc9lb-mJLFA,133
8
8
  acp_sdk/client/utils.py,sha256=2jhJyrPJmVFRoDJh0q_JMqOMlC3IxCh-6HXed-PIZS8,924
9
9
  acp_sdk/models/__init__.py,sha256=numSDBDT1QHx7n_Y3Deb5VOvKWcUBxbOEaMwQBSRHxc,151
@@ -12,16 +12,16 @@ acp_sdk/models/models.py,sha256=So5D9VjJxX2jdOF8BGc3f9D2ssbAyFEO2Rgr1KykI-M,7730
12
12
  acp_sdk/models/schemas.py,sha256=_ah7_zHsQJGxDXvnzsBvASdRsQHVphFQ7Sum6A04iRw,759
13
13
  acp_sdk/server/__init__.py,sha256=mxBBBFaZuMEUENRMLwp1XZkuLeT9QghcFmNvjnqvAAU,377
14
14
  acp_sdk/server/agent.py,sha256=6VBKn_qVXqUl79G8T7grwhnuLMwr67d4UGagMGX1hMs,6586
15
- acp_sdk/server/app.py,sha256=VR8UPR08SXebABvfvgdnjOR-mqV_Df8iSWdG_yG4wvg,7372
15
+ acp_sdk/server/app.py,sha256=ViumwzMngn63wtpFllu3nnIOt9JL9PQYrTcI8v-_uY4,7257
16
16
  acp_sdk/server/bundle.py,sha256=umD2GgDp17lUddu0adpp1zUcm1JJvDrDpIZ0uR-6VeY,7204
17
17
  acp_sdk/server/context.py,sha256=MgnLV6qcDIhc_0BjW7r4Jj1tHts4ZuwpdTGIBnz2Mgo,1036
18
18
  acp_sdk/server/errors.py,sha256=GSO8yYIqEeX8Y4Lz86ks35dMTHiQiXuOrLYYx0eXsbI,2110
19
19
  acp_sdk/server/logging.py,sha256=Oc8yZigCsuDnHHPsarRzu0RX3NKaLEgpELM2yovGKDI,411
20
- acp_sdk/server/server.py,sha256=BPFs5vFAvSL2Xq-446gJHuWmvr3xUdqMQu4OXD4JIU8,13599
20
+ acp_sdk/server/server.py,sha256=0thIxmqLV-hqwSqP_TUSZAl9pog06lROAQgnSIIabME,13621
21
21
  acp_sdk/server/session.py,sha256=ekz1o6Sy1tQZlpaoS_VgbvFuUQh2qpiHG71mvBdvhgc,662
22
- acp_sdk/server/telemetry.py,sha256=1BUxNg-xL_Vqgs27PDWNc3HikrQW2lidAtT_FKlp_Qk,1833
22
+ acp_sdk/server/telemetry.py,sha256=lbB2ppijUcqbHUOn0e-15LGcVvT_qrMguq8qBokICac,2016
23
23
  acp_sdk/server/types.py,sha256=gLb5wCkMYhmu2laj_ymK-TPfN9LSjRgKOP1H_893UzA,304
24
24
  acp_sdk/server/utils.py,sha256=BhZKBNaLgczX6aYjxYva-6VI1bKmHtYQ5YDA5LrwF50,1831
25
- acp_sdk-0.9.0.dist-info/METADATA,sha256=p92B6qlLrhgAxulgcoBn7GBJP-TaQZ8MjsMgyO-L6EY,1650
26
- acp_sdk-0.9.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
27
- acp_sdk-0.9.0.dist-info/RECORD,,
25
+ acp_sdk-0.9.1.dist-info/METADATA,sha256=fdUTU2kHk-OakxDoaTCLUagieJuM8DjsKZiFsOzDEK8,1650
26
+ acp_sdk-0.9.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
27
+ acp_sdk-0.9.1.dist-info/RECORD,,