agent-dev-cli 0.0.1b251223__tar.gz → 0.0.1b260112__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.
- agent_dev_cli-0.0.1b260112/LICENSE +40 -0
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/PKG-INFO +25 -20
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/README.md +20 -14
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/pyproject.toml +14 -8
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/__init__.py +2 -2
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/_hooks.py +1 -2
- agent_dev_cli-0.0.1b260112/src/agentdev/_version.py +2 -0
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/backend/code_analyzer.py +5 -4
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/backend/event_mapper.py +17 -4
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/backend/server.py +11 -10
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/backend/structs/entity_response.py +0 -1
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/backend/structs/request.py +1 -1
- agent_dev_cli-0.0.1b251223/src/agentdev/_bootstrap.py → agent_dev_cli-0.0.1b260112/src/agentdev/bootstrap.py +1 -1
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/cli.py +7 -4
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/localdebug.py +6 -7
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/__main__.py +0 -0
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/backend/__init__.py +0 -0
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/backend/_conversations.py +0 -0
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/backend/_utils.py +0 -0
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/backend/errors.py +0 -0
- {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/backend/structs/__init__.py +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Microsoft AI Toolkit – Agent Dev CLI License Terms
|
|
2
|
+
|
|
3
|
+
1. Scope and Applicability
|
|
4
|
+
These License Terms ("Terms") govern your use of the Agent Dev CLI software package, including all accompanying files, documentation, updates, and modifications (the "Software"). The Software is a component of Microsoft AI Toolkit for Visual Studio Code ("AI Toolkit") and is licensed, not sold.
|
|
5
|
+
These Terms supplement the license agreement applicable to AI Toolkit. In the event of a conflict, these Terms control solely with respect to the Software.
|
|
6
|
+
|
|
7
|
+
2. License Grant
|
|
8
|
+
Subject to your compliance with these Terms, Microsoft grants you a limited, non‑exclusive, non‑transferable, revocable license to install and use the Software solely in connection with the AI Toolkit for the purpose of developing, visualizing, debugging, and testing AI agents.
|
|
9
|
+
|
|
10
|
+
3. Restrictions
|
|
11
|
+
You may not, and may not permit others to:
|
|
12
|
+
Copy, modify, adapt, translate, or create derivative works of the Software
|
|
13
|
+
Reverse engineer, decompile, or disassemble the Software, except to the extent permitted by applicable law
|
|
14
|
+
Distribute, sublicense, rent, lease, lend, host, or provide the Software as a standalone offering
|
|
15
|
+
Use the Software independently of AI Toolkit or outside its intended development and debugging functionality
|
|
16
|
+
Remove, alter, or obscure any proprietary notices in the Software
|
|
17
|
+
|
|
18
|
+
4. Open Source Exclusion
|
|
19
|
+
The Software is not open source. No rights are granted under any open‑source license, and no obligation exists to make source code available.
|
|
20
|
+
|
|
21
|
+
5. Updates and Changes
|
|
22
|
+
Microsoft may update, modify, suspend, or discontinue the Software at any time without notice. Any updates provided are governed by these Terms unless Microsoft provides other terms with the update.
|
|
23
|
+
|
|
24
|
+
6. Feedback
|
|
25
|
+
If you provide feedback, suggestions, or recommendations regarding the Software, Microsoft may use them for any purpose without obligation to you.
|
|
26
|
+
|
|
27
|
+
7. Disclaimer of Warranties
|
|
28
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND "AS AVAILABLE." MICROSOFT DISCLAIMS ALL WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON‑INFRINGEMENT.
|
|
29
|
+
|
|
30
|
+
8. Limitation of Liability
|
|
31
|
+
TO THE MAXIMUM EXTENT PERMITTED BY LAW, MICROSOFT SHALL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, OR FOR LOSS OF DATA, PROFITS, OR BUSINESS INTERRUPTION, ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE.
|
|
32
|
+
|
|
33
|
+
9. Termination
|
|
34
|
+
Microsoft may terminate these Terms immediately if you breach them. Upon termination, you must cease all use of the Software and delete all copies in your possession or control.
|
|
35
|
+
|
|
36
|
+
10. Governing Law
|
|
37
|
+
These Terms are governed by the laws of the State of Washington, without regard to conflict‑of‑laws principles.
|
|
38
|
+
|
|
39
|
+
11. Entire Agreement
|
|
40
|
+
These Terms, together with the applicable AI Toolkit license agreement, constitute the entire agreement regarding the Software and supersede any prior agreements relating to it.
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agent-dev-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.1b260112
|
|
4
4
|
Summary: AI Toolkit - CLI and SDK for agent debugging and workflow visualization
|
|
5
5
|
Keywords: ai,agent,toolkit,debugging,workflow,visualization
|
|
6
|
+
Author-email: Microsoft <aitkfeedback@microsoft.com>
|
|
6
7
|
Requires-Python: >=3.10.0
|
|
7
8
|
Description-Content-Type: text/markdown
|
|
9
|
+
License-Expression: LicenseRef-Microsoft-AI-Toolkit-Agent-Dev-CLI
|
|
8
10
|
Classifier: Development Status :: 4 - Beta
|
|
9
11
|
Classifier: Intended Audience :: Developers
|
|
10
12
|
Classifier: Operating System :: OS Independent
|
|
@@ -13,9 +15,11 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
13
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
17
|
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
19
|
Classifier: Topic :: Software Development :: Debuggers
|
|
17
20
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
21
|
Classifier: Typing :: Typed
|
|
22
|
+
License-File: LICENSE
|
|
19
23
|
Requires-Dist: pydantic>=2.12.4
|
|
20
24
|
Requires-Dist: azure-identity>=1.25.1
|
|
21
25
|
Requires-Dist: python-dotenv>=1.2.1
|
|
@@ -27,26 +31,23 @@ Requires-Dist: azure-ai-agentserver-agentframework>=1.0.0b7
|
|
|
27
31
|
Requires-Dist: azure-ai-agentserver-core>=1.0.0b7
|
|
28
32
|
Requires-Dist: click>=8.1.0
|
|
29
33
|
Requires-Dist: azure-ai-projects>=2.0.0b2
|
|
30
|
-
Requires-Dist: pytest>=8.0.0 ; extra == "dev"
|
|
31
|
-
Requires-Dist: pytest-asyncio>=0.23.0 ; extra == "dev"
|
|
32
|
-
Requires-Dist: pytest-cov>=4.1.0 ; extra == "dev"
|
|
33
|
-
Requires-Dist: httpx>=0.27.0 ; extra == "dev"
|
|
34
34
|
Project-URL: Documentation, https://github.com/microsoft/vscode-ai-toolkit#readme
|
|
35
35
|
Project-URL: Homepage, https://github.com/microsoft/vscode-ai-toolkit
|
|
36
36
|
Project-URL: Issues, https://github.com/microsoft/vscode-ai-toolkit/issues
|
|
37
37
|
Project-URL: Repository, https://github.com/microsoft/vscode-ai-toolkit
|
|
38
|
-
Provides-Extra: dev
|
|
39
38
|
|
|
40
39
|
# Agent Dev CLI
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
A Python CLI and SDK for agent debugging and workflow visualization with VS Code AI Toolkit integration.
|
|
43
42
|
|
|
44
43
|
## Installation
|
|
45
44
|
|
|
46
45
|
```bash
|
|
47
|
-
pip install -
|
|
46
|
+
pip install agent-dev-cli --pre
|
|
48
47
|
```
|
|
49
48
|
|
|
49
|
+
> **Note**: This package is currently in beta. The `--pre` flag is required to install pre-release versions.
|
|
50
|
+
|
|
50
51
|
## Usage
|
|
51
52
|
|
|
52
53
|
### Option 1: CLI Wrapper (Recommended)
|
|
@@ -103,7 +104,7 @@ Run a Python agent script with agentdev instrumentation.
|
|
|
103
104
|
agentdev run [OPTIONS] SCRIPT [ARGS]...
|
|
104
105
|
|
|
105
106
|
Options:
|
|
106
|
-
-p, --port INTEGER Agent server port (default:
|
|
107
|
+
-p, --port INTEGER Agent server port (default: 8087)
|
|
107
108
|
-v, --verbose Enable verbose output
|
|
108
109
|
--help Show this message and exit
|
|
109
110
|
```
|
|
@@ -122,22 +123,26 @@ agentdev info
|
|
|
122
123
|
- **Workflow Visualization**: Starts a visualization server on port 8090 for WorkflowAgent instances
|
|
123
124
|
- **Easy Integration**: Simple one-function setup
|
|
124
125
|
|
|
126
|
+
## Testing Your Agent Server
|
|
127
|
+
|
|
128
|
+
Once your agent server is running, you can test it using curl:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Health check
|
|
132
|
+
curl http://localhost:8087/agentdev/health
|
|
133
|
+
|
|
134
|
+
# Send a request to your agent (streaming)
|
|
135
|
+
curl 'http://localhost:8087/agentdev/v1/responses' \
|
|
136
|
+
-H 'Content-Type: application/json' \
|
|
137
|
+
-d '{"model":"your-agent-model-id","input":{"role":"user","text":"Hello!"},"stream":true}'
|
|
138
|
+
```
|
|
139
|
+
|
|
125
140
|
## Requirements
|
|
126
141
|
|
|
127
142
|
- Python 3.10+
|
|
128
|
-
-
|
|
129
|
-
- starlette
|
|
143
|
+
- [VS Code AI Toolkit](https://marketplace.visualstudio.com/items?itemName=ms-windows-ai-studio.windows-ai-studio) (for visualization)
|
|
130
144
|
|
|
131
145
|
## License
|
|
132
146
|
|
|
133
147
|
MIT License
|
|
134
148
|
|
|
135
|
-
|
|
136
|
-
## Test
|
|
137
|
-
|
|
138
|
-
```bash
|
|
139
|
-
curl 'http://localhost:8088/agentdev/v1/responses' \
|
|
140
|
-
-H 'Content-Type: application/json' \
|
|
141
|
-
-d '{"model":"workflow_in-memory_content-review-workflow_5c703d16cb1e4756848ddcc685b16503","input":{"role":"user","text":"test"},"stream":true}'
|
|
142
|
-
```
|
|
143
|
-
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# Agent Dev CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A Python CLI and SDK for agent debugging and workflow visualization with VS Code AI Toolkit integration.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
pip install -
|
|
8
|
+
pip install agent-dev-cli --pre
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
> **Note**: This package is currently in beta. The `--pre` flag is required to install pre-release versions.
|
|
12
|
+
|
|
11
13
|
## Usage
|
|
12
14
|
|
|
13
15
|
### Option 1: CLI Wrapper (Recommended)
|
|
@@ -64,7 +66,7 @@ Run a Python agent script with agentdev instrumentation.
|
|
|
64
66
|
agentdev run [OPTIONS] SCRIPT [ARGS]...
|
|
65
67
|
|
|
66
68
|
Options:
|
|
67
|
-
-p, --port INTEGER Agent server port (default:
|
|
69
|
+
-p, --port INTEGER Agent server port (default: 8087)
|
|
68
70
|
-v, --verbose Enable verbose output
|
|
69
71
|
--help Show this message and exit
|
|
70
72
|
```
|
|
@@ -83,21 +85,25 @@ agentdev info
|
|
|
83
85
|
- **Workflow Visualization**: Starts a visualization server on port 8090 for WorkflowAgent instances
|
|
84
86
|
- **Easy Integration**: Simple one-function setup
|
|
85
87
|
|
|
88
|
+
## Testing Your Agent Server
|
|
89
|
+
|
|
90
|
+
Once your agent server is running, you can test it using curl:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Health check
|
|
94
|
+
curl http://localhost:8087/agentdev/health
|
|
95
|
+
|
|
96
|
+
# Send a request to your agent (streaming)
|
|
97
|
+
curl 'http://localhost:8087/agentdev/v1/responses' \
|
|
98
|
+
-H 'Content-Type: application/json' \
|
|
99
|
+
-d '{"model":"your-agent-model-id","input":{"role":"user","text":"Hello!"},"stream":true}'
|
|
100
|
+
```
|
|
101
|
+
|
|
86
102
|
## Requirements
|
|
87
103
|
|
|
88
104
|
- Python 3.10+
|
|
89
|
-
-
|
|
90
|
-
- starlette
|
|
105
|
+
- [VS Code AI Toolkit](https://marketplace.visualstudio.com/items?itemName=ms-windows-ai-studio.windows-ai-studio) (for visualization)
|
|
91
106
|
|
|
92
107
|
## License
|
|
93
108
|
|
|
94
109
|
MIT License
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
## Test
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
curl 'http://localhost:8088/agentdev/v1/responses' \
|
|
101
|
-
-H 'Content-Type: application/json' \
|
|
102
|
-
-d '{"model":"workflow_in-memory_content-review-workflow_5c703d16cb1e4756848ddcc685b16503","input":{"role":"user","text":"test"},"stream":true}'
|
|
103
|
-
```
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "agent-dev-cli"
|
|
3
|
-
|
|
3
|
+
dynamic = ["version"]
|
|
4
4
|
description = "AI Toolkit - CLI and SDK for agent debugging and workflow visualization"
|
|
5
5
|
readme = "README.md"
|
|
6
|
+
license = "LicenseRef-Microsoft-AI-Toolkit-Agent-Dev-CLI"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
6
8
|
requires-python = ">=3.10.0"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "Microsoft", email = "aitkfeedback@microsoft.com" }
|
|
11
|
+
]
|
|
7
12
|
keywords = ["ai", "agent", "toolkit", "debugging", "workflow", "visualization"]
|
|
8
13
|
classifiers = [
|
|
9
14
|
"Development Status :: 4 - Beta",
|
|
@@ -14,6 +19,7 @@ classifiers = [
|
|
|
14
19
|
"Programming Language :: Python :: 3.11",
|
|
15
20
|
"Programming Language :: Python :: 3.12",
|
|
16
21
|
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Programming Language :: Python :: 3.14",
|
|
17
23
|
"Topic :: Software Development :: Debuggers",
|
|
18
24
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
19
25
|
"Typing :: Typed",
|
|
@@ -32,13 +38,7 @@ dependencies = [
|
|
|
32
38
|
"azure-ai-projects>=2.0.0b2",
|
|
33
39
|
]
|
|
34
40
|
|
|
35
|
-
[
|
|
36
|
-
Homepage = "https://github.com/microsoft/vscode-ai-toolkit"
|
|
37
|
-
Repository = "https://github.com/microsoft/vscode-ai-toolkit"
|
|
38
|
-
Documentation = "https://github.com/microsoft/vscode-ai-toolkit#readme"
|
|
39
|
-
Issues = "https://github.com/microsoft/vscode-ai-toolkit/issues"
|
|
40
|
-
|
|
41
|
-
[project.optional-dependencies]
|
|
41
|
+
[dependency-groups]
|
|
42
42
|
dev = [
|
|
43
43
|
"pytest>=8.0.0",
|
|
44
44
|
"pytest-asyncio>=0.23.0",
|
|
@@ -46,6 +46,12 @@ dev = [
|
|
|
46
46
|
"httpx>=0.27.0",
|
|
47
47
|
]
|
|
48
48
|
|
|
49
|
+
[project.urls]
|
|
50
|
+
Homepage = "https://github.com/microsoft/vscode-ai-toolkit"
|
|
51
|
+
Repository = "https://github.com/microsoft/vscode-ai-toolkit"
|
|
52
|
+
Documentation = "https://github.com/microsoft/vscode-ai-toolkit#readme"
|
|
53
|
+
Issues = "https://github.com/microsoft/vscode-ai-toolkit/issues"
|
|
54
|
+
|
|
49
55
|
[project.scripts]
|
|
50
56
|
agentdev = "agentdev.cli:main"
|
|
51
57
|
|
|
@@ -172,7 +172,6 @@ def _install_post_import_hook() -> None:
|
|
|
172
172
|
|
|
173
173
|
# First, check if the module is already imported
|
|
174
174
|
target = "azure.ai.agentserver.agentframework"
|
|
175
|
-
target_parts = target.split(".")
|
|
176
175
|
|
|
177
176
|
if target in sys.modules:
|
|
178
177
|
if verbose:
|
|
@@ -188,7 +187,7 @@ def _install_post_import_hook() -> None:
|
|
|
188
187
|
print(f"agentdev Hook: Installed meta path finder", file=sys.stderr)
|
|
189
188
|
|
|
190
189
|
# Monkey-patch __import__ for more reliable interception
|
|
191
|
-
# Use the builtins module
|
|
190
|
+
# Use the builtins module, which is the standard way to access the __import__ function
|
|
192
191
|
original_import = builtins.__import__
|
|
193
192
|
|
|
194
193
|
def patched_import(name, globals=None, locals=None, fromlist=(), level=0):
|
{agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/backend/code_analyzer.py
RENAMED
|
@@ -3,6 +3,7 @@ from pydantic import BaseModel
|
|
|
3
3
|
from typing import Callable, Any
|
|
4
4
|
from agent_framework import FunctionExecutor, Executor
|
|
5
5
|
import os
|
|
6
|
+
import logging
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class CodeLocation(BaseModel):
|
|
@@ -14,22 +15,22 @@ def get_cls_location(obj: object) -> CodeLocation | None:
|
|
|
14
15
|
try:
|
|
15
16
|
file_path = inspect.getfile(cls)
|
|
16
17
|
line_number = inspect.getsourcelines(cls)[1]
|
|
17
|
-
|
|
18
|
+
logging.debug(f"Class {cls} defined in {file_path} at line {line_number}")
|
|
18
19
|
abs_path = os.path.abspath(file_path)
|
|
19
20
|
return CodeLocation(file_path=abs_path, line_number=line_number)
|
|
20
21
|
except Exception as e:
|
|
21
|
-
|
|
22
|
+
logging.debug(f"Could not get location for class {cls}: {e}")
|
|
22
23
|
return None
|
|
23
24
|
|
|
24
25
|
def get_func_location(func: Callable) -> CodeLocation | None:
|
|
25
26
|
try:
|
|
26
27
|
file_path = inspect.getfile(func)
|
|
27
28
|
line_number = inspect.getsourcelines(func)[1]
|
|
28
|
-
|
|
29
|
+
logging.debug(f"Function {func.__name__} defined in {file_path} at line {line_number}")
|
|
29
30
|
abs_path = os.path.abspath(file_path)
|
|
30
31
|
return CodeLocation(file_path=abs_path, line_number=line_number)
|
|
31
32
|
except Exception as e:
|
|
32
|
-
|
|
33
|
+
logging.debug(f"Could not get location for function {func}: {e}")
|
|
33
34
|
return None
|
|
34
35
|
|
|
35
36
|
def get_executor_location(executor: Any) -> CodeLocation | None:
|
{agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/backend/event_mapper.py
RENAMED
|
@@ -6,7 +6,7 @@ from datetime import datetime
|
|
|
6
6
|
import sys
|
|
7
7
|
import logging
|
|
8
8
|
|
|
9
|
-
from agent_framework import WorkflowEvent, WorkflowStartedEvent, WorkflowFailedEvent, WorkflowStatusEvent, WorkflowRunState, ExecutorEvent, AgentRunUpdateEvent, ExecutorInvokedEvent, ExecutorCompletedEvent, AgentRunResponseUpdate, FunctionCallContent, FunctionResultContent, TextContent
|
|
9
|
+
from agent_framework import WorkflowEvent, WorkflowStartedEvent, WorkflowFailedEvent, WorkflowStatusEvent, WorkflowRunState, WorkflowOutputEvent, ExecutorEvent, AgentRunUpdateEvent, ExecutorInvokedEvent, ExecutorCompletedEvent, AgentRunResponseUpdate, FunctionCallContent, FunctionResultContent, TextContent
|
|
10
10
|
|
|
11
11
|
from ._utils import serialize_data
|
|
12
12
|
from .structs.request import AgentFrameworkRequest
|
|
@@ -101,6 +101,19 @@ class EventMapper():
|
|
|
101
101
|
},
|
|
102
102
|
},
|
|
103
103
|
}]
|
|
104
|
+
elif isinstance(event, WorkflowOutputEvent):
|
|
105
|
+
# Map WorkflowOutputEvent to pass workflow output data to the webview
|
|
106
|
+
serialized_data = None
|
|
107
|
+
if event.data is not None:
|
|
108
|
+
try:
|
|
109
|
+
serialized_data = serialize_data(event.data)
|
|
110
|
+
except Exception as e:
|
|
111
|
+
logging.warning(f"Failed to serialize workflow output data: {e}")
|
|
112
|
+
serialized_data = str(event.data)
|
|
113
|
+
return [{
|
|
114
|
+
"type": "response.workflow_output",
|
|
115
|
+
"output": serialized_data,
|
|
116
|
+
}]
|
|
104
117
|
elif isinstance(event, WorkflowStatusEvent):
|
|
105
118
|
if event.state == WorkflowRunState.IN_PROGRESS:
|
|
106
119
|
event_type = "response.in_progress"
|
|
@@ -221,7 +234,7 @@ class EventMapper():
|
|
|
221
234
|
"output_index": ctx.output_index,
|
|
222
235
|
"item":{
|
|
223
236
|
"type":"message",
|
|
224
|
-
"id":
|
|
237
|
+
"id": ctx.item_id,
|
|
225
238
|
"content":[],
|
|
226
239
|
"role":"assistant",
|
|
227
240
|
"status":"in_progress"
|
|
@@ -288,14 +301,14 @@ class EventMapper():
|
|
|
288
301
|
}
|
|
289
302
|
)
|
|
290
303
|
else:
|
|
291
|
-
|
|
304
|
+
logging.warning("Unknown content: %s", type(content))
|
|
292
305
|
return results
|
|
293
306
|
|
|
294
307
|
def map_event(self, ctx: MapperContext, event: Any) -> list[dict]:
|
|
295
308
|
"""Map an Agent Framework event to OpenAI Responses API events"""
|
|
296
309
|
mapper = self._get_event_mapper(type(event))
|
|
297
310
|
if not mapper:
|
|
298
|
-
|
|
311
|
+
logging.warning("Unknown event: %s", type(event))
|
|
299
312
|
return []
|
|
300
313
|
|
|
301
314
|
return mapper(ctx, event)
|
|
@@ -50,7 +50,7 @@ class TestToolServer:
|
|
|
50
50
|
chat_message = self.openai_chat_message_to_agent_framework_chat_message(input_data)
|
|
51
51
|
return [chat_message]
|
|
52
52
|
elif expected_type == ChatMessage:
|
|
53
|
-
chat_message = self.openai_chat_message_to_agent_framework_chat_message(input_data if
|
|
53
|
+
chat_message = self.openai_chat_message_to_agent_framework_chat_message(input_data if isinstance(input_data, dict) else input_data[0])
|
|
54
54
|
return chat_message
|
|
55
55
|
else:
|
|
56
56
|
raise ExecutorInputNotSupported(f"Unsupported input type for conversion: {expected_type}")
|
|
@@ -65,7 +65,7 @@ class TestToolServer:
|
|
|
65
65
|
elif content:
|
|
66
66
|
contents = []
|
|
67
67
|
for c in content:
|
|
68
|
-
if
|
|
68
|
+
if isinstance(c, dict):
|
|
69
69
|
if c["type"] == "input_text":
|
|
70
70
|
result_content = {
|
|
71
71
|
"type": "text",
|
|
@@ -172,14 +172,15 @@ class TestToolServer:
|
|
|
172
172
|
|
|
173
173
|
# Extract input from the request
|
|
174
174
|
input_raw = request.input
|
|
175
|
-
if
|
|
175
|
+
if not isinstance(input_raw, (dict, list)):
|
|
176
176
|
raise RuntimeError("Only dict or list input type is supported in test tool server for now")
|
|
177
177
|
|
|
178
|
+
input_data = None
|
|
178
179
|
if isinstance(entity, Workflow):
|
|
179
|
-
start_executor_type = None
|
|
180
180
|
for input_type in entity.get_start_executor().input_types:
|
|
181
181
|
try:
|
|
182
182
|
input_data = self.convert_input_data(input_raw, input_type)
|
|
183
|
+
break
|
|
183
184
|
except ExecutorInputNotSupported:
|
|
184
185
|
continue
|
|
185
186
|
if input_data is None:
|
|
@@ -194,9 +195,9 @@ class TestToolServer:
|
|
|
194
195
|
try:
|
|
195
196
|
async for agent_framework_event in entity.run_stream(input_data):
|
|
196
197
|
if agent_framework_event and hasattr(agent_framework_event, "to_json"):
|
|
197
|
-
logging.debug("Emit agent framework event: "
|
|
198
|
+
logging.debug("Emit agent framework event: " + str(agent_framework_event.to_json()))
|
|
198
199
|
else:
|
|
199
|
-
logging.debug("Emit agent framework event: "
|
|
200
|
+
logging.debug("Emit agent framework event: " + str(agent_framework_event))
|
|
200
201
|
openai_events = self._events_mapper.map_event(ctx, agent_framework_event)
|
|
201
202
|
for openai_event in openai_events:
|
|
202
203
|
if openai_event:
|
|
@@ -206,7 +207,7 @@ class TestToolServer:
|
|
|
206
207
|
yield f"data: [DONE]\n\n"
|
|
207
208
|
|
|
208
209
|
def _get_entity(self, model_name: str) -> Workflow | AgentProtocol | None:
|
|
209
|
-
# Because
|
|
210
|
+
# Because current agents only support a single agent/workflow for now, we can just return the first one.
|
|
210
211
|
results = list(filter(lambda item: item.id == model_name, self._entities))
|
|
211
212
|
if not results:
|
|
212
213
|
return None
|
|
@@ -255,8 +256,8 @@ class TestToolServer:
|
|
|
255
256
|
except WebSocketDisconnect:
|
|
256
257
|
pass
|
|
257
258
|
except Exception as e:
|
|
258
|
-
|
|
259
|
+
logging.error(f"WebSocket error: {e}")
|
|
259
260
|
try:
|
|
260
261
|
await websocket.close()
|
|
261
|
-
except:
|
|
262
|
-
|
|
262
|
+
except Exception as close_error:
|
|
263
|
+
logging.debug("Error while closing websocket after failure: %s", close_error)
|
|
@@ -14,7 +14,6 @@ import os
|
|
|
14
14
|
import sys
|
|
15
15
|
import subprocess
|
|
16
16
|
from importlib.metadata import version as get_version
|
|
17
|
-
from typing import Optional
|
|
18
17
|
|
|
19
18
|
import click
|
|
20
19
|
|
|
@@ -49,9 +48,9 @@ def cli():
|
|
|
49
48
|
@click.argument('args', nargs=-1, type=click.UNPROCESSED)
|
|
50
49
|
@click.option(
|
|
51
50
|
'--port', '-p',
|
|
52
|
-
default=
|
|
51
|
+
default=8087,
|
|
53
52
|
type=int,
|
|
54
|
-
help='Agent server port (default:
|
|
53
|
+
help='Agent server port (default: 8087)'
|
|
55
54
|
)
|
|
56
55
|
@click.option(
|
|
57
56
|
'--verbose', '-v',
|
|
@@ -98,10 +97,14 @@ def run(
|
|
|
98
97
|
if verbose:
|
|
99
98
|
env['AGENTDEV_VERBOSE'] = '1'
|
|
100
99
|
|
|
100
|
+
# Use absolute path to bypass module resolution issues (e.g., Python 3.14 with debugpy).
|
|
101
|
+
# sys.path may not be properly inherited in subprocesses under debuggers/wrappers.
|
|
102
|
+
bootstrap_path = os.path.join(os.path.dirname(__file__), 'bootstrap.py')
|
|
103
|
+
|
|
101
104
|
# Build command to run the bootstrap module
|
|
102
105
|
cmd = [
|
|
103
106
|
sys.executable,
|
|
104
|
-
|
|
107
|
+
bootstrap_path,
|
|
105
108
|
script_path,
|
|
106
109
|
*args
|
|
107
110
|
]
|
|
@@ -5,8 +5,7 @@ This module provides functionality to set up workflow or agent visualization
|
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
from agent_framework import WorkflowAgent
|
|
8
|
-
import
|
|
9
|
-
import sys
|
|
8
|
+
import logging
|
|
10
9
|
import time
|
|
11
10
|
|
|
12
11
|
|
|
@@ -48,18 +47,18 @@ def setup_test_tool(agent_server):
|
|
|
48
47
|
|
|
49
48
|
# Prepare entities for visualization
|
|
50
49
|
entities = []
|
|
51
|
-
if
|
|
50
|
+
if isinstance(agent, WorkflowAgent):
|
|
52
51
|
entities.append(agent.workflow)
|
|
53
52
|
else:
|
|
54
53
|
entities.append(agent)
|
|
55
54
|
|
|
56
55
|
test_tool_server = TestToolServer(entities)
|
|
57
56
|
test_tool_server.mount_backend(app)
|
|
58
|
-
def
|
|
57
|
+
def show_startup_message():
|
|
59
58
|
time.sleep(2)
|
|
60
|
-
|
|
61
|
-
thread = Thread(target=
|
|
59
|
+
logging.info("agentdev: Application startup complete")
|
|
60
|
+
thread = Thread(target=show_startup_message)
|
|
62
61
|
thread.daemon = True
|
|
63
62
|
thread.start()
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
logging.debug("Agent server configured: %s", agent)
|
|
File without changes
|
|
File without changes
|
{agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/backend/_conversations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260112}/src/agentdev/backend/structs/__init__.py
RENAMED
|
File without changes
|