agent_urban_planning.persona_summary

persona_summary(agent)[source]

Produce a stable, human-readable one-line persona from an agent’s demographics.

Fields appear in a fixed order; None fields are omitted. Output format is stable across calls (deterministic given the same agent), suitable for use as a cluster-label diagnostic or as the persona block in an LLM prompt.

Parameters:

agent (Agent) – An Agent instance whose demographics are rendered.

Returns:

"38y, 3-person household, has children, mid income, renter, high education, EU background, employed, no car".

Return type:

Comma-separated persona string. Example

Examples

>>> from agent_urban_planning.core.agents import Agent, persona_summary
>>> a = Agent(
...     agent_id=0, household_size=2, age_head=30, has_children=False,
...     has_elderly=False, income=5000.0, savings=30000.0,
...     job_location="x", car_owner=True, weight=1.0,
... )
>>> persona_summary(a)
'30y, 2-person household, no children, ... car owner'