versionhq 1.2.1.12__py3-none-any.whl → 1.2.1.13__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.
versionhq/__init__.py CHANGED
@@ -30,8 +30,10 @@ from versionhq.memory.model import ShortTermMemory,LongTermMemory, UserMemory, M
30
30
  from versionhq.task.formation import form_agent_network
31
31
  from versionhq.task_graph.draft import workflow
32
32
 
33
+ # from versionhq._utils.logger import Logger
33
34
 
34
- __version__ = "1.2.1.12"
35
+
36
+ __version__ = "1.2.1.13"
35
37
  __all__ = [
36
38
  "Agent",
37
39
 
@@ -91,4 +93,6 @@ __all__ = [
91
93
 
92
94
  "form_agent_network",
93
95
  "workflow",
96
+
97
+ # "Logger",
94
98
  ]
versionhq/agent/model.py CHANGED
@@ -3,7 +3,6 @@ import uuid
3
3
  from typing import Any, Dict, List, Optional, TypeVar, Callable, Type
4
4
  from typing_extensions import Self
5
5
  from dotenv import load_dotenv
6
- import litellm
7
6
 
8
7
  from pydantic import UUID4, BaseModel, Field, InstanceOf, PrivateAttr, model_validator, field_validator
9
8
  from pydantic_core import PydanticCustomError
@@ -57,9 +56,7 @@ class TokenProcess:
57
56
  # @track_agent()
58
57
  class Agent(BaseModel):
59
58
  """
60
- A class to store agent information.
61
- Agents must have `role`, `goal`, and `llm` = DEFAULT_MODEL_NAME as default.
62
- Then run validation on `backstory`, `llm`, `tools`, `rpm` (request per min), `knowledge`, and `memory`.
59
+ A Pydantic class to store an agent object. Agents must have `role` and `goal` to start.
63
60
  """
64
61
 
65
62
  __hash__ = object.__hash__
@@ -453,7 +450,6 @@ class Agent(BaseModel):
453
450
  return self
454
451
 
455
452
 
456
-
457
453
  def invoke(
458
454
  self,
459
455
  prompts: str,
@@ -515,8 +511,6 @@ class Agent(BaseModel):
515
511
  raise ValueError("Invalid response from LLM call - None or empty.")
516
512
 
517
513
 
518
-
519
-
520
514
  def execute_task(self, task, context: Optional[Any] = None, task_tools: Optional[List[Tool | ToolSet]] = list()) -> str:
521
515
  """
522
516
  Format a task prompt, adding context from knowledge and memory (if given), and invoke LLM.
@@ -582,5 +576,27 @@ class Agent(BaseModel):
582
576
  return raw_response
583
577
 
584
578
 
579
+ def start(self, context: Any = None) -> Any | None:
580
+ """
581
+ Defines and executes a task when it is not given and returns TaskOutput object.
582
+ """
583
+
584
+ if not self.goal or not self.role:
585
+ return None
586
+
587
+ from versionhq.task.model import Task, ResponseField
588
+
589
+ class Output(BaseModel):
590
+ steps: list[str]
591
+ conclution: str
592
+
593
+ task = Task(
594
+ description=f"List up first 3 steps that need to achieve {self.goal} in concise manner, then lead the conclusion in a sentence.",
595
+ pydantic_output=Output
596
+ )
597
+ res = task.execute(agent=self, context=context)
598
+ return res
599
+
600
+
585
601
  def __repr__(self):
586
602
  return f"Agent(role={self.role}, goal={self.goal}"
versionhq/task/model.py CHANGED
@@ -363,7 +363,7 @@ Response format: {response_format}
363
363
  Ref. Output image: {output_formats_to_follow}
364
364
  """
365
365
  else:
366
- output_prompt = "Return your response as a valid JSON serializable string, enclosed in double quotes. Do not use single quotes, trailing commas, or other non-standard JSON syntax."
366
+ output_prompt = "You MUST Return your response as a valid JSON serializable string, enclosed in double quotes. Do not use single quotes, trailing commas, or other non-standard JSON syntax."
367
367
 
368
368
  return dedent(output_prompt)
369
369
 
@@ -1,6 +1,6 @@
1
1
  import sys
2
2
  from typing import Type, Any
3
- from pydantic import BaseModel, create_model
3
+ from pydantic import BaseModel
4
4
  from pydantic._internal._model_construction import ModelMetaclass
5
5
  from textwrap import dedent
6
6
  if 'pydantic.main' not in sys.modules:
@@ -10,11 +10,11 @@ sys.modules['pydantic.main'].ModelMetaclass = ModelMetaclass
10
10
 
11
11
  from versionhq.agent.model import Agent
12
12
  from versionhq.task.model import ResponseField
13
- from versionhq.task_graph.model import TaskGraph, Task, DependencyType, Node, TaskStatus
13
+ from versionhq.task_graph.model import TaskGraph, Task, DependencyType, Node
14
14
  from versionhq._utils.logger import Logger
15
15
 
16
16
 
17
- def workflow(final_output: Type[BaseModel], context: Any = None, human: bool = True) -> TaskGraph | None:
17
+ def workflow(final_output: Type[BaseModel], context: Any = None, human: bool = False) -> TaskGraph | None:
18
18
  """
19
19
  Generate a TaskGraph object to generate the givne final_output most resource-efficiently.
20
20
  """
@@ -52,13 +52,12 @@ def workflow(final_output: Type[BaseModel], context: Any = None, human: bool = T
52
52
  description=dedent(f"Design a resource-efficient workflow to achieve the following goal: {final_output_prompt}. The workflow should consist of a list of detailed tasks that represent decision making points, each with the following information:\nname: A concise name of the task\ndescription: A concise description of the task.\nconnections: A list of target tasks that this task connects to.\ndependency_types: The type of dependency between this task and each of its connected task. \noutput: key output from the task in a word.\n\nUse the following dependency types: {dep_type_prompt}.\n\nPrioritize minimizing resource consumption (computation, memory, and data transfer) when defining tasks, connections, and dependencies. Consider how data is passed between tasks and aim to reduce unnecessary data duplication or transfer. Explain any design choices made to optimize resource usage."),
53
53
  response_fields=[
54
54
  ResponseField(title="tasks", data_type=list, items=dict, properties=[
55
- ResponseField(title="name", data_type=str),
56
- ResponseField(title="description", data_type=str),
57
- ResponseField(title="output", data_type=str),
58
- ResponseField(title="connections", data_type=list, items=str),
59
- ResponseField(title="dependency_types", data_type=list, items=str),
60
- ]
61
- )
55
+ ResponseField(title="name", data_type=str),
56
+ ResponseField(title="description", data_type=str),
57
+ ResponseField(title="output", data_type=str),
58
+ ResponseField(title="connections", data_type=list, items=str),
59
+ ResponseField(title="dependency_types", data_type=list, items=str),
60
+ ])
62
61
  ]
63
62
  )
64
63
  res = task.execute(agent=graph_expert, context=[context_prompt, context])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: versionhq
3
- Version: 1.2.1.12
3
+ Version: 1.2.1.13
4
4
  Summary: An agentic orchestration framework for building agent networks that handle task automation.
5
5
  Author-email: Kuriko Iwai <kuriko@versi0n.io>
6
6
  License: MIT License
@@ -1,4 +1,4 @@
1
- versionhq/__init__.py,sha256=uNfcqA6KXR3l8o5Df1_XZCdFKevMxrQ5ri-JJhTYJ1U,2883
1
+ versionhq/__init__.py,sha256=JeSzuFAJKO5pk2-obf9PaNAPyMmcKlEJfnRvdeuCImw,2946
2
2
  versionhq/_utils/__init__.py,sha256=dzoZr4cBlh-2QZuPzTdehPUCe9lP1dmRtauD7qTjUaA,158
3
3
  versionhq/_utils/i18n.py,sha256=TwA_PnYfDLA6VqlUDPuybdV9lgi3Frh_ASsb_X8jJo8,1483
4
4
  versionhq/_utils/logger.py,sha256=zgogTwAY-ujDLrdryAKhdtoaNe1nOFajmEN0V8aMR34,3155
@@ -7,7 +7,7 @@ versionhq/_utils/usage_metrics.py,sha256=NXF18dn5NNvGK7EsQ4AAghpR8ppYOjMx6ABenLL
7
7
  versionhq/_utils/vars.py,sha256=bZ5Dx_bFKlt3hi4-NNGXqdk7B23If_WaTIju2fiTyPQ,57
8
8
  versionhq/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  versionhq/agent/inhouse_agents.py,sha256=snDtgDmvZB2bZKH_RTcz5uFOMl3MTjLJwTQBebFt8hk,2532
10
- versionhq/agent/model.py,sha256=L21COegL50x1sl-1gZqYnICx8Gm276J0GnQx6IthXf8,25343
10
+ versionhq/agent/model.py,sha256=4wR-qftwtRjEH-LkXGk_LLI66EWtoLfv-p-8NjLmql0,25864
11
11
  versionhq/agent/parser.py,sha256=riG0dkdQCxH7uJ0AbdVdg7WvL0BXhUgJht0VtQvxJBc,4082
12
12
  versionhq/agent/rpm_controller.py,sha256=grezIxyBci_lDlwAlgWFRyR5KOocXeOhYkgN02dNFNE,2360
13
13
  versionhq/agent/TEMPLATES/Backstory.py,sha256=IAhGnnt6VUMe3wO6IzeyZPDNu7XE7Uiu3VEXUreOcKs,532
@@ -47,12 +47,12 @@ versionhq/task/evaluate.py,sha256=WdUgjbZL62XrxyWe5MTz29scfzwmuAHGxJ7GvAB8Fmk,39
47
47
  versionhq/task/formation.py,sha256=WH604q9bRmWH7KQCrk2qKJwisCopYX5CjJvsj4TgFjI,6894
48
48
  versionhq/task/formatter.py,sha256=N8Kmk9vtrMtBdgJ8J7RmlKNMdZWSmV8O1bDexmCWgU0,643
49
49
  versionhq/task/log_handler.py,sha256=LT7YnO7gcPR9IZS7eRvMjnHh8crMBFtqduxd8dxIbkk,1680
50
- versionhq/task/model.py,sha256=ASc7l5Lhm9tfINYGKtBikqaLAXbobPQNd0xKFv_IcS0,28529
50
+ versionhq/task/model.py,sha256=EcUW7nktGBd9CBenKLh-5HBRa02wrwYF6WeF8ju04tc,28538
51
51
  versionhq/task/structured_response.py,sha256=4q-hQPu7oMMHHXEzh9YW4SJ7N5eCZ7OfZ65juyl_jCI,5000
52
52
  versionhq/task/TEMPLATES/Description.py,sha256=V-4kh8xpQTKOcDMi2xnuP-fcNk6kuoz1_5tYBlDLQWQ,420
53
53
  versionhq/task_graph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  versionhq/task_graph/colors.py,sha256=naJCx4Vho4iuJtbW8USUXb-M5uYvd5ds2p8qbjUfRus,669
55
- versionhq/task_graph/draft.py,sha256=tEymdNbDXPXe88rvTdocpx22djhKV_TmSHa6lqkJ8fY,5158
55
+ versionhq/task_graph/draft.py,sha256=rt41kJ85g5l501K7PC-PVtn1oWmKABKsznorfivcDpc,5096
56
56
  versionhq/task_graph/model.py,sha256=njyHQyHrVTZP46iVkC6YvuMnGcS40vOy1wszRtf7DHY,23971
57
57
  versionhq/tool/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
58
  versionhq/tool/cache_handler.py,sha256=iL8FH7X0G-cdT0uhJwzuhLDaadTXOdfybZcDy151-es,1085
@@ -61,8 +61,8 @@ versionhq/tool/composio_tool_vars.py,sha256=FvBuEXsOQUYnN7RTFxT20kAkiEYkxWKkiVtg
61
61
  versionhq/tool/decorator.py,sha256=C4ZM7Xi2gwtEMaSeRo-geo_g_MAkY77WkSLkAuY0AyI,1205
62
62
  versionhq/tool/model.py,sha256=PO4zNWBZcJhYVur381YL1dy6zqurio2jWjtbxOxZMGI,12194
63
63
  versionhq/tool/tool_handler.py,sha256=2m41K8qo5bGCCbwMFferEjT-XZ-mE9F0mDUOBkgivOI,1416
64
- versionhq-1.2.1.12.dist-info/LICENSE,sha256=cRoGGdM73IiDs6nDWKqPlgSv7aR4n-qBXYnJlCMHCeE,1082
65
- versionhq-1.2.1.12.dist-info/METADATA,sha256=AMSEfWE5CXam7k5CpDG-3Ne8Ci-_uzpaDalsjSAHUSM,22033
66
- versionhq-1.2.1.12.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
67
- versionhq-1.2.1.12.dist-info/top_level.txt,sha256=DClQwxDWqIUGeRJkA8vBlgeNsYZs4_nJWMonzFt5Wj0,10
68
- versionhq-1.2.1.12.dist-info/RECORD,,
64
+ versionhq-1.2.1.13.dist-info/LICENSE,sha256=cRoGGdM73IiDs6nDWKqPlgSv7aR4n-qBXYnJlCMHCeE,1082
65
+ versionhq-1.2.1.13.dist-info/METADATA,sha256=xHoEzKWyIEMy_mx1RSvhOYhWp-JvYfvcHARbY8kRHIA,22033
66
+ versionhq-1.2.1.13.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
67
+ versionhq-1.2.1.13.dist-info/top_level.txt,sha256=DClQwxDWqIUGeRJkA8vBlgeNsYZs4_nJWMonzFt5Wj0,10
68
+ versionhq-1.2.1.13.dist-info/RECORD,,