pybotchi 3.4.4__tar.gz → 3.5.0__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 (46) hide show
  1. {pybotchi-3.4.4 → pybotchi-3.5.0}/PKG-INFO +1 -1
  2. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/grpc/cli.py +0 -1
  3. {pybotchi-3.4.4 → pybotchi-3.5.0}/pyproject.toml +1 -1
  4. pybotchi-3.4.4/pybotchi/__init__.pyi +0 -6
  5. pybotchi-3.4.4/pybotchi/action.pyi +0 -80
  6. pybotchi-3.4.4/pybotchi/common.pyi +0 -85
  7. pybotchi-3.4.4/pybotchi/context.pyi +0 -45
  8. pybotchi-3.4.4/pybotchi/grpc/__init__.pyi +0 -5
  9. pybotchi-3.4.4/pybotchi/grpc/action.pyi +0 -65
  10. pybotchi-3.4.4/pybotchi/grpc/cli.pyi +0 -12
  11. pybotchi-3.4.4/pybotchi/grpc/common.pyi +0 -60
  12. pybotchi-3.4.4/pybotchi/grpc/context.pyi +0 -25
  13. pybotchi-3.4.4/pybotchi/grpc/exception.pyi +0 -8
  14. pybotchi-3.4.4/pybotchi/grpc/handler.pyi +0 -30
  15. pybotchi-3.4.4/pybotchi/grpc/pybotchi_pb2_grpc.pyi +0 -67
  16. pybotchi-3.4.4/pybotchi/grpc/utils.pyi +0 -3
  17. pybotchi-3.4.4/pybotchi/llm.pyi +0 -22
  18. pybotchi-3.4.4/pybotchi/mcp/__init__.pyi +0 -5
  19. pybotchi-3.4.4/pybotchi/mcp/action.pyi +0 -66
  20. pybotchi-3.4.4/pybotchi/mcp/common.pyi +0 -60
  21. pybotchi-3.4.4/pybotchi/mcp/context.pyi +0 -9
  22. pybotchi-3.4.4/pybotchi/utils.pyi +0 -13
  23. {pybotchi-3.4.4 → pybotchi-3.5.0}/LICENSE +0 -0
  24. {pybotchi-3.4.4 → pybotchi-3.5.0}/README.md +0 -0
  25. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/__init__.py +0 -0
  26. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/action.py +0 -0
  27. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/common.py +0 -0
  28. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/context.py +0 -0
  29. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/grpc/__init__.py +0 -0
  30. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/grpc/action.py +0 -0
  31. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/grpc/common.py +0 -0
  32. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/grpc/context.py +0 -0
  33. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/grpc/exception.py +0 -0
  34. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/grpc/handler.py +0 -0
  35. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/grpc/pybotchi.proto +0 -0
  36. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/grpc/pybotchi_pb2.py +0 -0
  37. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/grpc/pybotchi_pb2.pyi +0 -0
  38. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/grpc/pybotchi_pb2_grpc.py +0 -0
  39. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/grpc/utils.py +0 -0
  40. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/llm.py +0 -0
  41. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/mcp/__init__.py +0 -0
  42. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/mcp/action.py +0 -0
  43. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/mcp/common.py +0 -0
  44. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/mcp/context.py +0 -0
  45. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/py.typed +0 -0
  46. {pybotchi-3.4.4 → pybotchi-3.5.0}/pybotchi/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pybotchi
3
- Version: 3.4.4
3
+ Version: 3.5.0
4
4
  Summary: A deterministic, intent-based AI agent builder.
5
5
  License-File: LICENSE
6
6
  Author: Alexie (Boyong) Madolid
@@ -234,7 +234,6 @@ def compile() -> None:
234
234
  f"--python_out={current_dir}",
235
235
  f"--pyi_out={current_dir}",
236
236
  f"--grpc_python_out={current_dir}",
237
- f"--mypy_grpc_out={current_dir}",
238
237
  "pybotchi.proto",
239
238
  ]
240
239
  )
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pybotchi"
3
- version = "3.4.4"
3
+ version = "3.5.0"
4
4
  description = "A deterministic, intent-based AI agent builder."
5
5
  authors = ["Alexie (Boyong) Madolid <madolid.alexie@gmail.com>"]
6
6
  readme = "README.md"
@@ -1,6 +0,0 @@
1
- from .action import Action as Action, DEFAULT_ACTION as DEFAULT_ACTION, all_agents as all_agents, graph as graph
2
- from .common import ActionReturn as ActionReturn, ChatRole as ChatRole, Groups as Groups, UsageMetadata as UsageMetadata
3
- from .context import Context as Context
4
- from .llm import LLM as LLM
5
-
6
- __all__ = ['Action', 'DEFAULT_ACTION', 'all_agents', 'graph', 'ActionReturn', 'ChatRole', 'Groups', 'UsageMetadata', 'Context', 'LLM']
@@ -1,80 +0,0 @@
1
- from .common import ActionEntry as ActionEntry, ActionReturn as ActionReturn, ConcurrentBreakPoint as ConcurrentBreakPoint, Graph as Graph, Groups as Groups, ToolCall as ToolCall, UsageData as UsageData
2
- from .context import Context as Context
3
- from .utils import apply_placeholders as apply_placeholders, unwrap_exceptions as unwrap_exceptions, uuid as uuid
4
- from collections.abc import Generator
5
- from pydantic import BaseModel
6
- from typing import Any, Generic, Literal, TypeVar
7
-
8
- DEFAULT_ACTION: str
9
- DEFAULT_TOOL_CALL_PROMPT: str
10
- DEFAULT_MAX_ITERATION_PROMPT: str
11
- TAction = TypeVar('TAction', bound='Action')
12
- TContext = TypeVar('TContext', bound='Context')
13
- T = TypeVar('T')
14
- type ChildActions = dict[str, type['Action']]
15
-
16
- class Action(BaseModel, Generic[TContext]):
17
- __enabled__: bool
18
- __system_prompt__: str | None
19
- __tool_call_prompt__: str | None
20
- __max_iteration_prompt__: str | None
21
- __temperature__: float | None
22
- __max_tool_prompts__: int | None
23
- __default_tool__ = DEFAULT_ACTION
24
- __first_tool_only__: bool
25
- __concurrent__: bool
26
- __has_pre__: bool
27
- __has_fallback__: bool
28
- __has_on_child_init_error__: bool
29
- __has_on_error__: bool
30
- __has_post__: bool
31
- __has_as_tool__: bool
32
- __detached__: bool
33
- __max_iteration__: int | None
34
- __max_child_iteration__: int | None
35
- __child_actions__: ChildActions
36
- __agent__: bool
37
- __display_name__: str
38
- __groups__: Groups | set[str] | None
39
- __to_commit__: bool
40
- _usage: list[UsageData]
41
- _actions: list[Action | ActionEntry]
42
- _parent: Action | None
43
- _children: list['Action']
44
- @classmethod
45
- def __pydantic_init_subclass__(cls, **kwargs: Any) -> None: ...
46
- @classmethod
47
- def __init_child_actions__(cls) -> None: ...
48
- @property
49
- def _tool_call(self) -> ToolCall: ...
50
- @classmethod
51
- async def _as_tool(cls, context: TContext) -> dict[str, Any] | type[BaseModel]: ...
52
- async def pre(self, context: TContext) -> ActionReturn: ...
53
- async def fallback(self, context: TContext, content: str) -> ActionReturn: ...
54
- async def on_child_init_error(self, context: TContext, next_actions: list['Action'], child_cls: type[Action], child_args: dict[str, Any], exception: Exception) -> str | None: ...
55
- async def on_error(self, context: TContext, exception: Exception, unwrapped_exceptions: Generator[Exception, None, None]) -> ActionReturn: ...
56
- async def on_max_iteration(self, context: TContext) -> ActionReturn: ...
57
- async def post(self, context: TContext) -> ActionReturn: ...
58
- async def commit_context(self, parent: TContext, child: TContext) -> None: ...
59
- def child_selection_prompt(self, context: TContext, tool_choice: str) -> str: ...
60
- def max_iteration_prompt(self, context: TContext) -> str: ...
61
- async def get_child_actions(self, context: TContext) -> ChildActions: ...
62
- async def child_selection(self, context: TContext, child_actions: ChildActions | None = None) -> tuple[list['Action'], str]: ...
63
- async def execute(self, context: TContext, parent: Action | None = None, append: bool = True) -> ActionReturn: ...
64
- async def execute_concurrently(self, context: TContext, parent: Action | None = None, append: bool = True) -> None: ...
65
- async def execution(self, context: TContext) -> ActionReturn: ...
66
- async def concurrent_children_execution(self, context: TContext, next_actions: list[Action]) -> ActionReturn: ...
67
- async def sequential_children_execution(self, context: TContext, next_actions: list[Action]) -> ActionReturn: ...
68
- def serialize(self, mode: str | Literal['python', 'json'] = 'python') -> ActionEntry: ...
69
- @classmethod
70
- def add_child(cls, action: type['Action'], name: str | None = None, override: bool = False, extended: bool = True) -> None: ...
71
- @classmethod
72
- def add_grand_child(cls, action: type['Action'], name: str | None = None, override: bool = False, extended: bool = True) -> None: ...
73
- @classmethod
74
- def remove_child(cls, name: str) -> None: ...
75
- @classmethod
76
- def remove_grand_child(cls, name: str) -> None: ...
77
-
78
- def all_agents() -> Generator[type['Action']]: ...
79
- async def graph(action: type[Action], allowed_actions: dict[str, bool] | None = None) -> Graph: ...
80
- async def traverse(graph: Graph, action: type[Action], allowed_actions: dict[str, bool] | None) -> None: ...
@@ -1,85 +0,0 @@
1
- from enum import StrEnum
2
- from functools import cached_property as cached_property
3
- from pydantic import BaseModel, ConfigDict, SkipValidation as SkipValidation
4
- from typing import Annotated, Any, ClassVar, Literal, NotRequired, Required, TypedDict
5
-
6
- class ChatRole(StrEnum):
7
- USER = 'user'
8
- SYSTEM = 'system'
9
- ASSISTANT = 'assistant'
10
- TOOL = 'tool'
11
- DEVELOPER = 'developer'
12
-
13
- class InputTokenDetails(TypedDict, total=False):
14
- audio: float
15
- cache_creation: float
16
- cache_read: float
17
-
18
- class OutputTokenDetails(TypedDict, total=False):
19
- audio: float
20
- reasoning: float
21
-
22
- class UsageMetadata(TypedDict):
23
- input_tokens: float
24
- output_tokens: float
25
- total_tokens: float
26
- input_token_details: NotRequired[InputTokenDetails]
27
- output_token_details: NotRequired[OutputTokenDetails]
28
-
29
- class UsageData(TypedDict):
30
- name: str | None
31
- model: str
32
- usage: UsageMetadata
33
-
34
- class ActionItem(TypedDict):
35
- name: str
36
- args: dict[str, Any]
37
- usages: list[UsageData]
38
-
39
- class ActionEntry(ActionItem):
40
- actions: list['ActionEntry']
41
-
42
- class Groups(TypedDict, total=False):
43
- grpc: set[str]
44
- mcp: set[str]
45
- a2a: set[str]
46
-
47
- class Function(TypedDict, total=False):
48
- arguments: Required[str]
49
- name: Required[str]
50
-
51
- class ToolCall(TypedDict, total=False):
52
- id: Required[str]
53
- function: Required[Function]
54
- type: Required[Literal['function']]
55
-
56
- class Graph(BaseModel):
57
- origin: str | None
58
- nodes: set[str]
59
- edges: set[tuple[str, str, bool, str]]
60
- def flowchart(self) -> str: ...
61
-
62
- class ActionReturn(BaseModel):
63
- value: Annotated[Any, None]
64
- GO: ClassVar['Go']
65
- BREAK: ClassVar['Break']
66
- END: ClassVar['End']
67
- model_config: ClassVar[ConfigDict]
68
- @staticmethod
69
- def end(value: Any) -> End: ...
70
- @staticmethod
71
- def go(value: Any) -> Go: ...
72
- @cached_property
73
- def is_break(self) -> bool: ...
74
- @cached_property
75
- def is_end(self) -> bool: ...
76
-
77
- class Go(ActionReturn): ...
78
- class Break(ActionReturn): ...
79
- class End(Break): ...
80
-
81
- class ConcurrentBreakPoint(Exception):
82
- action_return: ActionReturn
83
- def __init__(self, action_return: ActionReturn) -> None: ...
84
-
85
- UNSPECIFIED: str
@@ -1,45 +0,0 @@
1
- from .action import Action as Action, ActionReturn as ActionReturn, T as T, TAction as TAction
2
- from .common import ChatRole as ChatRole, ToolCall as ToolCall, UNSPECIFIED as UNSPECIFIED, UsageMetadata as UsageMetadata
3
- from .llm import LLM as LLM
4
- from asyncio import Future
5
- from collections.abc import Callable as Callable, Coroutine, Iterator
6
- from concurrent.futures import Executor
7
- from functools import cached_property as cached_property
8
- from langchain_core.language_models.chat_models import BaseChatModel
9
- from pydantic import BaseModel
10
- from typing import Any, Generic, ParamSpec, Self
11
- from typing_extensions import TypeVar
12
-
13
- TContext = TypeVar('TContext', bound='Context', default='Context')
14
- TLLM = TypeVar('TLLM', default=BaseChatModel)
15
- P = ParamSpec('P')
16
-
17
- class Context(BaseModel, Generic[TLLM]):
18
- prompts: list[dict[str, Any]]
19
- allowed_actions: dict[str, bool]
20
- metadata: dict[str, Any]
21
- usages: dict[str, UsageMetadata]
22
- streaming: bool
23
- max_self_loop: int | None
24
- parent: Self | None
25
- _action_call: dict[str, int]
26
- @cached_property
27
- def llm(self) -> TLLM: ...
28
- @cached_property
29
- def llm_model(self) -> str: ...
30
- def shifted_prompts(self, offset: int | None) -> Iterator[dict[str, Any]]: ...
31
- async def start(self, action: type[TAction], /, **kwargs: Any) -> tuple[TAction, ActionReturn]: ...
32
- def check_self_recursion(self, action: Action) -> bool: ...
33
- async def merge_to_usages(self, model: str, usage: UsageMetadata) -> None: ...
34
- async def add_usage(self, action: Action, model: str | None, usage: UsageMetadata | None, name: str | None = None, raise_error: bool = False) -> None: ...
35
- async def add_message(self, role: ChatRole, content: str, metadata: dict[str, Any] | None = None) -> None: ...
36
- async def add_response(self, action: Action | ToolCall, content: str, metadata: dict[str, Any] | None = None) -> None: ...
37
- async def set_metadata(self, *paths: Any, value: Any, update: bool = False) -> None: ...
38
- async def update_metadata(self, *paths: Any, value: Any) -> None: ...
39
- async def notify(self, message: dict[str, Any]) -> None: ...
40
- def run_new_event_loop(self, task: Coroutine[Any, Any, T]) -> T: ...
41
- def run_task_in_thread(self, task: Coroutine[Any, Any, T], executor: Executor | None = None) -> Future[T]: ...
42
- def run_func_in_thread(self, task: Callable[P, T], executor: Executor | None = None, *args: P.args, **kwargs: P.kwargs) -> Future[T]: ...
43
- async def detach_context(self) -> TContext: ...
44
- def detached_kwargs(self, **kwargs: Any) -> dict[str, Any]: ...
45
- async def detached_start(self, action: type['Action'], /, **kwargs: Any) -> tuple[TContext, 'Action', ActionReturn]: ...
@@ -1,5 +0,0 @@
1
- from .action import GRPCAction as GRPCAction, GRPCRemoteAction as GRPCRemoteAction, graph as graph
2
- from .common import GRPCConfig as GRPCConfig, GRPCConnection as GRPCConnection, GRPCIntegration as GRPCIntegration
3
- from .context import GRPCContext as GRPCContext
4
-
5
- __all__ = ['GRPCAction', 'GRPCRemoteAction', 'graph', 'GRPCConfig', 'GRPCConnection', 'GRPCIntegration', 'GRPCContext']
@@ -1,65 +0,0 @@
1
- from ..action import Action as Action, ChildActions as ChildActions
2
- from ..common import ActionReturn as ActionReturn, Graph as Graph
3
- from ..utils import unwrap_exceptions as unwrap_exceptions
4
- from .common import GRPCConfigLoaded as GRPCConfigLoaded, GRPCConnection as GRPCConnection, GRPCIntegration as GRPCIntegration
5
- from .context import TContext as TContext
6
- from .exception import GRPCRemoteError as GRPCRemoteError
7
- from .pybotchi_pb2 import ActionListRequest as ActionListRequest, ActionListResponse as ActionListResponse, ActionSchema as ActionSchema, Event as Event, TraverseGraph as TraverseGraph, TraverseRequest as TraverseRequest
8
- from .pybotchi_pb2_grpc import PyBotchiGRPCStub as PyBotchiGRPCStub
9
- from asyncio import Queue
10
- from collections.abc import AsyncGenerator, AsyncIterator
11
- from contextlib import asynccontextmanager
12
- from datamodel_code_generator.model import DataModelSet as DataModelSet
13
- from typing import Any, Generic
14
-
15
- DMT: DataModelSet
16
-
17
- class GRPCClient:
18
- stub: PyBotchiGRPCStub
19
- name: str
20
- config: GRPCConfigLoaded
21
- manual_enable: bool
22
- allowed_actions: dict[str, bool]
23
- remote_action_class: type['GRPCRemoteAction']
24
- exclude_unset: bool
25
- def __init__(self, stub: PyBotchiGRPCStub, name: str, config: GRPCConfigLoaded, manual_enable: bool, allowed_actions: dict[str, bool], remote_action_class: type['GRPCRemoteAction'] | None, exclude_unset: bool) -> None: ...
26
- def build_action(self, agent_id: str, action_schema: ActionSchema) -> tuple[str, type['GRPCRemoteAction']]: ...
27
- async def patch_actions(self, actions: ChildActions, grpc_actions: ChildActions) -> ChildActions: ...
28
-
29
- class GRPCAction(Action[TContext]):
30
- __grpc_clients__: dict[str, GRPCClient]
31
- __grpc_connections__: list[GRPCConnection]
32
- __grpc_tool_actions__: ChildActions
33
- __has_pre_grpc__: bool
34
- @classmethod
35
- def __pydantic_init_subclass__(cls, **kwargs: Any) -> None: ...
36
- @classmethod
37
- def __init_child_actions__(cls) -> None: ...
38
- async def pre_grpc(self, context: TContext) -> ActionReturn: ...
39
- _parent: Action | None
40
- __to_commit__: bool
41
- async def execute(self, context: TContext, parent: Action | None = None, append: bool = True) -> ActionReturn: ...
42
- async def get_child_actions(self, context: TContext) -> ChildActions: ...
43
- @classmethod
44
- def add_child(cls, action: type['Action'], name: str | None = None, override: bool = False, extended: bool = True) -> None: ...
45
-
46
- class GRPCRemoteAction(Action[TContext], Generic[TContext]):
47
- __grpc_action__: bool
48
- __grpc_client__: GRPCClient
49
- __grpc_group__: str
50
- __grpc_action_name__: str
51
- __grpc_exclude_unset__: bool
52
- __grpc_queue__: Queue[Event]
53
- async def grpc_event_close(self, context: TContext, event: Event) -> None: ...
54
- async def grpc_event_error(self, context: TContext, event: Event) -> None: ...
55
- async def grpc_event_update(self, context: TContext, event: Event) -> None: ...
56
- async def grpc_queue(self, context: TContext) -> AsyncGenerator[Event, None]: ...
57
- async def grpc_send(self, name: str, data: dict[str, Any] | None = None) -> None: ...
58
- async def grpc_consume(self, context: TContext, event: Event) -> None: ...
59
- async def grpc_connect(self, context: TContext, payload: dict[str, Any], metadata: dict[str, Any] | None = None) -> AsyncGenerator[Event, None]: ...
60
- async def pre(self, context: TContext) -> ActionReturn: ...
61
-
62
- @asynccontextmanager
63
- async def multi_grpc_clients(integrations: dict[str, GRPCIntegration], connections: list[GRPCConnection], bypass: bool = False) -> AsyncIterator[dict[str, GRPCClient]]: ...
64
- async def graph(action: type[Action], allowed_actions: dict[str, bool] | None = None, integrations: dict[str, GRPCIntegration] | None = None, bypass: bool = False) -> Graph: ...
65
- async def traverse(graph: Graph, action: type[Action], allowed_actions: dict[str, bool] | None, integrations: dict[str, GRPCIntegration], bypass: bool = False, module: str | None = None, alias: str | None = None) -> None: ...
@@ -1,12 +0,0 @@
1
- from multiprocessing import Process
2
- from pybotchi import Action as Action
3
- from pybotchi.utils import uuid as uuid
4
- from types import FrameType
5
-
6
- PROCESSES: list[Process]
7
-
8
- async def serve(id: str, path: str, host: str, port: str, root_certificates: bytes | None, private_key: bytes | None, certificate_chain: bytes | None, require_client_auth: bool) -> None: ...
9
- def terminate(sig: int, frame: FrameType | None) -> None: ...
10
- def start(id: str, path: str, host: str, port: str, root_certificates: bytes | None, private_key: bytes | None, certificate_chain: bytes | None, require_client_auth: bool) -> None: ...
11
- def main(path: str, id: str | None, host: str | None, port: str | None, workers: str | None, root_certificates: str | None, private_key: str | None, certificate_chain: str | None, require_client_auth: bool) -> None: ...
12
- def compile() -> None: ...
@@ -1,60 +0,0 @@
1
- from .action import GRPCRemoteAction as GRPCRemoteAction
2
- from .utils import read_cert as read_cert
3
- from enum import StrEnum
4
- from grpc.aio import ClientInterceptor as ClientInterceptor
5
- from typing import Any, Sequence, TypedDict
6
-
7
- class GRPCCompression(StrEnum):
8
- NoCompression = 'NoCompression'
9
- Deflate = 'Deflate'
10
- Gzip = 'Gzip'
11
-
12
- class GRPCConfig(TypedDict, total=False):
13
- secure: bool
14
- url: str
15
- groups: list[str]
16
- root_certificates: str | bytes | None
17
- private_key: str | bytes | None
18
- certificate_chain: str | bytes | None
19
- options: list[tuple[str, Any]] | None
20
- compression: GRPCCompression | None
21
- metadata: dict[str, Any] | None
22
- allow_exec: bool
23
-
24
- class GRPCConfigLoaded(TypedDict):
25
- url: str
26
- groups: list[str]
27
- secure: bool
28
- root_certificates: bytes | None
29
- private_key: bytes | None
30
- certificate_chain: bytes | None
31
- options: list[tuple[str, Any]] | None
32
- compression: GRPCCompression | None
33
- metadata: dict[str, Any] | None
34
- allow_exec: bool
35
-
36
- class GRPCIntegration(TypedDict, total=False):
37
- config: GRPCConfig
38
- allowed_actions: dict[str, bool]
39
- exclude_unset: bool
40
-
41
- class GRPCConnection:
42
- name: str
43
- url: str
44
- groups: list[str]
45
- secure: bool
46
- root_certificates: str | bytes | None
47
- private_key: str | bytes | None
48
- certificate_chain: str | bytes | None
49
- options: list[tuple[str, Any]] | None
50
- compression: GRPCCompression | None
51
- interceptors: Sequence[ClientInterceptor] | None
52
- metadata: dict[str, Any] | None
53
- allow_exec: bool
54
- manual_enable: bool
55
- allowed_actions: dict[str, bool]
56
- remote_action_class: type['GRPCRemoteAction'] | None
57
- exclude_unset: bool
58
- require_integration: bool
59
- def __init__(self, name: str, url: str = '', groups: list[str] | None = None, secure: bool = False, root_certificates: str | bytes | None = None, private_key: str | bytes | None = None, certificate_chain: str | bytes | None = None, options: list[tuple[str, Any]] | None = None, compression: GRPCCompression | None = None, interceptors: Sequence[ClientInterceptor] | None = None, metadata: dict[str, Any] | None = None, allow_exec: bool = False, manual_enable: bool = False, allowed_actions: dict[str, bool] | None = None, remote_action_class: type['GRPCRemoteAction'] | None = None, exclude_unset: bool = True, require_integration: bool = True) -> None: ...
60
- async def get_config(self, override: GRPCConfig | None) -> GRPCConfigLoaded: ...
@@ -1,25 +0,0 @@
1
- from ..common import ToolCall as ToolCall
2
- from ..context import Action as Action, ChatRole as ChatRole, Context as Context, TLLM as TLLM
3
- from ..utils import uuid as uuid
4
- from .common import GRPCIntegration as GRPCIntegration
5
- from .pybotchi_pb2 import Event as Event
6
- from asyncio import Queue
7
- from typing import Any, Generic, TypeVar
8
-
9
- TContext = TypeVar('TContext', bound='GRPCContext')
10
-
11
- class GRPCContext(Context[TLLM], Generic[TLLM]):
12
- integrations: dict[str, GRPCIntegration]
13
- source_id: str | None
14
- context_id: str
15
- _response_queue: Queue[Event] | None
16
- _request_queues: dict[str, Queue]
17
- def grpc_dump(self) -> dict[str, Any]: ...
18
- def grpc_sharing_dump(self) -> dict[str, Any]: ...
19
- async def grpc_send_up(self, source_id: str | None, name: str, data: dict[str, Any]) -> None: ...
20
- async def grpc_send_down(self, source_id: str | None, name: str, data: dict[str, Any]) -> None: ...
21
- def detached_kwargs(self, **kwargs: Any) -> dict[str, Any]: ...
22
- async def add_message(self, role: ChatRole, content: str, metadata: dict[str, Any] | None = None, source_id: str | None = None) -> None: ...
23
- async def add_response(self, action: Action | ToolCall, content: str, metadata: dict[str, Any] | None = None, source_id: str | None = None) -> None: ...
24
- async def set_metadata(self, *paths: Any, value: Any, update: bool = False, source_id: str | None = None) -> None: ...
25
- async def notify(self, message: dict[str, Any]) -> None: ...
@@ -1,8 +0,0 @@
1
- class GRPCRemoteError(Exception):
2
- cls: str
3
- alias: str
4
- type: str
5
- message: str
6
- tracebacks: list[str]
7
- def __init__(self, cls: str, alias: str, type: str, message: str, tracebacks: list[str]) -> None: ...
8
- def __str__(self) -> str: ...
@@ -1,30 +0,0 @@
1
- from ..action import Action as Action
2
- from ..common import Graph as Graph
3
- from ..utils import uuid as uuid
4
- from .action import traverse as traverse
5
- from .context import GRPCContext as GRPCContext, TContext as TContext
6
- from .exception import GRPCRemoteError as GRPCRemoteError
7
- from .pybotchi_pb2 import ActionListRequest as ActionListRequest, ActionListResponse as ActionListResponse, ActionSchema as ActionSchema, Edge as Edge, Event as Event, JSONSchema as JSONSchema, TraverseGraph as TraverseGraph, TraverseRequest as TraverseRequest
8
- from .pybotchi_pb2_grpc import PyBotchiGRPCServicer as PyBotchiGRPCServicer
9
- from asyncio import Queue
10
- from collections.abc import AsyncGenerator, AsyncIterator
11
- from grpc.aio import Metadata as Metadata, ServicerContext as ServicerContext
12
- from typing import Generic
13
-
14
- class PyBotchiGRPC(PyBotchiGRPCServicer, Generic[TContext]):
15
- __context_class__: type[TContext]
16
- __allow_exec__: bool
17
- id: str
18
- module: str
19
- groups: dict[str, dict[str, type[Action]]]
20
- __has_validate_metadata__: bool
21
- def __init__(self, id: str, module: str, groups: dict[str, dict[str, type[Action]]]) -> None: ...
22
- async def validate_metadata(self, metadata: Metadata | None) -> None: ...
23
- async def consume(self, context: TContext, groups: list[str], events: AsyncIterator[Event]) -> None: ...
24
- async def grpc_event_execute(self, context: TContext, groups: list[str], event: Event) -> None: ...
25
- async def grpc_event_update(self, context: TContext, groups: list[str], event: Event) -> None: ...
26
- async def accept(self, events: AsyncIterator[Event], context: ServicerContext) -> Queue[Event]: ...
27
- async def execute_connect(self, request_iterator: AsyncIterator[Event], context: ServicerContext) -> AsyncGenerator[Event, None]: ...
28
- async def connect(self, request_iterator: AsyncIterator[Event], context: ServicerContext) -> AsyncGenerator[Event, None]: ...
29
- async def action_list(self, request: ActionListRequest, context: ServicerContext) -> ActionListResponse: ...
30
- async def traverse(self, request: TraverseRequest, context: ServicerContext) -> TraverseGraph: ...
@@ -1,67 +0,0 @@
1
- """
2
- @generated by mypy-protobuf. Do not edit manually!
3
- isort:skip_file
4
- """
5
-
6
- from collections import abc as _abc
7
- from grpc import aio as _aio
8
- import abc as _abc_1
9
- import grpc as _grpc
10
- import pybotchi_pb2 as _pybotchi_pb2
11
- import sys
12
- import typing as _typing
13
-
14
- if sys.version_info >= (3, 11):
15
- from typing import Self as _Self
16
- else:
17
- from typing_extensions import Self as _Self
18
-
19
- _T = _typing.TypeVar("_T")
20
-
21
- class _MaybeAsyncIterator(_abc.AsyncIterator[_T], _abc.Iterator[_T], metaclass=_abc_1.ABCMeta): ...
22
-
23
- class _ServicerContext(_grpc.ServicerContext, _aio.ServicerContext): # type: ignore[misc, type-arg]
24
- ...
25
-
26
- GRPC_GENERATED_VERSION: str
27
- GRPC_VERSION: str
28
-
29
- class PyBotchiGRPCStub:
30
- @_typing.overload
31
- def __new__(cls, channel: _grpc.Channel) -> _Self: ...
32
- @_typing.overload
33
- def __new__(cls, channel: _aio.Channel) -> PyBotchiGRPCAsyncStub: ...
34
- connect: _grpc.StreamStreamMultiCallable[_pybotchi_pb2.Event, _pybotchi_pb2.Event]
35
- action_list: _grpc.UnaryUnaryMultiCallable[_pybotchi_pb2.ActionListRequest, _pybotchi_pb2.ActionListResponse]
36
- traverse: _grpc.UnaryUnaryMultiCallable[_pybotchi_pb2.TraverseRequest, _pybotchi_pb2.TraverseGraph]
37
-
38
- @_typing.type_check_only
39
- class PyBotchiGRPCAsyncStub(PyBotchiGRPCStub):
40
- def __init__(self, channel: _aio.Channel) -> None: ...
41
- connect: _aio.StreamStreamMultiCallable[_pybotchi_pb2.Event, _pybotchi_pb2.Event] # type: ignore[assignment]
42
- action_list: _aio.UnaryUnaryMultiCallable[_pybotchi_pb2.ActionListRequest, _pybotchi_pb2.ActionListResponse] # type: ignore[assignment]
43
- traverse: _aio.UnaryUnaryMultiCallable[_pybotchi_pb2.TraverseRequest, _pybotchi_pb2.TraverseGraph] # type: ignore[assignment]
44
-
45
- class PyBotchiGRPCServicer(metaclass=_abc_1.ABCMeta):
46
- @_abc_1.abstractmethod
47
- def connect(
48
- self,
49
- request_iterator: _MaybeAsyncIterator[_pybotchi_pb2.Event],
50
- context: _ServicerContext,
51
- ) -> _typing.Union[_abc.Iterator[_pybotchi_pb2.Event], _abc.AsyncIterator[_pybotchi_pb2.Event]]: ...
52
-
53
- @_abc_1.abstractmethod
54
- def action_list(
55
- self,
56
- request: _pybotchi_pb2.ActionListRequest,
57
- context: _ServicerContext,
58
- ) -> _typing.Union[_pybotchi_pb2.ActionListResponse, _abc.Awaitable[_pybotchi_pb2.ActionListResponse]]: ...
59
-
60
- @_abc_1.abstractmethod
61
- def traverse(
62
- self,
63
- request: _pybotchi_pb2.TraverseRequest,
64
- context: _ServicerContext,
65
- ) -> _typing.Union[_pybotchi_pb2.TraverseGraph, _abc.Awaitable[_pybotchi_pb2.TraverseGraph]]: ...
66
-
67
- def add_PyBotchiGRPCServicer_to_server(servicer: PyBotchiGRPCServicer, server: _typing.Union[_grpc.Server, _aio.Server]) -> None: ...
@@ -1,3 +0,0 @@
1
- CERT_CACHE: dict[str, bytes]
2
-
3
- async def read_cert(path: str) -> bytes: ...
@@ -1,22 +0,0 @@
1
- from typing import Any, Literal, TypeVar, overload
2
-
3
- T = TypeVar('T')
4
-
5
- class LLM:
6
- __instances__: dict[str, Any]
7
- @classmethod
8
- def add(cls, **llms: Any) -> None: ...
9
- @classmethod
10
- def base(cls, _: type[T] | None = None) -> T: ...
11
- @overload
12
- @classmethod
13
- def get(cls, llm: str, type: type[T], throw: Literal[True]) -> T: ...
14
- @overload
15
- @classmethod
16
- def get(cls, llm: str, type: type[T]) -> T: ...
17
- @overload
18
- @classmethod
19
- def get(cls, llm: str, type: type[T], throw: Literal[False]) -> T | None: ...
20
- @overload
21
- @classmethod
22
- def get(cls, llm: str) -> Any: ...
@@ -1,5 +0,0 @@
1
- from .action import MCPAction as MCPAction, MCPToolAction as MCPToolAction, build_mcp_app as build_mcp_app, graph as graph, mount_mcp_app as mount_mcp_app
2
- from .common import MCPConfig as MCPConfig, MCPConnection as MCPConnection, MCPIntegration as MCPIntegration, MCPMode as MCPMode
3
- from .context import MCPContext as MCPContext
4
-
5
- __all__ = ['MCPAction', 'MCPToolAction', 'build_mcp_app', 'graph', 'mount_mcp_app', 'MCPConfig', 'MCPConnection', 'MCPIntegration', 'MCPMode', 'MCPContext']
@@ -1,66 +0,0 @@
1
- from ..action import Action as Action, ChildActions as ChildActions
2
- from ..common import ActionReturn as ActionReturn, ChatRole as ChatRole, Graph as Graph
3
- from ..utils import is_camel_case as is_camel_case, unwrap_exceptions as unwrap_exceptions
4
- from .common import MCPConfig as MCPConfig, MCPConnection as MCPConnection, MCPIntegration as MCPIntegration, MCPMode as MCPMode
5
- from .context import TContext as TContext
6
- from collections.abc import AsyncGenerator, AsyncIterator, Awaitable
7
- from contextlib import AsyncExitStack, asynccontextmanager
8
- from datamodel_code_generator.model import DataModelSet as DataModelSet
9
- from mcp import ClientSession, Tool as Tool
10
- from mcp.server.fastmcp import FastMCP
11
- from mcp.shared.session import ProgressFnT as ProgressFnT
12
- from mcp.types import ContentBlock as ContentBlock
13
- from starlette.applications import AppType as AppType, Starlette
14
- from typing import Any, Callable, Generic, Literal
15
-
16
- DMT: DataModelSet
17
-
18
- class MCPClient:
19
- session: ClientSession
20
- name: str
21
- config: MCPConfig
22
- manual_enable: bool
23
- allowed_tools: dict[str, bool]
24
- tool_action_class: type['MCPToolAction']
25
- exclude_unset: bool
26
- def __init__(self, session: ClientSession, name: str, config: MCPConfig, manual_enable: bool, allowed_tools: dict[str, bool], tool_action_class: type['MCPToolAction'] | None, exclude_unset: bool) -> None: ...
27
- def build_tool(self, tool: Tool) -> tuple[str, type['MCPToolAction']]: ...
28
- async def patch_tools(self, actions: ChildActions, mcp_actions: ChildActions) -> ChildActions: ...
29
-
30
- class MCPAction(Action[TContext]):
31
- __mcp_servers__: dict[str, FastMCP]
32
- __mcp_clients__: dict[str, MCPClient]
33
- __mcp_connections__: list[MCPConnection]
34
- __mcp_tool_actions__: ChildActions
35
- __has_pre_mcp__: bool
36
- @classmethod
37
- def __pydantic_init_subclass__(cls, **kwargs: Any) -> None: ...
38
- @classmethod
39
- def __init_child_actions__(cls) -> None: ...
40
- async def pre_mcp(self, context: TContext) -> ActionReturn: ...
41
- _parent: Action | None
42
- __to_commit__: bool
43
- async def execute(self, context: TContext, parent: Action | None = None, append: bool = True) -> ActionReturn: ...
44
- async def get_child_actions(self, context: TContext) -> ChildActions: ...
45
- @classmethod
46
- def add_child(cls, action: type['Action'], name: str | None = None, override: bool = False, extended: bool = True) -> None: ...
47
-
48
- class MCPToolAction(Action[TContext], Generic[TContext]):
49
- __mcp_tool__: bool
50
- __mcp_client__: MCPClient
51
- __mcp_tool_name__: str
52
- __mcp_exclude_unset__: bool
53
- def build_progress_callback(self, context: TContext) -> ProgressFnT: ...
54
- def clean_content(self, content: ContentBlock) -> str: ...
55
- async def pre(self, context: TContext) -> ActionReturn: ...
56
-
57
- @asynccontextmanager
58
- async def multi_mcp_clients(integrations: dict[str, MCPIntegration], connections: list[MCPConnection], bypass: bool = False) -> AsyncIterator[dict[str, MCPClient]]: ...
59
- def initialize_mcp_groups() -> None: ...
60
- @asynccontextmanager
61
- async def mount_mcp_app(app: AppType, *groups: str, transport: Literal['sse', 'streamable-http'] | dict[str, str] = 'streamable-http') -> AsyncGenerator[AsyncExitStack, None]: ...
62
- def build_mcp_app(*groups: str, transport: Literal['sse', 'streamable-http'] | dict[str, str] = 'streamable-http') -> Starlette: ...
63
- def build_mcp_entry(action: type['Action']) -> Callable[..., Awaitable[str]]: ...
64
- def add_mcp_tool(group: str, action: type['Action'], entry: Callable[..., Awaitable[str]]) -> None: ...
65
- async def graph(action: type[Action], allowed_actions: dict[str, bool] | None = None, integrations: dict[str, MCPIntegration] | None = None, bypass: bool = False) -> Graph: ...
66
- async def traverse(graph: Graph, action: type[Action], allowed_actions: dict[str, bool] | None, integrations: dict[str, MCPIntegration], bypass: bool = False) -> None: ...
@@ -1,60 +0,0 @@
1
- from .action import MCPToolAction as MCPToolAction
2
- from collections.abc import Callable as Callable, Mapping, Sequence
3
- from enum import StrEnum
4
- from httpx import Auth as Auth
5
- from httpx._types import CertTypes as CertTypes, PrimitiveData as PrimitiveData
6
- from mcp.client.streamable_http import McpHttpClientFactory as McpHttpClientFactory
7
- from typing import Any, Literal, TypedDict
8
-
9
- class MCPMode(StrEnum):
10
- SSE = 'SSE'
11
- SHTTP = 'SHTTP'
12
-
13
- class AsyncClientArgs(TypedDict, total=False):
14
- auth: tuple[str | bytes, str | bytes] | None
15
- params: Mapping[str, PrimitiveData | Sequence[PrimitiveData]] | list[tuple[str, PrimitiveData]] | tuple[tuple[str, PrimitiveData], ...] | str | bytes | None
16
- cookies: dict[str, str] | list[tuple[str, str]] | None
17
- verify: str | bool
18
- cert: CertTypes | None
19
- http1: bool
20
- http2: bool
21
- proxy: str | None
22
- max_redirects: int
23
- trust_env: bool
24
- default_encoding: str
25
-
26
- class MCPConfig(TypedDict, total=False):
27
- url: str
28
- headers: dict[str, str] | None
29
- timeout: float
30
- sse_read_timeout: float
31
- terminate_on_close: bool
32
- httpx_client_factory: Any
33
- auth: Any
34
- async_client_args: AsyncClientArgs
35
-
36
- class MCPIntegration(TypedDict, total=False):
37
- mode: MCPMode | Literal['SSE', 'SHTTP']
38
- config: MCPConfig
39
- allowed_tools: dict[str, bool]
40
- exclude_unset: bool
41
-
42
- class MCPConnection:
43
- name: str
44
- mode: MCPMode | Literal['SSE', 'SHTTP']
45
- url: str
46
- headers: dict[str, str] | None
47
- timeout: float
48
- sse_read_timeout: float
49
- terminate_on_close: bool
50
- httpx_client_factory: McpHttpClientFactory
51
- auth: Auth | None
52
- on_session_created: Callable[[str], None] | None
53
- async_client_args: AsyncClientArgs
54
- manual_enable: bool
55
- allowed_tools: dict[str, bool]
56
- tool_action_class: type['MCPToolAction'] | None
57
- exclude_unset: bool
58
- require_integration: bool
59
- def __init__(self, name: str, mode: MCPMode | Literal['SSE', 'SHTTP'], url: str = '', headers: dict[str, str] | None = None, timeout: float = 5.0, sse_read_timeout: float = 300.0, terminate_on_close: bool = True, httpx_client_factory: McpHttpClientFactory = ..., auth: Auth | None = None, on_session_created: Callable[[str], None] | None = None, async_client_args: AsyncClientArgs | None = None, manual_enable: bool = False, allowed_tools: dict[str, bool] | None = None, tool_action_class: type['MCPToolAction'] | None = None, exclude_unset: bool = True, require_integration: bool = True) -> None: ...
60
- def get_config(self, override: MCPConfig | None) -> MCPConfig: ...
@@ -1,9 +0,0 @@
1
- from ..context import Context as Context, TLLM as TLLM
2
- from .common import MCPIntegration as MCPIntegration
3
- from typing import Any, Generic, TypeVar
4
-
5
- TContext = TypeVar('TContext', bound='MCPContext')
6
-
7
- class MCPContext(Context[TLLM], Generic[TLLM]):
8
- integrations: dict[str, MCPIntegration]
9
- def detached_kwargs(self, **kwargs: Any) -> dict[str, Any]: ...
@@ -1,13 +0,0 @@
1
- from collections.abc import Generator
2
- from re import Pattern
3
- from typing import Any, Callable
4
- from uuid import UUID
5
-
6
- PLACEHOLDERS: Pattern
7
- CAMEL_CASE: Pattern
8
-
9
- def apply_placeholders(target: str, **placeholders: Any) -> str: ...
10
- def is_camel_case(data: str) -> bool: ...
11
- def unwrap_exceptions(exception: Exception) -> Generator[Exception, None, None]: ...
12
-
13
- uuid: Callable[[], UUID]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes