agentsociety.cityagent.blocks.plan_block

Module Contents

Classes

PlanBlock

A block for generating and managing execution plans through LLM-guided decision making.

Data

API

agentsociety.cityagent.blocks.plan_block.GUIDANCE_SELECTION_PROMPT = <Multiline-String>
agentsociety.cityagent.blocks.plan_block.DETAILED_PLAN_PROMPT = <Multiline-String>
class agentsociety.cityagent.blocks.plan_block.PlanBlock(agent: agentsociety.agent.Agent, toolbox: agentsociety.agent.AgentToolbox, agent_memory: agentsociety.memory.Memory, agent_context: agentsociety.agent.DotDict, max_plan_steps: int = 6, detailed_plan_prompt: str = DETAILED_PLAN_PROMPT)

Bases: agentsociety.agent.Block

A block for generating and managing execution plans through LLM-guided decision making.

Attributes: configurable_fields: List of configurable parameter names default_values: Default values for configurable parameters fields_description: Human-readable descriptions for configurable parameters guidance_options: Predefined options mapped to specific needs max_plan_steps: Maximum allowed steps in generated plans (configurable)

Initialization

Initialize PlanBlock with required components.

Args: llm: Language Model interface for decision making environment: Environment for contextual data memory: Agent’s memory storage for status tracking

async select_guidance(current_need: str) → Optional[Tuple[dict, str]]

Select optimal guidance option using Theory of Planned Behavior evaluation.

Args: current_need: The agent’s current need to fulfill

Returns: Optional[tuple[dict, str]]: Selected option with TPB evaluation scores and reasoning. None if no guidance option is selected by bad response from LLM.

async generate_detailed_plan() → Optional[dict]

Generate executable steps for selected guidance option.

Args: plan_target: The target of the plan

Returns: dict: Structured plan with target and typed execution steps. None if no plan is generated by bad response from LLM.

async forward()

Main workflow: Guidance selection -> Plan generation -> Memory update