acp-sdk 0.2.2__tar.gz → 0.2.3__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.2.2 → acp_sdk-0.2.3}/PKG-INFO +1 -1
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/examples/clients/simple.py +1 -1
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/pyproject.toml +1 -1
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/server/bundle.py +8 -3
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/tests/e2e/fixtures/server.py +2 -2
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/tests/e2e/test_suites/test_runs.py +3 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/.gitignore +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/.python-version +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/README.md +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/examples/clients/advanced.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/examples/clients/session.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/examples/clients/stream.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/examples/servers/awaiting.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/examples/servers/echo.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/examples/servers/standalone.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/pytest.ini +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/__init__.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/client/__init__.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/client/client.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/models/__init__.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/models/errors.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/models/models.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/models/schemas.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/py.typed +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/server/__init__.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/server/agent.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/server/app.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/server/context.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/server/errors.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/server/logging.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/server/server.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/server/session.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/server/telemetry.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/server/types.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/server/utils.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/src/acp_sdk/version.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/tests/conftest.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/tests/e2e/__init__.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/tests/e2e/config.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/tests/e2e/fixtures/__init__.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/tests/e2e/fixtures/client.py +0 -0
- {acp_sdk-0.2.2 → acp_sdk-0.2.3}/tests/e2e/test_suites/__init__.py +0 -0
@@ -6,14 +6,18 @@ from concurrent.futures import ThreadPoolExecutor
|
|
6
6
|
from pydantic import ValidationError
|
7
7
|
|
8
8
|
from acp_sdk.models import (
|
9
|
+
ACPError,
|
9
10
|
AnyModel,
|
10
11
|
AwaitRequest,
|
11
12
|
AwaitResume,
|
12
13
|
Error,
|
14
|
+
ErrorCode,
|
13
15
|
Event,
|
14
16
|
GenericEvent,
|
15
17
|
Message,
|
18
|
+
MessageCompletedEvent,
|
16
19
|
MessageCreatedEvent,
|
20
|
+
MessagePart,
|
17
21
|
MessagePartEvent,
|
18
22
|
Run,
|
19
23
|
RunAwaitingEvent,
|
@@ -24,8 +28,6 @@ from acp_sdk.models import (
|
|
24
28
|
RunInProgressEvent,
|
25
29
|
RunStatus,
|
26
30
|
)
|
27
|
-
from acp_sdk.models.errors import ErrorCode
|
28
|
-
from acp_sdk.models.models import MessageCompletedEvent, MessagePart
|
29
31
|
from acp_sdk.server.agent import Agent
|
30
32
|
from acp_sdk.server.logging import logger
|
31
33
|
from acp_sdk.server.telemetry import get_tracer
|
@@ -142,7 +144,10 @@ class RunBundle:
|
|
142
144
|
await self.emit(RunCancelledEvent(run=self.run))
|
143
145
|
run_logger.info("Run cancelled")
|
144
146
|
except Exception as e:
|
145
|
-
|
147
|
+
if isinstance(e, ACPError):
|
148
|
+
self.run.error = e.error
|
149
|
+
else:
|
150
|
+
self.run.error = Error(code=ErrorCode.SERVER_ERROR, message=str(e))
|
146
151
|
self.run.status = RunStatus.FAILED
|
147
152
|
await self.emit(RunFailedEvent(run=self.run))
|
148
153
|
run_logger.exception("Run failed")
|
@@ -4,7 +4,7 @@ from collections.abc import AsyncGenerator, AsyncIterator, Generator
|
|
4
4
|
from threading import Thread
|
5
5
|
|
6
6
|
import pytest
|
7
|
-
from acp_sdk.models import Artifact, AwaitRequest, AwaitResume, Message, MessagePart
|
7
|
+
from acp_sdk.models import ACPError, Artifact, AwaitRequest, AwaitResume, Error, ErrorCode, Message, MessagePart
|
8
8
|
from acp_sdk.server import Context, Server
|
9
9
|
|
10
10
|
from e2e.config import Config
|
@@ -26,7 +26,7 @@ def server() -> Generator[None]:
|
|
26
26
|
|
27
27
|
@server.agent()
|
28
28
|
async def failer(inputs: list[Message], context: Context) -> AsyncIterator[Message]:
|
29
|
-
raise
|
29
|
+
raise ACPError(Error(code=ErrorCode.INVALID_INPUT, message="Wrong question buddy!"))
|
30
30
|
|
31
31
|
@server.agent()
|
32
32
|
async def sessioner(inputs: list[Message], context: Context) -> AsyncIterator[Message]:
|
@@ -5,6 +5,7 @@ from acp_sdk.client import Client
|
|
5
5
|
from acp_sdk.models import (
|
6
6
|
ArtifactEvent,
|
7
7
|
AwaitResume,
|
8
|
+
ErrorCode,
|
8
9
|
Message,
|
9
10
|
MessageCreatedEvent,
|
10
11
|
MessagePart,
|
@@ -50,6 +51,8 @@ async def test_run_status(server: Server, client: Client) -> None:
|
|
50
51
|
async def test_failure(server: Server, client: Client) -> None:
|
51
52
|
run = await client.run_sync(agent="failer", inputs=inputs)
|
52
53
|
assert run.status == RunStatus.FAILED
|
54
|
+
assert run.error is not None
|
55
|
+
assert run.error.code == ErrorCode.INVALID_INPUT
|
53
56
|
|
54
57
|
|
55
58
|
@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
|
File without changes
|
File without changes
|
File without changes
|