Skip to content

Settings

Base classes

Name Children Inherits
BaseModel
pydantic.main
!!! abstract "Usage Documentation"

⋔ Inheritance diagram

graph TD
  107846717030160["config.Settings"]
  107846697802608["main.BaseModel"]
  137699722799616["builtins.object"]
  107846697802608 --> 107846717030160
  137699722799616 --> 107846697802608

🛈 DocStrings

Bases: BaseModel

Contents of config.toml.

Source code in src/acptui/config.py
class Settings(BaseModel):
    """Contents of ``config.toml``."""

    model_config = ConfigDict(extra="forbid")

    default_agent: str | None = None
    """Agent to start when ``acptui`` is run without one (instead of the picker)."""

    theme: str = "textual-dark"
    """Textual theme name."""

    diff_view: DiffViewMode = "auto"
    """How diffs are shown."""

    expand_thoughts: bool = False
    """Show agent thoughts expanded instead of collapsed."""

    agents: dict[str, UserAgent] = Field(default_factory=dict)
    """User-defined agents; an id of a built-in agent replaces it."""

    agent_options: dict[str, dict[str, str | bool]] = Field(default_factory=dict)
    """Initial session config options per agent id (also for built-in agents)."""

    mcp_servers: list[McpServerConfig] = Field(default_factory=list)
    """MCP servers passed to every session (if the agent supports the transport)."""

    system_prompt: str | None = None
    """Extra system instructions for every session (if the agent supports it)."""

    system_prompt_mode: Literal["append", "override"] = "append"
    """Append to the agent's own instructions, or replace them (if supported)."""

    additional_directories: list[str] = Field(default_factory=list)
    """More workspace roots for every session (if the agent supports it)."""

    @model_validator(mode="after")
    def _check_agents(self) -> Settings:
        self.all_agents()  # user agents must be valid specs
        return self

    def all_agents(self) -> list[AgentSpec]:
        """Built-in and user agents; user agents override built-in ones with the same id."""
        merged = {spec.id: spec for spec in BUILTIN_AGENTS}
        for agent_id, agent in self.agents.items():
            merged[agent_id] = agent.to_spec(agent_id)
        for agent_id, options in self.agent_options.items():
            if (spec := merged.get(agent_id)) is not None:
                merged[agent_id] = spec.model_copy(update={"options": {**spec.options, **options}})
        return list(merged.values())

    def find_agent(self, agent_id: str) -> AgentSpec | None:
        """The agent with this id, if any."""
        return next((spec for spec in self.all_agents() if spec.id == agent_id), None)

additional_directories class-attribute instance-attribute

additional_directories: list[str] = Field(default_factory=list)

More workspace roots for every session (if the agent supports it).

agent_options class-attribute instance-attribute

agent_options: dict[str, dict[str, str | bool]] = Field(default_factory=dict)

Initial session config options per agent id (also for built-in agents).

agents class-attribute instance-attribute

agents: dict[str, UserAgent] = Field(default_factory=dict)

User-defined agents; an id of a built-in agent replaces it.

default_agent class-attribute instance-attribute

default_agent: str | None = None

Agent to start when acptui is run without one (instead of the picker).

diff_view class-attribute instance-attribute

diff_view: DiffViewMode = 'auto'

How diffs are shown.

expand_thoughts class-attribute instance-attribute

expand_thoughts: bool = False

Show agent thoughts expanded instead of collapsed.

mcp_servers class-attribute instance-attribute

mcp_servers: list[McpServerConfig] = Field(default_factory=list)

MCP servers passed to every session (if the agent supports the transport).

system_prompt class-attribute instance-attribute

system_prompt: str | None = None

Extra system instructions for every session (if the agent supports it).

system_prompt_mode class-attribute instance-attribute

system_prompt_mode: Literal['append', 'override'] = 'append'

Append to the agent's own instructions, or replace them (if supported).

theme class-attribute instance-attribute

theme: str = 'textual-dark'

Textual theme name.

all_agents

all_agents() -> list[AgentSpec]

Built-in and user agents; user agents override built-in ones with the same id.

Source code in src/acptui/config.py
def all_agents(self) -> list[AgentSpec]:
    """Built-in and user agents; user agents override built-in ones with the same id."""
    merged = {spec.id: spec for spec in BUILTIN_AGENTS}
    for agent_id, agent in self.agents.items():
        merged[agent_id] = agent.to_spec(agent_id)
    for agent_id, options in self.agent_options.items():
        if (spec := merged.get(agent_id)) is not None:
            merged[agent_id] = spec.model_copy(update={"options": {**spec.options, **options}})
    return list(merged.values())

find_agent

find_agent(agent_id: str) -> AgentSpec | None

The agent with this id, if any.

Source code in src/acptui/config.py
def find_agent(self, agent_id: str) -> AgentSpec | None:
    """The agent with this id, if any."""
    return next((spec for spec in self.all_agents() if spec.id == agent_id), None)

:fa-brands-github: Show source on GitHub