agent-dev-cli 0.0.1b260128__tar.gz → 0.0.1b260205__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 (22) hide show
  1. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/PKG-INFO +5 -5
  2. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/README.md +2 -2
  3. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/pyproject.toml +2 -2
  4. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/__init__.py +4 -4
  5. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/_hooks.py +4 -4
  6. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/_version.py +1 -1
  7. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/backend/event_mapper.py +38 -10
  8. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/backend/server.py +7 -0
  9. agent_dev_cli-0.0.1b260205/src/agentdev/localdebug.py +100 -0
  10. agent_dev_cli-0.0.1b260128/src/agentdev/localdebug.py +0 -64
  11. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/LICENSE +0 -0
  12. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/__main__.py +0 -0
  13. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/backend/__init__.py +0 -0
  14. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/backend/_conversations.py +0 -0
  15. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/backend/_utils.py +0 -0
  16. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/backend/code_analyzer.py +0 -0
  17. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/backend/errors.py +0 -0
  18. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/backend/structs/__init__.py +0 -0
  19. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/backend/structs/entity_response.py +0 -0
  20. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/backend/structs/request.py +0 -0
  21. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/bootstrap.py +0 -0
  22. {agent_dev_cli-0.0.1b260128 → agent_dev_cli-0.0.1b260205}/src/agentdev/cli.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-dev-cli
3
- Version: 0.0.1b260128
3
+ Version: 0.0.1b260205
4
4
  Summary: AI Toolkit - CLI and SDK for agent debugging and workflow visualization
5
5
  Keywords: ai,agent,toolkit,debugging,workflow,visualization
6
6
  Author-email: Microsoft <aitkfeedback@microsoft.com>
@@ -28,8 +28,8 @@ Requires-Dist: starlette>=0.49.3
28
28
  Requires-Dist: openai>=1.109.1
29
29
  Requires-Dist: agent-framework-azure-ai>=1.0.0b251211,<=1.0.0b260107
30
30
  Requires-Dist: agent-framework-core>=1.0.0b251211,<=1.0.0b260107
31
- Requires-Dist: azure-ai-agentserver-agentframework==1.0.0b7
32
- Requires-Dist: azure-ai-agentserver-core==1.0.0b7
31
+ Requires-Dist: azure-ai-agentserver-agentframework==1.0.0b10
32
+ Requires-Dist: azure-ai-agentserver-core==1.0.0b10
33
33
  Requires-Dist: click>=8.1.0
34
34
  Requires-Dist: azure-ai-projects>=2.0.0b2
35
35
  Project-URL: Documentation, https://github.com/microsoft/vscode-ai-toolkit#readme
@@ -79,7 +79,7 @@ The CLI automatically:
79
79
  If you prefer explicit control, you can integrate agentdev directly:
80
80
 
81
81
  ```python
82
- from agentdev import setup_test_tool
82
+ from agentdev import configure_agent_server
83
83
  from azure.ai.agentserver.agentframework import from_agent_framework
84
84
 
85
85
  # Create your agent
@@ -89,7 +89,7 @@ agent = build_agent(chat_client)
89
89
  agent_server = from_agent_framework(agent)
90
90
 
91
91
  # Setup workflow visualization
92
- setup_test_tool(agent_server)
92
+ configure_agent_server(agent_server)
93
93
 
94
94
  # Run the server
95
95
  await agent_server.run_async()
@@ -40,7 +40,7 @@ The CLI automatically:
40
40
  If you prefer explicit control, you can integrate agentdev directly:
41
41
 
42
42
  ```python
43
- from agentdev import setup_test_tool
43
+ from agentdev import configure_agent_server
44
44
  from azure.ai.agentserver.agentframework import from_agent_framework
45
45
 
46
46
  # Create your agent
@@ -50,7 +50,7 @@ agent = build_agent(chat_client)
50
50
  agent_server = from_agent_framework(agent)
51
51
 
52
52
  # Setup workflow visualization
53
- setup_test_tool(agent_server)
53
+ configure_agent_server(agent_server)
54
54
 
55
55
  # Run the server
56
56
  await agent_server.run_async()
@@ -33,8 +33,8 @@ dependencies = [
33
33
  "openai>=1.109.1",
34
34
  "agent-framework-azure-ai>=1.0.0b251211,<=1.0.0b260107",
35
35
  "agent-framework-core>=1.0.0b251211,<=1.0.0b260107",
36
- "azure-ai-agentserver-agentframework==1.0.0b7",
37
- "azure-ai-agentserver-core==1.0.0b7",
36
+ "azure-ai-agentserver-agentframework==1.0.0b10",
37
+ "azure-ai-agentserver-core==1.0.0b10",
38
38
  "click>=8.1.0",
39
39
  "azure-ai-projects>=2.0.0b2",
40
40
  ]
@@ -12,11 +12,11 @@ This package provides two ways to use agentdev:
12
12
 
13
13
  2. Programmatic API (Requires code modification):
14
14
 
15
- from agentdev import setup_test_tool
16
- setup_test_tool(agent_server)
15
+ from agentdev import configure_agent_server
16
+ configure_agent_server(agent_server)
17
17
  """
18
18
 
19
- from .localdebug import setup_test_tool
19
+ from .localdebug import configure_agent_server
20
20
  from ._version import __version__
21
21
 
22
- __all__ = ["setup_test_tool", "__version__"]
22
+ __all__ = ["configure_agent_server", "__version__"]
@@ -7,7 +7,7 @@ capabilities without requiring user code modifications.
7
7
 
8
8
  The hook intercepts:
9
9
  - `azure.ai.agentserver.agentframework.from_agent_framework()`
10
- to automatically call `setup_test_tool()` on the created server.
10
+ to automatically call `configure_agent_server()` on the created server.
11
11
  """
12
12
 
13
13
  import sys
@@ -31,7 +31,7 @@ def _create_patched_from_agent_framework(original_func: Callable) -> Callable:
31
31
  original_func: The original from_agent_framework function
32
32
 
33
33
  Returns:
34
- Patched function that calls setup_test_tool automatically
34
+ Patched function that calls configure_agent_server automatically
35
35
  """
36
36
  @functools.wraps(original_func)
37
37
  def patched_from_agent_framework(agent: Any, **kwargs) -> Any:
@@ -48,8 +48,8 @@ def _create_patched_from_agent_framework(original_func: Callable) -> Callable:
48
48
 
49
49
  # Auto-inject agentdev visualization
50
50
  try:
51
- from agentdev.localdebug import setup_test_tool
52
- setup_test_tool(server)
51
+ from agentdev.localdebug import configure_agent_server
52
+ configure_agent_server(server)
53
53
 
54
54
  if verbose:
55
55
  print(f"agentdev Hook: Successfully injected agentdev instrumentation", file=sys.stderr)
@@ -1,2 +1,2 @@
1
1
  """Version information for agentdev package."""
2
- __version__ = "0.0.1b260128"
2
+ __version__ = "0.0.1b260205"
@@ -321,16 +321,26 @@ class EventMapper():
321
321
 
322
322
  for content in event.contents:
323
323
  if isinstance(content, FunctionCallContent):
324
- # Arguments are always streamed in OpenAI. But not always in Agent Framework.
325
- # Argument streaming use last call_id to track the function call instance.
326
- if ctx.call_id and content.arguments:
327
- results.append({
328
- "type": "response.function_call_arguments.delta",
329
- "output_index": ctx.output_index,
330
- # DevUI set OpenAI's item_id to the value of Agent Framework's call_id, which might be a bug
331
- "item_id": ctx.call_id,
332
- "delta": content.arguments,
333
- })
324
+ is_same_call = ctx.call_id and content.call_id == ctx.call_id
325
+
326
+ if is_same_call and content.arguments:
327
+ delta_args = ""
328
+ if isinstance(content.arguments, str):
329
+ delta_args = content.arguments
330
+ elif content.arguments:
331
+ try:
332
+ delta_args = json.dumps(serialize_data(content.arguments))
333
+ except Exception as e:
334
+ logging.warning(f"Failed to serialize arguments: {e}")
335
+ delta_args = str(content.arguments)
336
+
337
+ if delta_args:
338
+ results.append({
339
+ "type": "response.function_call_arguments.delta",
340
+ "output_index": ctx.output_index,
341
+ "item_id": ctx.call_id,
342
+ "delta": delta_args,
343
+ })
334
344
  else:
335
345
  if content.call_id != ctx.call_id:
336
346
  ctx.call_id = content.call_id
@@ -347,6 +357,24 @@ class EventMapper():
347
357
  "status":"in_progress",
348
358
  },
349
359
  })
360
+ if content.arguments:
361
+ initial_args = ""
362
+ if isinstance(content.arguments, str):
363
+ initial_args = content.arguments
364
+ elif content.arguments:
365
+ try:
366
+ initial_args = json.dumps(serialize_data(content.arguments))
367
+ except Exception as e:
368
+ logging.warning(f"Failed to serialize initial arguments: {e}")
369
+ initial_args = str(content.arguments)
370
+
371
+ if initial_args:
372
+ results.append({
373
+ "type": "response.function_call_arguments.delta",
374
+ "output_index": ctx.output_index,
375
+ "item_id": ctx.call_id,
376
+ "delta": initial_args,
377
+ })
350
378
  elif isinstance(content, FunctionResultContent):
351
379
  results.append({
352
380
  "type":"response.function_result.complete",
@@ -18,6 +18,8 @@ from starlette.websockets import WebSocket, WebSocketDisconnect
18
18
 
19
19
  from agent_framework import Workflow, ChatMessage, AgentProtocol, Executor
20
20
 
21
+ from .._version import __version__
22
+
21
23
  from .event_mapper import EventMapper, MapperContext
22
24
  from .structs.request import AgentFrameworkRequest
23
25
  from .structs.entity_response import EntityResponse
@@ -81,6 +83,7 @@ class TestToolServer:
81
83
  app = Starlette(routes=[
82
84
  # Responses API for workflow and agent
83
85
  Route("/v1/responses", endpoint=self.responses, methods=["POST"]),
86
+ Route("/version", endpoint=self.get_version, methods=["GET"]),
84
87
  Route("/entities", endpoint=self.list_entities, methods=["GET"]),
85
88
  Route("/entities/{entity_id}/info", endpoint=self.get_entity_info, methods=["GET"]),
86
89
  Route("/entities/{entity_id}/executor/{executor_id}/location", endpoint=self.get_executor_location, methods=["GET"]),
@@ -90,6 +93,10 @@ class TestToolServer:
90
93
  ])
91
94
  root_app.mount("/agentdev/", app)
92
95
 
96
+ async def get_version(self, raw_request: Request):
97
+ """Return the CLI version for compatibility checking."""
98
+ return JSONResponse({"version": __version__})
99
+
93
100
  async def list_entities(self, raw_request: Request):
94
101
  entities_info = []
95
102
  for entity in self._entities:
@@ -0,0 +1,100 @@
1
+ """
2
+ Workflow visualization setup module.
3
+
4
+ This module provides functionality to set up workflow or agent visualization
5
+ """
6
+
7
+ from agent_framework import WorkflowAgent
8
+ import logging
9
+ import time
10
+ from typing import Any, Optional
11
+
12
+
13
+ def _get_agent_from_server(agent_server: Any) -> Optional[Any]:
14
+ """
15
+ Extract the agent from an agent server instance.
16
+
17
+ Args:
18
+ agent_server: The agent server instance
19
+
20
+ Returns:
21
+ The agent instance, or None if not found
22
+ """
23
+ if hasattr(agent_server, '_agent') and agent_server._agent is not None:
24
+ return agent_server._agent
25
+
26
+ if hasattr(agent_server, 'agent') and agent_server.agent is not None:
27
+ return agent_server.agent
28
+
29
+ if hasattr(agent_server, '_workflow_factory') and agent_server._workflow_factory is not None:
30
+ try:
31
+ return agent_server._workflow_factory().as_agent()
32
+ except Exception as e:
33
+ logging.debug("Failed to build workflow agent (%s): %s", type(e).__name__, e)
34
+
35
+ if hasattr(agent_server, '_build_agent'):
36
+ try:
37
+ return agent_server._build_agent()
38
+ except Exception as e:
39
+ logging.debug("Failed to call _build_agent (%s): %s", type(e).__name__, e)
40
+
41
+ return None
42
+
43
+
44
+ def configure_agent_server(agent_server):
45
+ """
46
+ Set up workflow or agent visualization for an agent server.
47
+
48
+ This function configures a health check endpoint and starts a visualization
49
+ server for workflow agents on port 8090.
50
+
51
+ Args:
52
+ agent_server: The agent server instance to set up visualization for.
53
+ Should have 'app' (Starlette) attribute. The agent is
54
+ extracted using `_get_agent_from_server()` which supports
55
+ both old and new SDK versions.
56
+
57
+ Example:
58
+ >>> from azure.ai.agentserver.agentframework import from_agent_framework
59
+ >>> agent_server = from_agent_framework(agent)
60
+ >>> configure_agent_server(agent_server)
61
+ >>> await agent_server.run_async()
62
+ """
63
+ from starlette.applications import Starlette
64
+ from starlette.responses import JSONResponse
65
+ from starlette.routing import Route
66
+ from threading import Thread
67
+ from agentdev.backend.server import TestToolServer
68
+
69
+ async def health_check(request):
70
+ """Health check endpoint handler."""
71
+ return JSONResponse({"status": "ok"}, status_code=200)
72
+
73
+ app = agent_server.app
74
+ agent = _get_agent_from_server(agent_server)
75
+
76
+ if agent is None:
77
+ logging.warning("agentdev: Could not extract agent from server, visualization may be limited")
78
+
79
+ app.mount(
80
+ "/agentdev/health",
81
+ Starlette(routes=[Route("/", health_check)])
82
+ )
83
+
84
+ entities = []
85
+ if agent is not None:
86
+ if isinstance(agent, WorkflowAgent):
87
+ entities.append(agent.workflow)
88
+ else:
89
+ entities.append(agent)
90
+
91
+ test_tool_server = TestToolServer(entities)
92
+ test_tool_server.mount_backend(app)
93
+ def show_startup_message():
94
+ time.sleep(2)
95
+ logging.info("agentdev: Application startup complete")
96
+ thread = Thread(target=show_startup_message)
97
+ thread.daemon = True
98
+ thread.start()
99
+
100
+ logging.debug("Agent server configured: %s", agent)
@@ -1,64 +0,0 @@
1
- """
2
- Workflow visualization setup module.
3
-
4
- This module provides functionality to set up workflow or agent visualization
5
- """
6
-
7
- from agent_framework import WorkflowAgent
8
- import logging
9
- import time
10
-
11
-
12
- def setup_test_tool(agent_server):
13
- """
14
- Set up workflow or agent visualization for an agent server.
15
-
16
- This function configures a health check endpoint and starts a visualization
17
- server for workflow agents on port 8090.
18
-
19
- Args:
20
- agent_server: The agent server instance to set up visualization for.
21
- Should have 'app' (Starlette) and 'agent' attributes.
22
-
23
- Example:
24
- >>> from azure.ai.agentserver.agentframework import from_agent_framework
25
- >>> agent_server = from_agent_framework(agent)
26
- >>> setup_test_tool(agent_server)
27
- >>> await agent_server.run_async()
28
- """
29
- from starlette.applications import Starlette
30
- from starlette.responses import JSONResponse
31
- from starlette.routing import Route
32
- from threading import Thread
33
- from agentdev.backend.server import TestToolServer
34
-
35
- async def health_check(request):
36
- """Health check endpoint handler."""
37
- return JSONResponse({"status": "ok"}, status_code=200)
38
-
39
- app = agent_server.app
40
- agent = agent_server.agent
41
-
42
- # Mount health check endpoint
43
- app.mount(
44
- "/agentdev/health",
45
- Starlette(routes=[Route("/", health_check)])
46
- )
47
-
48
- # Prepare entities for visualization
49
- entities = []
50
- if isinstance(agent, WorkflowAgent):
51
- entities.append(agent.workflow)
52
- else:
53
- entities.append(agent)
54
-
55
- test_tool_server = TestToolServer(entities)
56
- test_tool_server.mount_backend(app)
57
- def show_startup_message():
58
- time.sleep(2)
59
- logging.info("agentdev: Application startup complete")
60
- thread = Thread(target=show_startup_message)
61
- thread.daemon = True
62
- thread.start()
63
-
64
- logging.debug("Agent server configured: %s", agent)