autobyteus 1.2.0__py3-none-any.whl → 1.2.1__py3-none-any.whl
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.
- autobyteus/agent/context/agent_runtime_state.py +4 -0
- autobyteus/agent/events/notifiers.py +5 -1
- autobyteus/agent/message/send_message_to.py +5 -4
- autobyteus/agent/streaming/agent_event_stream.py +5 -0
- autobyteus/agent/streaming/stream_event_payloads.py +25 -0
- autobyteus/agent/streaming/stream_events.py +13 -1
- autobyteus/agent_team/bootstrap_steps/task_notifier_initialization_step.py +4 -4
- autobyteus/agent_team/bootstrap_steps/team_context_initialization_step.py +12 -12
- autobyteus/agent_team/context/agent_team_runtime_state.py +2 -2
- autobyteus/agent_team/streaming/agent_team_event_notifier.py +4 -4
- autobyteus/agent_team/streaming/agent_team_stream_event_payloads.py +3 -3
- autobyteus/agent_team/streaming/agent_team_stream_events.py +8 -8
- autobyteus/agent_team/task_notification/activation_policy.py +1 -1
- autobyteus/agent_team/task_notification/system_event_driven_agent_task_notifier.py +22 -22
- autobyteus/agent_team/task_notification/task_notification_mode.py +1 -1
- autobyteus/cli/agent_team_tui/app.py +4 -4
- autobyteus/cli/agent_team_tui/state.py +8 -8
- autobyteus/cli/agent_team_tui/widgets/focus_pane.py +3 -3
- autobyteus/cli/agent_team_tui/widgets/shared.py +1 -1
- autobyteus/cli/agent_team_tui/widgets/{task_board_panel.py → task_plan_panel.py} +5 -5
- autobyteus/events/event_types.py +4 -3
- autobyteus/multimedia/audio/api/__init__.py +3 -2
- autobyteus/multimedia/audio/api/openai_audio_client.py +112 -0
- autobyteus/multimedia/audio/audio_client_factory.py +37 -0
- autobyteus/multimedia/image/image_client_factory.py +1 -1
- autobyteus/task_management/__init__.py +43 -20
- autobyteus/task_management/{base_task_board.py → base_task_plan.py} +16 -13
- autobyteus/task_management/converters/__init__.py +2 -2
- autobyteus/task_management/converters/{task_board_converter.py → task_plan_converter.py} +13 -13
- autobyteus/task_management/events.py +7 -7
- autobyteus/task_management/{in_memory_task_board.py → in_memory_task_plan.py} +34 -22
- autobyteus/task_management/schemas/__init__.py +3 -0
- autobyteus/task_management/schemas/task_status_report.py +2 -2
- autobyteus/task_management/schemas/todo_definition.py +15 -0
- autobyteus/task_management/todo.py +29 -0
- autobyteus/task_management/todo_list.py +75 -0
- autobyteus/task_management/tools/__init__.py +24 -8
- autobyteus/task_management/tools/task_tools/__init__.py +19 -0
- autobyteus/task_management/tools/{assign_task_to.py → task_tools/assign_task_to.py} +18 -18
- autobyteus/task_management/tools/{publish_task.py → task_tools/create_task.py} +16 -18
- autobyteus/task_management/tools/{publish_tasks.py → task_tools/create_tasks.py} +19 -19
- autobyteus/task_management/tools/{get_my_tasks.py → task_tools/get_my_tasks.py} +15 -15
- autobyteus/task_management/tools/{get_task_board_status.py → task_tools/get_task_plan_status.py} +16 -16
- autobyteus/task_management/tools/{update_task_status.py → task_tools/update_task_status.py} +16 -16
- autobyteus/task_management/tools/todo_tools/__init__.py +18 -0
- autobyteus/task_management/tools/todo_tools/add_todo.py +78 -0
- autobyteus/task_management/tools/todo_tools/create_todo_list.py +79 -0
- autobyteus/task_management/tools/todo_tools/get_todo_list.py +55 -0
- autobyteus/task_management/tools/todo_tools/update_todo_status.py +85 -0
- autobyteus/tools/__init__.py +15 -11
- autobyteus/tools/bash/bash_executor.py +3 -3
- autobyteus/tools/browser/session_aware/browser_session_aware_navigate_to.py +5 -5
- autobyteus/tools/browser/session_aware/browser_session_aware_web_element_trigger.py +4 -4
- autobyteus/tools/browser/session_aware/browser_session_aware_webpage_reader.py +3 -3
- autobyteus/tools/browser/session_aware/browser_session_aware_webpage_screenshot_taker.py +3 -3
- autobyteus/tools/browser/standalone/navigate_to.py +13 -9
- autobyteus/tools/browser/standalone/web_page_pdf_generator.py +9 -5
- autobyteus/tools/browser/standalone/webpage_image_downloader.py +10 -6
- autobyteus/tools/browser/standalone/webpage_reader.py +13 -9
- autobyteus/tools/browser/standalone/webpage_screenshot_taker.py +9 -5
- autobyteus/tools/file/__init__.py +13 -0
- autobyteus/tools/file/{file_editor.py → edit_file.py} +11 -11
- autobyteus/tools/file/list_directory.py +168 -0
- autobyteus/tools/file/{file_reader.py → read_file.py} +3 -3
- autobyteus/tools/file/search_files.py +188 -0
- autobyteus/tools/file/{file_writer.py → write_file.py} +3 -3
- autobyteus/tools/functional_tool.py +10 -8
- autobyteus/tools/mcp/tool.py +3 -3
- autobyteus/tools/mcp/tool_registrar.py +5 -2
- autobyteus/tools/multimedia/__init__.py +2 -1
- autobyteus/tools/multimedia/audio_tools.py +2 -2
- autobyteus/tools/{download_media_tool.py → multimedia/download_media_tool.py} +3 -3
- autobyteus/tools/multimedia/image_tools.py +4 -4
- autobyteus/tools/multimedia/media_reader_tool.py +1 -1
- autobyteus/tools/registry/tool_definition.py +66 -13
- autobyteus/tools/registry/tool_registry.py +29 -0
- autobyteus/tools/search/__init__.py +17 -0
- autobyteus/tools/search/base_strategy.py +35 -0
- autobyteus/tools/search/client.py +24 -0
- autobyteus/tools/search/factory.py +81 -0
- autobyteus/tools/search/google_cse_strategy.py +68 -0
- autobyteus/tools/search/providers.py +10 -0
- autobyteus/tools/search/serpapi_strategy.py +65 -0
- autobyteus/tools/search/serper_strategy.py +87 -0
- autobyteus/tools/search_tool.py +83 -0
- autobyteus/tools/timer.py +4 -0
- autobyteus/tools/tool_meta.py +4 -24
- autobyteus/workflow/bootstrap_steps/coordinator_prompt_preparation_step.py +1 -2
- {autobyteus-1.2.0.dist-info → autobyteus-1.2.1.dist-info}/METADATA +5 -5
- {autobyteus-1.2.0.dist-info → autobyteus-1.2.1.dist-info}/RECORD +95 -80
- examples/run_agentic_software_engineer.py +239 -0
- examples/run_poem_writer.py +3 -3
- autobyteus/person/__init__.py +0 -0
- autobyteus/person/examples/__init__.py +0 -0
- autobyteus/person/examples/sample_persons.py +0 -14
- autobyteus/person/examples/sample_roles.py +0 -14
- autobyteus/person/person.py +0 -29
- autobyteus/person/role.py +0 -14
- autobyteus/tools/google_search.py +0 -149
- {autobyteus-1.2.0.dist-info → autobyteus-1.2.1.dist-info}/WHEEL +0 -0
- {autobyteus-1.2.0.dist-info → autobyteus-1.2.1.dist-info}/licenses/LICENSE +0 -0
- {autobyteus-1.2.0.dist-info → autobyteus-1.2.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# file: autobyteus/autobyteus/task_management/todo.py
|
|
2
|
+
"""
|
|
3
|
+
Defines the data structures for a ToDo item.
|
|
4
|
+
A ToDo represents a small, personal step an agent creates for itself to break down a larger Task.
|
|
5
|
+
"""
|
|
6
|
+
import logging
|
|
7
|
+
from enum import Enum
|
|
8
|
+
from pydantic import BaseModel, Field
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
class ToDoStatus(str, Enum):
|
|
13
|
+
"""Enumerates the possible lifecycle states of a ToDo item."""
|
|
14
|
+
PENDING = "pending"
|
|
15
|
+
IN_PROGRESS = "in_progress"
|
|
16
|
+
DONE = "done"
|
|
17
|
+
|
|
18
|
+
class ToDo(BaseModel):
|
|
19
|
+
"""
|
|
20
|
+
Represents a single, discrete item on a personal ToDoList.
|
|
21
|
+
It is intentionally simpler than a `Task`, as it's for an agent's internal planning.
|
|
22
|
+
"""
|
|
23
|
+
description: str = Field(..., description="A clear and concise description of what this to-do item or step entails.")
|
|
24
|
+
todo_id: str = Field(..., description="A unique, sequential, system-generated identifier for this to-do item (e.g., 'todo_1').")
|
|
25
|
+
status: ToDoStatus = Field(default=ToDoStatus.PENDING, description="The current status of this to-do item.")
|
|
26
|
+
|
|
27
|
+
def model_post_init(self, __context: any) -> None:
|
|
28
|
+
"""Called after the model is initialized and validated."""
|
|
29
|
+
logger.debug(f"ToDo created: ID='{self.todo_id}', Description='{self.description}'")
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# file: autobyteus/autobyteus/task_management/todo_list.py
|
|
2
|
+
"""
|
|
3
|
+
An in-memory implementation of a personal ToDoList for a single agent.
|
|
4
|
+
"""
|
|
5
|
+
import logging
|
|
6
|
+
from typing import List, Dict, Optional
|
|
7
|
+
|
|
8
|
+
from autobyteus.task_management.schemas import ToDoDefinitionSchema
|
|
9
|
+
from .todo import ToDo, ToDoStatus
|
|
10
|
+
|
|
11
|
+
logger = logging.getLogger(__name__)
|
|
12
|
+
|
|
13
|
+
class ToDoList:
|
|
14
|
+
"""
|
|
15
|
+
An in-memory, list-based implementation of a personal ToDo list for an agent.
|
|
16
|
+
It manages a collection of ToDo items.
|
|
17
|
+
"""
|
|
18
|
+
def __init__(self, agent_id: str):
|
|
19
|
+
self.agent_id = agent_id
|
|
20
|
+
self.todos: List[ToDo] = []
|
|
21
|
+
self._todo_map: Dict[str, ToDo] = {}
|
|
22
|
+
self._id_counter: int = 0
|
|
23
|
+
logger.info(f"ToDoList initialized for agent '{self.agent_id}'.")
|
|
24
|
+
|
|
25
|
+
def _generate_next_id(self) -> str:
|
|
26
|
+
self._id_counter += 1
|
|
27
|
+
return f"todo_{self._id_counter:04d}"
|
|
28
|
+
|
|
29
|
+
def add_todos(self, todo_definitions: List[ToDoDefinitionSchema]) -> List[ToDo]:
|
|
30
|
+
"""Creates and adds new to-do items from definitions, and returns the created items."""
|
|
31
|
+
new_todos: List[ToDo] = []
|
|
32
|
+
for definition in todo_definitions:
|
|
33
|
+
new_id = self._generate_next_id()
|
|
34
|
+
todo = ToDo(todo_id=new_id, **definition.model_dump())
|
|
35
|
+
# This check is defensive, with a sequential counter it should not happen
|
|
36
|
+
if todo.todo_id in self._todo_map:
|
|
37
|
+
logger.warning(f"ToDo with ID '{todo.todo_id}' already exists in the list for agent '{self.agent_id}'. Skipping.")
|
|
38
|
+
continue
|
|
39
|
+
self.todos.append(todo)
|
|
40
|
+
self._todo_map[todo.todo_id] = todo
|
|
41
|
+
new_todos.append(todo)
|
|
42
|
+
logger.info(f"Agent '{self.agent_id}': Added {len(new_todos)} new item(s) to the ToDoList.")
|
|
43
|
+
return new_todos
|
|
44
|
+
|
|
45
|
+
def add_todo(self, todo_definition: ToDoDefinitionSchema) -> ToDo:
|
|
46
|
+
"""Adds a single new to-do item from a definition."""
|
|
47
|
+
created_todos = self.add_todos([todo_definition])
|
|
48
|
+
return created_todos[0]
|
|
49
|
+
|
|
50
|
+
def get_todo_by_id(self, todo_id: str) -> Optional[ToDo]:
|
|
51
|
+
"""Retrieves a to-do item by its ID."""
|
|
52
|
+
return self._todo_map.get(todo_id)
|
|
53
|
+
|
|
54
|
+
def update_todo_status(self, todo_id: str, status: ToDoStatus) -> bool:
|
|
55
|
+
"""Updates the status of a specific to-do item."""
|
|
56
|
+
todo = self.get_todo_by_id(todo_id)
|
|
57
|
+
if not todo:
|
|
58
|
+
logger.warning(f"Agent '{self.agent_id}': Attempted to update status for non-existent todo_id '{todo_id}'.")
|
|
59
|
+
return False
|
|
60
|
+
|
|
61
|
+
old_status = todo.status
|
|
62
|
+
todo.status = status
|
|
63
|
+
logger.info(f"Agent '{self.agent_id}': Status of todo '{todo_id}' updated from '{old_status.value}' to '{status.value}'.")
|
|
64
|
+
return True
|
|
65
|
+
|
|
66
|
+
def get_all_todos(self) -> List[ToDo]:
|
|
67
|
+
"""Returns all to-do items."""
|
|
68
|
+
return self.todos
|
|
69
|
+
|
|
70
|
+
def clear(self) -> None:
|
|
71
|
+
"""Clears all to-do items from the list."""
|
|
72
|
+
self.todos.clear()
|
|
73
|
+
self._todo_map.clear()
|
|
74
|
+
self._id_counter = 0
|
|
75
|
+
logger.info(f"ToDoList for agent '{self.agent_id}' has been cleared.")
|
|
@@ -3,16 +3,32 @@
|
|
|
3
3
|
This package contains the class-based tools related to task and project
|
|
4
4
|
management within an agent team.
|
|
5
5
|
"""
|
|
6
|
-
from .
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
from .task_tools import (
|
|
7
|
+
GetTaskPlanStatus,
|
|
8
|
+
CreateTasks,
|
|
9
|
+
CreateTask,
|
|
10
|
+
UpdateTaskStatus,
|
|
11
|
+
AssignTaskTo,
|
|
12
|
+
GetMyTasks,
|
|
13
|
+
)
|
|
14
|
+
from .todo_tools import (
|
|
15
|
+
CreateToDoList,
|
|
16
|
+
AddToDo,
|
|
17
|
+
GetToDoList,
|
|
18
|
+
UpdateToDoStatus,
|
|
19
|
+
UpdateToDoStatusTool,
|
|
20
|
+
)
|
|
11
21
|
|
|
12
22
|
__all__ = [
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
23
|
+
"GetTaskPlanStatus",
|
|
24
|
+
"CreateTasks",
|
|
25
|
+
"CreateTask",
|
|
16
26
|
"UpdateTaskStatus",
|
|
17
27
|
"AssignTaskTo",
|
|
28
|
+
"GetMyTasks",
|
|
29
|
+
"CreateToDoList",
|
|
30
|
+
"AddToDo",
|
|
31
|
+
"GetToDoList",
|
|
32
|
+
"UpdateToDoStatus",
|
|
33
|
+
"UpdateToDoStatusTool",
|
|
18
34
|
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# file: autobyteus/task_management/tools/task_tools/__init__.py
|
|
2
|
+
"""
|
|
3
|
+
Task management tool package exposing task plan utilities.
|
|
4
|
+
"""
|
|
5
|
+
from .get_task_plan_status import GetTaskPlanStatus
|
|
6
|
+
from .create_tasks import CreateTasks
|
|
7
|
+
from .create_task import CreateTask
|
|
8
|
+
from .update_task_status import UpdateTaskStatus
|
|
9
|
+
from .assign_task_to import AssignTaskTo
|
|
10
|
+
from .get_my_tasks import GetMyTasks
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"GetTaskPlanStatus",
|
|
14
|
+
"CreateTasks",
|
|
15
|
+
"CreateTask",
|
|
16
|
+
"UpdateTaskStatus",
|
|
17
|
+
"AssignTaskTo",
|
|
18
|
+
"GetMyTasks",
|
|
19
|
+
]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# file: autobyteus/autobyteus/task_management/tools/assign_task_to.py
|
|
1
|
+
# file: autobyteus/autobyteus/task_management/tools/task_tools/assign_task_to.py
|
|
2
2
|
import logging
|
|
3
3
|
from typing import TYPE_CHECKING, Optional, Any
|
|
4
4
|
|
|
@@ -9,7 +9,6 @@ from autobyteus.tools.tool_category import ToolCategory
|
|
|
9
9
|
from autobyteus.utils.parameter_schema import ParameterSchema
|
|
10
10
|
from autobyteus.tools.pydantic_schema_converter import pydantic_to_parameter_schema
|
|
11
11
|
from autobyteus.task_management.schemas import TaskDefinitionSchema
|
|
12
|
-
from autobyteus.task_management.task import Task
|
|
13
12
|
|
|
14
13
|
if TYPE_CHECKING:
|
|
15
14
|
from autobyteus.agent.context import AgentContext
|
|
@@ -25,7 +24,7 @@ class AssignTaskTo(BaseTool):
|
|
|
25
24
|
|
|
26
25
|
@classmethod
|
|
27
26
|
def get_name(cls) -> str:
|
|
28
|
-
return "
|
|
27
|
+
return "assign_task_to"
|
|
29
28
|
|
|
30
29
|
@classmethod
|
|
31
30
|
def get_description(cls) -> str:
|
|
@@ -41,42 +40,43 @@ class AssignTaskTo(BaseTool):
|
|
|
41
40
|
|
|
42
41
|
async def _execute(self, context: 'AgentContext', **kwargs: Any) -> str:
|
|
43
42
|
"""
|
|
44
|
-
Executes the tool by adding the task to the central
|
|
43
|
+
Executes the tool by adding the task to the central TaskPlan and then
|
|
45
44
|
sending a direct message to the assignee with the task's details.
|
|
46
45
|
"""
|
|
47
46
|
agent_name = context.config.name
|
|
48
47
|
task_name = kwargs.get("task_name", "unnamed task")
|
|
49
48
|
assignee_name = kwargs.get("assignee_name")
|
|
50
|
-
logger.info(f"Agent '{agent_name}' is executing
|
|
49
|
+
logger.info(f"Agent '{agent_name}' is executing assign_task_to for task '{task_name}' assigned to '{assignee_name}'.")
|
|
51
50
|
|
|
52
|
-
# --- Get Team Context and Task
|
|
51
|
+
# --- Get Team Context and Task Plan ---
|
|
53
52
|
team_context: Optional['AgentTeamContext'] = context.custom_data.get("team_context")
|
|
54
53
|
if not team_context:
|
|
55
|
-
error_msg = "Error: Team context is not available. Cannot access the task
|
|
54
|
+
error_msg = "Error: Team context is not available. Cannot access the task plan or send messages."
|
|
56
55
|
logger.error(f"Agent '{agent_name}': {error_msg}")
|
|
57
56
|
return error_msg
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
if not
|
|
61
|
-
error_msg = "Error: Task
|
|
58
|
+
task_plan = getattr(team_context.state, 'task_plan', None)
|
|
59
|
+
if not task_plan:
|
|
60
|
+
error_msg = "Error: Task plan has not been initialized for this team."
|
|
62
61
|
logger.error(f"Agent '{agent_name}': {error_msg}")
|
|
63
62
|
return error_msg
|
|
64
63
|
|
|
65
|
-
# --- Action 1: Add the task to the Task
|
|
64
|
+
# --- Action 1: Add the task to the Task Plan ---
|
|
66
65
|
try:
|
|
67
66
|
task_def_schema = TaskDefinitionSchema(**kwargs)
|
|
68
|
-
new_task = Task(**task_def_schema.model_dump())
|
|
69
67
|
except (ValidationError, ValueError) as e:
|
|
70
68
|
error_msg = f"Invalid task definition provided: {e}"
|
|
71
|
-
logger.warning(f"Agent '{agent_name}' provided an invalid definition for
|
|
69
|
+
logger.warning(f"Agent '{agent_name}' provided an invalid definition for assign_task_to: {error_msg}")
|
|
72
70
|
return f"Error: {error_msg}"
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
# The task plan now handles ID generation and returns the created Task object.
|
|
73
|
+
new_task = task_plan.add_task(task_def_schema)
|
|
74
|
+
if not new_task:
|
|
75
|
+
error_msg = f"Failed to publish task '{task_name}' to the plan for an unknown reason."
|
|
76
76
|
logger.error(f"Agent '{agent_name}': {error_msg}")
|
|
77
77
|
return f"Error: {error_msg}"
|
|
78
78
|
|
|
79
|
-
logger.info(f"Agent '{agent_name}' successfully published task '{new_task.task_name}' to the task
|
|
79
|
+
logger.info(f"Agent '{agent_name}' successfully published task '{new_task.task_name}' (ID: {new_task.task_id}) to the task plan.")
|
|
80
80
|
|
|
81
81
|
# --- Action 2: Send a direct notification message to the assignee ---
|
|
82
82
|
team_manager: Optional['TeamManager'] = team_context.team_manager
|
|
@@ -98,11 +98,11 @@ class AssignTaskTo(BaseTool):
|
|
|
98
98
|
)
|
|
99
99
|
if new_task.dependencies:
|
|
100
100
|
# Resolve dependency names for the message
|
|
101
|
-
id_to_name_map = {task.task_id: task.task_name for task in
|
|
101
|
+
id_to_name_map = {task.task_id: task.task_name for task in task_plan.tasks}
|
|
102
102
|
dep_names = [id_to_name_map.get(dep_id, str(dep_id)) for dep_id in new_task.dependencies]
|
|
103
103
|
notification_content += f"**Dependencies**: {', '.join(dep_names)}\n"
|
|
104
104
|
|
|
105
|
-
notification_content += "\nThis task has been logged on the team's task
|
|
105
|
+
notification_content += "\nThis task has been logged on the team's task plan. You can begin work when its dependencies are met."
|
|
106
106
|
|
|
107
107
|
event = InterAgentMessageRequestEvent(
|
|
108
108
|
sender_agent_id=context.agent_id,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# file: autobyteus/autobyteus/task_management/tools/
|
|
1
|
+
# file: autobyteus/autobyteus/task_management/tools/task_tools/create_task.py
|
|
2
2
|
import logging
|
|
3
3
|
from typing import TYPE_CHECKING, Optional, Dict, Any
|
|
4
4
|
|
|
@@ -9,7 +9,6 @@ from autobyteus.tools.tool_category import ToolCategory
|
|
|
9
9
|
from autobyteus.utils.parameter_schema import ParameterSchema
|
|
10
10
|
from autobyteus.tools.pydantic_schema_converter import pydantic_to_parameter_schema
|
|
11
11
|
from autobyteus.task_management.schemas import TaskDefinitionSchema
|
|
12
|
-
from autobyteus.task_management.task import Task
|
|
13
12
|
|
|
14
13
|
if TYPE_CHECKING:
|
|
15
14
|
from autobyteus.agent.context import AgentContext
|
|
@@ -17,19 +16,19 @@ if TYPE_CHECKING:
|
|
|
17
16
|
|
|
18
17
|
logger = logging.getLogger(__name__)
|
|
19
18
|
|
|
20
|
-
class
|
|
21
|
-
"""A tool for any agent to add a single new task to the team's task
|
|
19
|
+
class CreateTask(BaseTool):
|
|
20
|
+
"""A tool for any agent to add a single new task to the team's task plan."""
|
|
22
21
|
|
|
23
22
|
CATEGORY = ToolCategory.TASK_MANAGEMENT
|
|
24
23
|
|
|
25
24
|
@classmethod
|
|
26
25
|
def get_name(cls) -> str:
|
|
27
|
-
return "
|
|
26
|
+
return "create_task"
|
|
28
27
|
|
|
29
28
|
@classmethod
|
|
30
29
|
def get_description(cls) -> str:
|
|
31
30
|
return (
|
|
32
|
-
"Adds a single new task to the team's shared task
|
|
31
|
+
"Adds a single new task to the team's shared task plan. This is an additive action "
|
|
33
32
|
"and does not affect existing tasks. Use this to create follow-up tasks or delegate new work."
|
|
34
33
|
)
|
|
35
34
|
|
|
@@ -40,38 +39,37 @@ class PublishTask(BaseTool):
|
|
|
40
39
|
|
|
41
40
|
async def _execute(self, context: 'AgentContext', **kwargs: Any) -> str:
|
|
42
41
|
"""
|
|
43
|
-
Executes the tool by validating the task
|
|
42
|
+
Executes the tool by validating the task definition and adding it to the plan.
|
|
44
43
|
"""
|
|
45
44
|
agent_name = context.config.name
|
|
46
45
|
task_name = kwargs.get("task_name", "unnamed task")
|
|
47
|
-
logger.info(f"Agent '{agent_name}' is executing
|
|
46
|
+
logger.info(f"Agent '{agent_name}' is executing create_task for task '{task_name}'.")
|
|
48
47
|
|
|
49
48
|
team_context: Optional['AgentTeamContext'] = context.custom_data.get("team_context")
|
|
50
49
|
if not team_context:
|
|
51
|
-
error_msg = "Error: Team context is not available. Cannot access the task
|
|
50
|
+
error_msg = "Error: Team context is not available. Cannot access the task plan."
|
|
52
51
|
logger.error(f"Agent '{agent_name}': {error_msg}")
|
|
53
52
|
return error_msg
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
if not
|
|
57
|
-
error_msg = "Error: Task
|
|
54
|
+
task_plan = getattr(team_context.state, 'task_plan', None)
|
|
55
|
+
if not task_plan:
|
|
56
|
+
error_msg = "Error: Task plan has not been initialized for this team."
|
|
58
57
|
logger.error(f"Agent '{agent_name}': {error_msg}")
|
|
59
58
|
return error_msg
|
|
60
59
|
|
|
61
60
|
try:
|
|
62
61
|
task_def_schema = TaskDefinitionSchema(**kwargs)
|
|
63
|
-
new_task = Task(**task_def_schema.model_dump())
|
|
64
62
|
except (ValidationError, ValueError) as e:
|
|
65
63
|
error_msg = f"Invalid task definition provided: {e}"
|
|
66
|
-
logger.warning(f"Agent '{agent_name}' provided an invalid definition for
|
|
64
|
+
logger.warning(f"Agent '{agent_name}' provided an invalid definition for create_task: {error_msg}")
|
|
67
65
|
return f"Error: {error_msg}"
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
new_task = task_plan.add_task(task_def_schema)
|
|
68
|
+
if new_task:
|
|
69
|
+
success_msg = f"Successfully created new task '{new_task.task_name}' (ID: {new_task.task_id}) in the task plan."
|
|
71
70
|
logger.info(f"Agent '{agent_name}': {success_msg}")
|
|
72
71
|
return success_msg
|
|
73
72
|
else:
|
|
74
|
-
|
|
75
|
-
error_msg = "Failed to publish task to the board for an unknown reason."
|
|
73
|
+
error_msg = f"Failed to create task '{task_name}' in the plan for an unknown reason."
|
|
76
74
|
logger.error(f"Agent '{agent_name}': {error_msg}")
|
|
77
75
|
return f"Error: {error_msg}"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# file: autobyteus/autobyteus/task_management/tools/
|
|
1
|
+
# file: autobyteus/autobyteus/task_management/tools/task_tools/create_tasks.py
|
|
2
2
|
import logging
|
|
3
3
|
from typing import TYPE_CHECKING, Optional, Dict, Any
|
|
4
4
|
|
|
@@ -9,7 +9,6 @@ from autobyteus.tools.tool_category import ToolCategory
|
|
|
9
9
|
from autobyteus.utils.parameter_schema import ParameterSchema
|
|
10
10
|
from autobyteus.tools.pydantic_schema_converter import pydantic_to_parameter_schema
|
|
11
11
|
from autobyteus.task_management.schemas import TasksDefinitionSchema
|
|
12
|
-
from autobyteus.task_management.task import Task
|
|
13
12
|
|
|
14
13
|
if TYPE_CHECKING:
|
|
15
14
|
from autobyteus.agent.context import AgentContext
|
|
@@ -17,21 +16,22 @@ if TYPE_CHECKING:
|
|
|
17
16
|
|
|
18
17
|
logger = logging.getLogger(__name__)
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
|
|
20
|
+
class CreateTasks(BaseTool):
|
|
21
21
|
"""
|
|
22
|
-
A tool to
|
|
22
|
+
A tool to create multiple tasks in the task plan. This is an additive-only operation.
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
CATEGORY = ToolCategory.TASK_MANAGEMENT
|
|
26
26
|
|
|
27
27
|
@classmethod
|
|
28
28
|
def get_name(cls) -> str:
|
|
29
|
-
return "
|
|
29
|
+
return "create_tasks"
|
|
30
30
|
|
|
31
31
|
@classmethod
|
|
32
32
|
def get_description(cls) -> str:
|
|
33
33
|
return (
|
|
34
|
-
"Adds a list of new tasks to the team's shared task
|
|
34
|
+
"Adds a list of new tasks to the team's shared task plan. This action is additive and "
|
|
35
35
|
"does not affect existing tasks or the team's overall goal."
|
|
36
36
|
)
|
|
37
37
|
|
|
@@ -41,34 +41,34 @@ class PublishTasks(BaseTool):
|
|
|
41
41
|
|
|
42
42
|
async def _execute(self, context: 'AgentContext', **kwargs: Any) -> str:
|
|
43
43
|
agent_name = context.config.name
|
|
44
|
-
logger.info(f"Agent '{agent_name}' is executing
|
|
44
|
+
logger.info(f"Agent '{agent_name}' is executing create_tasks.")
|
|
45
45
|
|
|
46
46
|
team_context: Optional['AgentTeamContext'] = context.custom_data.get("team_context")
|
|
47
47
|
if not team_context:
|
|
48
|
-
error_msg = "Error: Team context is not available. Cannot access the task
|
|
48
|
+
error_msg = "Error: Team context is not available. Cannot access the task plan."
|
|
49
49
|
logger.error(f"Agent '{agent_name}': {error_msg}")
|
|
50
50
|
return error_msg
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
if not
|
|
54
|
-
error_msg = "Error: Task
|
|
52
|
+
task_plan = getattr(team_context.state, 'task_plan', None)
|
|
53
|
+
if not task_plan:
|
|
54
|
+
error_msg = "Error: Task plan has not been initialized for this team."
|
|
55
55
|
logger.error(f"Agent '{agent_name}': {error_msg}")
|
|
56
56
|
return error_msg
|
|
57
57
|
|
|
58
58
|
try:
|
|
59
59
|
tasks_def_schema = TasksDefinitionSchema(**kwargs)
|
|
60
|
-
final_tasks = [Task(**task_def.model_dump()) for task_def in tasks_def_schema.tasks]
|
|
61
60
|
except (ValidationError, ValueError) as e:
|
|
62
61
|
error_msg = f"Invalid task definitions provided: {e}"
|
|
63
|
-
logger.warning(f"Agent '{agent_name}' provided an invalid definition for
|
|
62
|
+
logger.warning(f"Agent '{agent_name}' provided an invalid definition for create_tasks: {error_msg}")
|
|
64
63
|
return f"Error: {error_msg}"
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
newly_created_tasks = task_plan.add_tasks(tasks_def_schema.tasks)
|
|
66
|
+
if newly_created_tasks:
|
|
67
|
+
success_msg = f"Successfully created {len(newly_created_tasks)} new task(s) in the task plan."
|
|
68
68
|
logger.info(f"Agent '{agent_name}': {success_msg}")
|
|
69
69
|
return success_msg
|
|
70
70
|
else:
|
|
71
|
-
# This
|
|
72
|
-
|
|
73
|
-
logger.
|
|
74
|
-
return
|
|
71
|
+
# This case might happen if the input list was empty, or an error occurred.
|
|
72
|
+
warning_msg = "No tasks were created. The provided list may have been empty."
|
|
73
|
+
logger.warning(f"Agent '{agent_name}': {warning_msg}")
|
|
74
|
+
return warning_msg
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# file: autobyteus/autobyteus/task_management/tools/get_my_tasks.py
|
|
1
|
+
# file: autobyteus/autobyteus/task_management/tools/task_tools/get_my_tasks.py
|
|
2
2
|
import json
|
|
3
3
|
import logging
|
|
4
4
|
from typing import TYPE_CHECKING, Optional, List
|
|
@@ -6,7 +6,7 @@ from typing import TYPE_CHECKING, Optional, List
|
|
|
6
6
|
from autobyteus.tools.base_tool import BaseTool
|
|
7
7
|
from autobyteus.tools.tool_category import ToolCategory
|
|
8
8
|
from autobyteus.task_management.schemas import TaskDefinitionSchema
|
|
9
|
-
from autobyteus.task_management.
|
|
9
|
+
from autobyteus.task_management.base_task_plan import TaskStatus
|
|
10
10
|
|
|
11
11
|
if TYPE_CHECKING:
|
|
12
12
|
from autobyteus.agent.context import AgentContext
|
|
@@ -15,18 +15,18 @@ if TYPE_CHECKING:
|
|
|
15
15
|
logger = logging.getLogger(__name__)
|
|
16
16
|
|
|
17
17
|
class GetMyTasks(BaseTool):
|
|
18
|
-
"""A tool for an agent to inspect its own assigned tasks from the central
|
|
18
|
+
"""A tool for an agent to inspect its own assigned tasks from the central TaskPlan."""
|
|
19
19
|
|
|
20
20
|
CATEGORY = ToolCategory.TASK_MANAGEMENT
|
|
21
21
|
|
|
22
22
|
@classmethod
|
|
23
23
|
def get_name(cls) -> str:
|
|
24
|
-
return "
|
|
24
|
+
return "get_my_tasks"
|
|
25
25
|
|
|
26
26
|
@classmethod
|
|
27
27
|
def get_description(cls) -> str:
|
|
28
28
|
return (
|
|
29
|
-
"Retrieves the list of tasks currently assigned to you from the team's shared task
|
|
29
|
+
"Retrieves the list of tasks currently assigned to you from the team's shared task plan. "
|
|
30
30
|
"This is your personal to-do list. Use this to understand your current workload and decide what to do next."
|
|
31
31
|
)
|
|
32
32
|
|
|
@@ -37,29 +37,29 @@ class GetMyTasks(BaseTool):
|
|
|
37
37
|
|
|
38
38
|
async def _execute(self, context: 'AgentContext') -> str:
|
|
39
39
|
"""
|
|
40
|
-
Executes the tool by fetching tasks from the team's
|
|
40
|
+
Executes the tool by fetching tasks from the team's TaskPlan and
|
|
41
41
|
filtering them for the current agent.
|
|
42
42
|
"""
|
|
43
43
|
agent_name = context.config.name
|
|
44
|
-
logger.info(f"Agent '{agent_name}' is executing
|
|
44
|
+
logger.info(f"Agent '{agent_name}' is executing get_my_tasks.")
|
|
45
45
|
|
|
46
46
|
team_context: Optional['AgentTeamContext'] = context.custom_data.get("team_context")
|
|
47
47
|
if not team_context:
|
|
48
|
-
error_msg = "Error: Team context is not available. Cannot access the task
|
|
48
|
+
error_msg = "Error: Team context is not available. Cannot access the task plan."
|
|
49
49
|
logger.error(f"Agent '{agent_name}': {error_msg}")
|
|
50
50
|
return error_msg
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
if not
|
|
54
|
-
error_msg = "Error: Task
|
|
52
|
+
task_plan = getattr(team_context.state, 'task_plan', None)
|
|
53
|
+
if not task_plan:
|
|
54
|
+
error_msg = "Error: Task plan has not been initialized for this team."
|
|
55
55
|
logger.error(f"Agent '{agent_name}': {error_msg}")
|
|
56
56
|
return error_msg
|
|
57
57
|
|
|
58
|
-
# Filter the tasks from the central
|
|
58
|
+
# Filter the tasks from the central plan for this agent.
|
|
59
59
|
# An agent should only see tasks that are specifically for them and are ready to be worked on.
|
|
60
60
|
my_tasks = [
|
|
61
|
-
task for task in
|
|
62
|
-
if task.assignee_name == agent_name and
|
|
61
|
+
task for task in task_plan.tasks
|
|
62
|
+
if task.assignee_name == agent_name and task_plan.task_statuses.get(task.task_id) == TaskStatus.QUEUED
|
|
63
63
|
]
|
|
64
64
|
|
|
65
65
|
if not my_tasks:
|
|
@@ -71,7 +71,7 @@ class GetMyTasks(BaseTool):
|
|
|
71
71
|
TaskDefinitionSchema.model_validate(task).model_dump() for task in my_tasks
|
|
72
72
|
]
|
|
73
73
|
|
|
74
|
-
logger.info(f"Agent '{agent_name}' retrieved {len(tasks_for_llm)} tasks from the central task
|
|
74
|
+
logger.info(f"Agent '{agent_name}' retrieved {len(tasks_for_llm)} tasks from the central task plan.")
|
|
75
75
|
return json.dumps(tasks_for_llm, indent=2)
|
|
76
76
|
|
|
77
77
|
except Exception as e:
|
autobyteus/task_management/tools/{get_task_board_status.py → task_tools/get_task_plan_status.py}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# file: autobyteus/autobyteus/task_management/tools/
|
|
1
|
+
# file: autobyteus/autobyteus/task_management/tools/task_tools/get_task_plan_status.py
|
|
2
2
|
import json
|
|
3
3
|
import logging
|
|
4
4
|
from typing import TYPE_CHECKING, Optional
|
|
5
5
|
|
|
6
6
|
from autobyteus.tools.base_tool import BaseTool
|
|
7
7
|
from autobyteus.tools.tool_category import ToolCategory
|
|
8
|
-
from autobyteus.task_management.converters import
|
|
8
|
+
from autobyteus.task_management.converters import TaskPlanConverter
|
|
9
9
|
|
|
10
10
|
if TYPE_CHECKING:
|
|
11
11
|
from autobyteus.agent.context import AgentContext
|
|
@@ -13,19 +13,19 @@ if TYPE_CHECKING:
|
|
|
13
13
|
|
|
14
14
|
logger = logging.getLogger(__name__)
|
|
15
15
|
|
|
16
|
-
class
|
|
17
|
-
"""A tool for agents to get a current snapshot of the team's
|
|
16
|
+
class GetTaskPlanStatus(BaseTool):
|
|
17
|
+
"""A tool for agents to get a current snapshot of the team's TaskPlan."""
|
|
18
18
|
|
|
19
19
|
CATEGORY = ToolCategory.TASK_MANAGEMENT
|
|
20
20
|
|
|
21
21
|
@classmethod
|
|
22
22
|
def get_name(cls) -> str:
|
|
23
|
-
return "
|
|
23
|
+
return "get_task_plan_status"
|
|
24
24
|
|
|
25
25
|
@classmethod
|
|
26
26
|
def get_description(cls) -> str:
|
|
27
27
|
return (
|
|
28
|
-
"Retrieves the current status of the team's task
|
|
28
|
+
"Retrieves the current status of the team's task plan, including the status of all individual tasks. "
|
|
29
29
|
"Returns the status as a structured, LLM-friendly JSON string."
|
|
30
30
|
)
|
|
31
31
|
|
|
@@ -36,33 +36,33 @@ class GetTaskBoardStatus(BaseTool):
|
|
|
36
36
|
|
|
37
37
|
async def _execute(self, context: 'AgentContext') -> str:
|
|
38
38
|
"""
|
|
39
|
-
Executes the tool by fetching the task
|
|
39
|
+
Executes the tool by fetching the task plan and using a converter to
|
|
40
40
|
generate an LLM-friendly report.
|
|
41
41
|
"""
|
|
42
|
-
logger.info(f"Agent '{context.agent_id}' is executing
|
|
42
|
+
logger.info(f"Agent '{context.agent_id}' is executing get_task_plan_status.")
|
|
43
43
|
|
|
44
44
|
team_context: Optional['AgentTeamContext'] = context.custom_data.get("team_context")
|
|
45
45
|
if not team_context:
|
|
46
|
-
error_msg = "Error: Team context is not available to the agent. Cannot access the task
|
|
46
|
+
error_msg = "Error: Team context is not available to the agent. Cannot access the task plan."
|
|
47
47
|
logger.error(f"Agent '{context.agent_id}': {error_msg}")
|
|
48
48
|
return error_msg
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
if not
|
|
52
|
-
error_msg = "Error: Task
|
|
50
|
+
task_plan = getattr(team_context.state, 'task_plan', None)
|
|
51
|
+
if not task_plan:
|
|
52
|
+
error_msg = "Error: Task plan has not been initialized for this team."
|
|
53
53
|
logger.error(f"Agent '{context.agent_id}': {error_msg}")
|
|
54
54
|
return error_msg
|
|
55
55
|
|
|
56
56
|
try:
|
|
57
|
-
status_report_schema =
|
|
57
|
+
status_report_schema = TaskPlanConverter.to_schema(task_plan)
|
|
58
58
|
|
|
59
59
|
if not status_report_schema:
|
|
60
|
-
return "The task
|
|
60
|
+
return "The task plan is currently empty. No tasks have been published."
|
|
61
61
|
|
|
62
|
-
logger.info(f"Agent '{context.agent_id}' successfully retrieved and formatted task
|
|
62
|
+
logger.info(f"Agent '{context.agent_id}' successfully retrieved and formatted task plan status.")
|
|
63
63
|
return status_report_schema.model_dump_json(indent=2)
|
|
64
64
|
|
|
65
65
|
except Exception as e:
|
|
66
|
-
error_msg = f"An unexpected error occurred while retrieving or formatting task
|
|
66
|
+
error_msg = f"An unexpected error occurred while retrieving or formatting task plan status: {e}"
|
|
67
67
|
logger.error(f"Agent '{context.agent_id}': {error_msg}", exc_info=True)
|
|
68
68
|
return error_msg
|