agent-dev-cli 0.0.1b251223__tar.gz → 0.0.1b260107__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.
Files changed (20) hide show
  1. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/PKG-INFO +22 -20
  2. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/README.md +20 -14
  3. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/pyproject.toml +11 -8
  4. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/__init__.py +2 -2
  5. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/_hooks.py +1 -2
  6. agent_dev_cli-0.0.1b260107/src/agentdev/_version.py +2 -0
  7. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/backend/code_analyzer.py +5 -4
  8. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/backend/event_mapper.py +17 -4
  9. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/backend/server.py +11 -10
  10. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/backend/structs/entity_response.py +0 -1
  11. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/backend/structs/request.py +1 -1
  12. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/cli.py +2 -3
  13. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/localdebug.py +6 -7
  14. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/__main__.py +0 -0
  15. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/_bootstrap.py +0 -0
  16. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/backend/__init__.py +0 -0
  17. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/backend/_conversations.py +0 -0
  18. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/backend/_utils.py +0 -0
  19. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/backend/errors.py +0 -0
  20. {agent_dev_cli-0.0.1b251223 → agent_dev_cli-0.0.1b260107}/src/agentdev/backend/structs/__init__.py +0 -0
@@ -1,8 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-dev-cli
3
- Version: 0.0.1b251223
3
+ Version: 0.0.1b260107
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
8
9
  Classifier: Development Status :: 4 - Beta
@@ -27,26 +28,23 @@ Requires-Dist: azure-ai-agentserver-agentframework>=1.0.0b7
27
28
  Requires-Dist: azure-ai-agentserver-core>=1.0.0b7
28
29
  Requires-Dist: click>=8.1.0
29
30
  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
31
  Project-URL: Documentation, https://github.com/microsoft/vscode-ai-toolkit#readme
35
32
  Project-URL: Homepage, https://github.com/microsoft/vscode-ai-toolkit
36
33
  Project-URL: Issues, https://github.com/microsoft/vscode-ai-toolkit/issues
37
34
  Project-URL: Repository, https://github.com/microsoft/vscode-ai-toolkit
38
- Provides-Extra: dev
39
35
 
40
36
  # Agent Dev CLI
41
37
 
42
- Agent Dev CLI - A Python package for agent debugging and workflow visualization with VS Code integration.
38
+ A Python CLI and SDK for agent debugging and workflow visualization with VS Code AI Toolkit integration.
43
39
 
44
40
  ## Installation
45
41
 
46
42
  ```bash
47
- pip install -e .
43
+ pip install agent-dev-cli --pre
48
44
  ```
49
45
 
46
+ > **Note**: This package is currently in beta. The `--pre` flag is required to install pre-release versions.
47
+
50
48
  ## Usage
51
49
 
52
50
  ### Option 1: CLI Wrapper (Recommended)
@@ -103,7 +101,7 @@ Run a Python agent script with agentdev instrumentation.
103
101
  agentdev run [OPTIONS] SCRIPT [ARGS]...
104
102
 
105
103
  Options:
106
- -p, --port INTEGER Agent server port (default: 8088)
104
+ -p, --port INTEGER Agent server port (default: 8087)
107
105
  -v, --verbose Enable verbose output
108
106
  --help Show this message and exit
109
107
  ```
@@ -122,22 +120,26 @@ agentdev info
122
120
  - **Workflow Visualization**: Starts a visualization server on port 8090 for WorkflowAgent instances
123
121
  - **Easy Integration**: Simple one-function setup
124
122
 
123
+ ## Testing Your Agent Server
124
+
125
+ Once your agent server is running, you can test it using curl:
126
+
127
+ ```bash
128
+ # Health check
129
+ curl http://localhost:8087/agentdev/health
130
+
131
+ # Send a request to your agent (streaming)
132
+ curl 'http://localhost:8087/agentdev/v1/responses' \
133
+ -H 'Content-Type: application/json' \
134
+ -d '{"model":"your-agent-model-id","input":{"role":"user","text":"Hello!"},"stream":true}'
135
+ ```
136
+
125
137
  ## Requirements
126
138
 
127
139
  - Python 3.10+
128
- - agent-framework
129
- - starlette
140
+ - [VS Code AI Toolkit](https://marketplace.visualstudio.com/items?itemName=ms-windows-ai-studio.windows-ai-studio) (for visualization)
130
141
 
131
142
  ## License
132
143
 
133
144
  MIT License
134
145
 
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
- Agent Dev CLI - A Python package for agent debugging and workflow visualization with VS Code integration.
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 -e .
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: 8088)
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
- - agent-framework
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,12 @@
1
1
  [project]
2
2
  name = "agent-dev-cli"
3
- version = "0.0.1b251223"
3
+ dynamic = ["version"]
4
4
  description = "AI Toolkit - CLI and SDK for agent debugging and workflow visualization"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10.0"
7
+ authors = [
8
+ { name = "Microsoft", email = "aitkfeedback@microsoft.com" }
9
+ ]
7
10
  keywords = ["ai", "agent", "toolkit", "debugging", "workflow", "visualization"]
8
11
  classifiers = [
9
12
  "Development Status :: 4 - Beta",
@@ -32,13 +35,7 @@ dependencies = [
32
35
  "azure-ai-projects>=2.0.0b2",
33
36
  ]
34
37
 
35
- [project.urls]
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]
38
+ [dependency-groups]
42
39
  dev = [
43
40
  "pytest>=8.0.0",
44
41
  "pytest-asyncio>=0.23.0",
@@ -46,6 +43,12 @@ dev = [
46
43
  "httpx>=0.27.0",
47
44
  ]
48
45
 
46
+ [project.urls]
47
+ Homepage = "https://github.com/microsoft/vscode-ai-toolkit"
48
+ Repository = "https://github.com/microsoft/vscode-ai-toolkit"
49
+ Documentation = "https://github.com/microsoft/vscode-ai-toolkit#readme"
50
+ Issues = "https://github.com/microsoft/vscode-ai-toolkit/issues"
51
+
49
52
  [project.scripts]
50
53
  agentdev = "agentdev.cli:main"
51
54
 
@@ -17,6 +17,6 @@ This package provides two ways to use agentdev:
17
17
  """
18
18
 
19
19
  from .localdebug import setup_test_tool
20
+ from ._version import __version__
20
21
 
21
- __version__ = "0.0.1b251223"
22
- __all__ = ["setup_test_tool"]
22
+ __all__ = ["setup_test_tool", "__version__"]
@@ -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 (standard way) instead of __builtins__ (implementation detail)
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):
@@ -0,0 +1,2 @@
1
+ """Version information for agentdev package."""
2
+ __version__ = "0.0.1b260107"
@@ -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
- print(f"Class {cls} defined in {file_path} at line {line_number}")
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
- print(f"Could not get location for class {cls}: {e}")
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
- print(f"Function {func.__name__} defined in {file_path} at line {line_number}")
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
- print(f"Could not get location for function {func}: {e}")
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:
@@ -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":"msg_a6a8c564",
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
- print("Unknown content: " + str(type(content)), file=sys.stderr)
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
- print("Unknown event: " + type(event))
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 type(input_data) == dict else input_data[0])
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 type(c) == dict:
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 type(input_raw) != dict and type(input_raw) != list:
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: ", agent_framework_event.to_json())
198
+ logging.debug("Emit agent framework event: " + str(agent_framework_event.to_json()))
198
199
  else:
199
- logging.debug("Emit agent framework event: ", 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 contain agents only support a single agent / workflow for now, we can just return the first one.
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
- print(f"WebSocket error: {e}")
259
+ logging.error(f"WebSocket error: {e}")
259
260
  try:
260
261
  await websocket.close()
261
- except:
262
- pass
262
+ except Exception as close_error:
263
+ logging.debug("Error while closing websocket after failure: %s", close_error)
@@ -1,6 +1,5 @@
1
1
  from agent_framework import AgentProtocol, Workflow
2
2
  from pydantic import BaseModel
3
- from typing import Any
4
3
 
5
4
  class EntityResponse(BaseModel):
6
5
 
@@ -1,5 +1,5 @@
1
1
  from pydantic import BaseModel, ConfigDict
2
- from typing import Any, Literal
2
+ from typing import Any
3
3
 
4
4
  # Agent Framework Request Model - Extending real OpenAI types
5
5
  class AgentFrameworkRequest(BaseModel):
@@ -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=8088,
51
+ default=8087,
53
52
  type=int,
54
- help='Agent server port (default: 8088)'
53
+ help='Agent server port (default: 8087)'
55
54
  )
56
55
  @click.option(
57
56
  '--verbose', '-v',
@@ -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 os
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 type(agent) == WorkflowAgent:
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 show_endspattern():
57
+ def show_startup_message():
59
58
  time.sleep(2)
60
- print("agentdev: Application startup complete")
61
- thread = Thread(target=show_endspattern)
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
- print(agent)
64
+ logging.debug("Agent server configured: %s", agent)