agentsociety.cityagent.blocks.other_block¶
Module Contents¶
Classes¶
Block implementation for handling sleep-related actions in an agent’s workflow. |
|
Fallback block for handling undefined/non-specific actions in workflows. |
|
Orchestration block for managing specialized sub-blocks (SleepBlock/OtherNoneBlock). |
Data¶
API¶
- agentsociety.cityagent.blocks.other_block.SLEEP_TIME_ESTIMATION_PROMPT = <Multiline-String>¶
- class agentsociety.cityagent.blocks.other_block.SleepBlock(toolbox: agentsociety.agent.AgentToolbox, agent_memory: Optional[agentsociety.memory.Memory] = None, sleep_time_estimation_prompt: str = SLEEP_TIME_ESTIMATION_PROMPT)¶
Bases:
agentsociety.agent.BlockBlock implementation for handling sleep-related actions in an agent’s workflow.
Attributes: description (str): Human-readable block purpose. guidance_prompt (FormatPrompt): Template for generating time estimation prompts.
Initialization
- name¶
‘SleepBlock’
- description¶
‘Handles sleep-related actions’
- async forward(context: agentsociety.agent.DotDict)¶
Execute sleep action and estimate time consumption using LLM.
Args: context: Workflow context containing plan and other metadata.
Returns: Dictionary with execution status, evaluation, time consumed, and node ID.
- class agentsociety.cityagent.blocks.other_block.OtherNoneBlock(toolbox: agentsociety.agent.AgentToolbox, agent_memory: Optional[agentsociety.memory.Memory] = None)¶
Bases:
agentsociety.agent.BlockFallback block for handling undefined/non-specific actions in workflows.
Attributes: description (str): Human-readable block purpose. guidance_prompt (FormatPrompt): Template for generating time estimation prompts.
Initialization
- name¶
‘OtherNoneBlock’
- description¶
‘Handles all kinds of intentions/actions except sleep’
- async forward(context: agentsociety.agent.DotDict)¶
- class agentsociety.cityagent.blocks.other_block.OtherBlockParams¶
Bases:
agentsociety.agent.BlockParams
- class agentsociety.cityagent.blocks.other_block.OtherBlockContext¶
Bases:
agentsociety.agent.BlockContext
- class agentsociety.cityagent.blocks.other_block.OtherBlock(toolbox: agentsociety.agent.AgentToolbox, agent_memory: agentsociety.memory.Memory, block_params: Optional[agentsociety.cityagent.blocks.other_block.OtherBlockParams] = None)¶
Bases:
agentsociety.agent.BlockOrchestration block for managing specialized sub-blocks (SleepBlock/OtherNoneBlock).
Attributes: sleep_block (SleepBlock): Specialized block for sleep actions. other_none_block (OtherNoneBlock): Fallback block for generic actions. trigger_time (int): Counter for block activation frequency. token_consumption (int): Accumulated LLM token usage. dispatcher (BlockDispatcher): Router for selecting appropriate sub-blocks.
Initialization
- ParamsType¶
None
- OutputType¶
None
- ContextType¶
None
- name¶
‘OtherBlock’
- description¶
‘Responsible for all kinds of intentions/actions except mobility, economy, and social, for example, s…’
- actions¶
None
- async forward(agent_context: agentsociety.agent.DotDict) agentsociety.cityagent.sharing_params.SocietyAgentBlockOutput¶
Route workflow steps to appropriate sub-blocks and track resource usage.
Args: context: Workflow context containing plan and metadata.
Returns: Execution result from the selected sub-block.