agentscope.environment.event module
The events which can be bound to envs.
-
class Event(name: str, args: dict | None = None, returns: Any | None = None)[源代码]
基类:object
A class representing the information of an event.
It contains the name of the event, the arguments of the event,
and the returns of the event.
-
property args: dict
Return the arguments of the event.
-
property name: str
Return the name of the event.
-
property returns: Any
Return the returns of the event.
-
class Getable[源代码]
基类:ABC
Representing an env whose value can be gotten.
-
abstract get() → Any[源代码]
Get the value of the env.
- 返回:
The value of the env.
- 返回类型:
Any
-
class Holdable[源代码]
基类:ABC
A class representing an env can be held,and during
the holding period, all access behaviors except the owner
are prohibited.
-
abstract acquire(owner: str) → bool[源代码]
Acquire the env.
- 参数:
owner (str) – The owner of the env.
- 返回:
Whether the env was acquired successfully.
- 返回类型:
bool
-
abstract release(owner: str) → bool[源代码]
Release the env.
- 参数:
owner (str) – The owner of the env.
- 返回:
Whether the env was released successfully.
- 返回类型:
bool
-
class Movable2D[源代码]
基类:ABC
A class representing an env can be moved in 2D.
-
abstract get_position() → Tuple[float, float][源代码]
Get the position of the env.
- 返回:
The position of the env.
- 返回类型:
Tuple[float, float]
-
abstract move_by(x: float, y: float) → bool[源代码]
Move the env in 2D by the given vector.
- 参数:
-
- 返回:
Whether the movement was successful.
- 返回类型:
bool
-
abstract move_to(x: float, y: float) → bool[源代码]
Move the env to the given position.
- 参数:
-
- 返回:
Whether the movement was successful.
- 返回类型:
bool
-
class Setable[源代码]
基类:ABC
Representing an env whose value can be set.
-
abstract set(value: Any) → bool[源代码]
Set the value of the env.
- 参数:
value (Any) – The new value of the env.
- 返回:
Whether the value was set successfully.
- 返回类型:
bool