chore: initial import of standalone agentscope project
Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_en (ubuntu-latest, 3.10) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_zh (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.12) (push) Has been cancelled

This commit is contained in:
2026-03-02 18:21:40 +08:00
commit a842f1861f
561 changed files with 91892 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
"""The types in agentscope"""
from ._hook import (
AgentHookTypes,
ReActAgentHookTypes,
)
from ._object import Embedding
from ._json import (
JSONPrimitive,
JSONSerializableObject,
)
from ._tool import ToolFunction
__all__ = [
"AgentHookTypes",
"ReActAgentHookTypes",
"Embedding",
"JSONPrimitive",
"JSONSerializableObject",
"ToolFunction",
]

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""The agent hooks types."""
from typing import Literal
AgentHookTypes = (
str
| Literal[
"pre_reply",
"post_reply",
"pre_print",
"post_print",
"pre_observe",
"post_observe",
]
)
ReActAgentHookTypes = (
AgentHookTypes
| Literal[
"pre_reasoning",
"post_reasoning",
"pre_acting",
"post_acting",
]
)

View File

@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
"""The JSON related types"""
from typing import Union
JSONPrimitive = Union[
str,
int,
float,
bool,
None,
]
JSONSerializableObject = Union[
JSONPrimitive,
list["JSONSerializableObject"],
dict[
str,
"JSONSerializableObject",
],
]

View File

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
"""The object types in agentscope."""
from typing import List
Embedding = List[float]

View File

@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
"""The tool related types"""
from typing import (
Callable,
Union,
Awaitable,
AsyncGenerator,
Generator,
Coroutine,
Any,
TYPE_CHECKING,
)
if TYPE_CHECKING:
from ..tool import ToolResponse
else:
ToolResponse = "ToolResponse"
ToolFunction = Callable[
...,
Union[
# sync function
ToolResponse,
# async function
Awaitable[ToolResponse],
# sync generator function
Generator[ToolResponse, None, None],
# async generator function
AsyncGenerator[ToolResponse, None],
# async function that returns async generator
Coroutine[Any, Any, AsyncGenerator[ToolResponse, None]],
# async function that returns sync generator
Coroutine[Any, Any, Generator[ToolResponse, None, None]],
],
]