acp-sdk 0.6.0__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/PKG-INFO +1 -1
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/docs/client.md +1 -1
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/pyproject.toml +1 -1
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/client/client.py +3 -3
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/models/models.py +1 -1
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/models/schemas.py +1 -1
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/server/app.py +1 -1
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/server/bundle.py +5 -5
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/server/session.py +1 -1
- acp_sdk-0.7.0/tests/e2e/test_suites/test_discovery.py +18 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/tests/e2e/test_suites/test_runs.py +15 -15
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/tests/unit/client/test_client.py +1 -1
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/.gitignore +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/.python-version +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/README.md +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/docs/_sidebar.md +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/docs/index.html +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/docs/models.md +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/docs/server.md +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/pytest.ini +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/__init__.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/client/__init__.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/instrumentation.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/models/__init__.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/models/errors.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/py.typed +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/server/__init__.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/server/agent.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/server/context.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/server/errors.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/server/logging.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/server/server.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/server/telemetry.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/server/types.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/server/utils.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/src/acp_sdk/version.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/tests/conftest.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/tests/e2e/__init__.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/tests/e2e/config.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/tests/e2e/fixtures/__init__.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/tests/e2e/fixtures/client.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/tests/e2e/fixtures/server.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/tests/e2e/test_suites/__init__.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/tests/unit/models/__init__.py +0 -0
- {acp_sdk-0.6.0 → acp_sdk-0.7.0}/tests/unit/models/test_models.py +0 -0
@@ -76,7 +76,7 @@ async with Client(base_url="http://localhost:8000") as client:
|
|
76
76
|
|
77
77
|
# Sync - waits for completion, failure, cancellation or await
|
78
78
|
run = await client.run_sync(agent_name="agent", inputs=[message])
|
79
|
-
print(run.
|
79
|
+
print(run.output)
|
80
80
|
|
81
81
|
# Stream - as sync but also receives events
|
82
82
|
async for event in client.run_stream(agent_name="agent", inputs=[message])
|
@@ -127,7 +127,7 @@ class Client:
|
|
127
127
|
"/runs",
|
128
128
|
content=RunCreateRequest(
|
129
129
|
agent_name=agent,
|
130
|
-
|
130
|
+
input=self._unify_inputs(input),
|
131
131
|
mode=RunMode.SYNC,
|
132
132
|
session_id=self._session_id,
|
133
133
|
).model_dump_json(),
|
@@ -142,7 +142,7 @@ class Client:
|
|
142
142
|
"/runs",
|
143
143
|
content=RunCreateRequest(
|
144
144
|
agent_name=agent,
|
145
|
-
|
145
|
+
input=self._unify_inputs(input),
|
146
146
|
mode=RunMode.ASYNC,
|
147
147
|
session_id=self._session_id,
|
148
148
|
).model_dump_json(),
|
@@ -159,7 +159,7 @@ class Client:
|
|
159
159
|
"/runs",
|
160
160
|
content=RunCreateRequest(
|
161
161
|
agent_name=agent,
|
162
|
-
|
162
|
+
input=self._unify_inputs(input),
|
163
163
|
mode=RunMode.STREAM,
|
164
164
|
session_id=self._session_id,
|
165
165
|
).model_dump_json(),
|
@@ -105,7 +105,7 @@ def create_app(*agents: Agent, run_limit: int = 1000, run_ttl: timedelta = timed
|
|
105
105
|
bundle = RunBundle(
|
106
106
|
agent=agent,
|
107
107
|
run=Run(agent_name=agent.name, session_id=session.id),
|
108
|
-
inputs=request.
|
108
|
+
inputs=request.input,
|
109
109
|
history=list(session.history()),
|
110
110
|
executor=executor,
|
111
111
|
)
|
@@ -92,7 +92,7 @@ class RunBundle:
|
|
92
92
|
async def flush_message() -> None:
|
93
93
|
nonlocal in_message
|
94
94
|
if in_message:
|
95
|
-
await self.emit(MessageCompletedEvent(message=self.run.
|
95
|
+
await self.emit(MessageCompletedEvent(message=self.run.output[-1]))
|
96
96
|
in_message = False
|
97
97
|
|
98
98
|
try:
|
@@ -114,14 +114,14 @@ class RunBundle:
|
|
114
114
|
if isinstance(next, str):
|
115
115
|
next = MessagePart(content=next)
|
116
116
|
if not in_message:
|
117
|
-
self.run.
|
117
|
+
self.run.output.append(Message(parts=[]))
|
118
118
|
in_message = True
|
119
|
-
await self.emit(MessageCreatedEvent(message=self.run.
|
120
|
-
self.run.
|
119
|
+
await self.emit(MessageCreatedEvent(message=self.run.output[-1]))
|
120
|
+
self.run.output[-1].parts.append(next)
|
121
121
|
await self.emit(MessagePartEvent(part=next))
|
122
122
|
elif isinstance(next, Message):
|
123
123
|
await flush_message()
|
124
|
-
self.run.
|
124
|
+
self.run.output.append(next)
|
125
125
|
await self.emit(MessageCreatedEvent(message=next))
|
126
126
|
for part in next.parts:
|
127
127
|
await self.emit(MessagePartEvent(part=part))
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import pytest
|
2
|
+
from acp_sdk.client import Client
|
3
|
+
from acp_sdk.models import Agent
|
4
|
+
from acp_sdk.server import Server
|
5
|
+
|
6
|
+
|
7
|
+
@pytest.mark.asyncio
|
8
|
+
async def test_agents_list(server: Server, client: Client) -> None:
|
9
|
+
async for agent in client.agents():
|
10
|
+
assert isinstance(agent, Agent)
|
11
|
+
|
12
|
+
|
13
|
+
@pytest.mark.asyncio
|
14
|
+
async def test_agents_details(server: Server, client: Client) -> None:
|
15
|
+
agent_name = "echo"
|
16
|
+
agent = await client.agent(name=agent_name)
|
17
|
+
assert isinstance(agent, Agent)
|
18
|
+
assert agent.name == agent_name
|
@@ -27,7 +27,7 @@ await_resume = MessageAwaitResume(message=Message(parts=[]))
|
|
27
27
|
async def test_run_sync(server: Server, client: Client) -> None:
|
28
28
|
run = await client.run_sync(agent="echo", input=inputs)
|
29
29
|
assert run.status == RunStatus.COMPLETED
|
30
|
-
assert run.
|
30
|
+
assert run.output == inputs
|
31
31
|
|
32
32
|
|
33
33
|
@pytest.mark.asyncio
|
@@ -102,18 +102,18 @@ async def test_run_resume_stream(server: Server, client: Client) -> None:
|
|
102
102
|
async def test_run_session(server: Server, client: Client) -> None:
|
103
103
|
async with client.session() as session:
|
104
104
|
run = await session.run_sync(agent="echo", input=inputs)
|
105
|
-
assert run.
|
105
|
+
assert run.output == inputs
|
106
106
|
run = await session.run_sync(agent="echo", input=inputs)
|
107
|
-
assert run.
|
107
|
+
assert run.output == inputs + inputs + inputs
|
108
108
|
|
109
109
|
|
110
110
|
@pytest.mark.asyncio
|
111
111
|
async def test_mime_types(server: Server, client: Client) -> None:
|
112
112
|
run = await client.run_sync(agent="mime_types", input=inputs)
|
113
113
|
assert run.status == RunStatus.COMPLETED
|
114
|
-
assert len(run.
|
114
|
+
assert len(run.output) == 1
|
115
115
|
|
116
|
-
message_parts = run.
|
116
|
+
message_parts = run.output[0].parts
|
117
117
|
content_types = [part.content_type for part in message_parts]
|
118
118
|
|
119
119
|
assert "text/html" in content_types
|
@@ -132,9 +132,9 @@ async def test_mime_types(server: Server, client: Client) -> None:
|
|
132
132
|
async def test_base64_encoding(server: Server, client: Client) -> None:
|
133
133
|
run = await client.run_sync(agent="base64_encoding", input=inputs)
|
134
134
|
assert run.status == RunStatus.COMPLETED
|
135
|
-
assert len(run.
|
135
|
+
assert len(run.output) == 1
|
136
136
|
|
137
|
-
message_parts = run.
|
137
|
+
message_parts = run.output[0].parts
|
138
138
|
assert len(message_parts) == 2
|
139
139
|
|
140
140
|
base64_part = next((part for part in message_parts if part.content_encoding == "base64"), None)
|
@@ -153,14 +153,14 @@ async def test_artifacts(server: Server, client: Client) -> None:
|
|
153
153
|
run = await client.run_sync(agent="artifact_producer", input=inputs)
|
154
154
|
assert run.status == RunStatus.COMPLETED
|
155
155
|
|
156
|
-
assert len(run.
|
157
|
-
assert run.
|
156
|
+
assert len(run.output) == 1
|
157
|
+
assert run.output[0].parts[0].content == "Processing with artifacts"
|
158
158
|
|
159
|
-
assert len(run.
|
159
|
+
assert len(run.output[0].parts) == 4
|
160
160
|
|
161
|
-
text_artifact = next((a for a in run.
|
162
|
-
json_artifact = next((a for a in run.
|
163
|
-
image_artifact = next((a for a in run.
|
161
|
+
text_artifact = next((a for a in run.output[0].parts if a.name == "text-result.txt"), None)
|
162
|
+
json_artifact = next((a for a in run.output[0].parts if a.name == "data.json"), None)
|
163
|
+
image_artifact = next((a for a in run.output[0].parts if a.name == "image.png"), None)
|
164
164
|
|
165
165
|
assert text_artifact is not None
|
166
166
|
assert text_artifact.content_type == "text/plain"
|
@@ -221,7 +221,7 @@ async def test_session_ttl(server: Server, client: Client) -> None:
|
|
221
221
|
run = await session.run_sync(agent="echo", input=inputs)
|
222
222
|
await asyncio.sleep(3)
|
223
223
|
run = await session.run_sync(agent="echo", input=inputs)
|
224
|
-
assert len(run.
|
224
|
+
assert len(run.output) == 3
|
225
225
|
await asyncio.sleep(3)
|
226
226
|
run = await session.run_sync(agent="echo", input=inputs)
|
227
|
-
assert len(run.
|
227
|
+
assert len(run.output) == 7 # First run shall be forgotten
|
@@ -3,7 +3,7 @@ from acp_sdk.client import Client
|
|
3
3
|
from acp_sdk.models import Message, MessagePart, Run, RunCompletedEvent
|
4
4
|
from pytest_httpx import HTTPXMock
|
5
5
|
|
6
|
-
mock_run = Run(agent_name="mock",
|
6
|
+
mock_run = Run(agent_name="mock", output=[Message(parts=[MessagePart(content="Hello!")])])
|
7
7
|
|
8
8
|
|
9
9
|
@pytest.mark.asyncio
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|