Skip to content
hannctl
PDF

case-studies aethercrew DESIGN.md

AetherCrew: a virtual company of 11 AI employees Design and implementation

A hand-built orchestrator that assigns work, picks models, and tracks cost for 11 AI employees in a virtual company. Agent work is simulated and no language model API is called.

CEOUser directiveManagementTechnologySalesEmmaChief of staffMiaFinanceAvaHRSophiaTech leadNoahSenior engineerLunaEngineerEthanDB engineerLiamQA engineerChloeSecurity engineerJamesPlanning and salesleadOliviaContent marketer(off by default)Model priority · estimated cost recordedSimulated: assignment, model selection, and cost tracking onlyNo language model API is called
In the public code, agent work is simulated and no language model API is called.
Model fallback per employeeThe first available model on the list is chosengpt-5OpenAIclaude-opus-4Anthropicgemini-2.5-proGoogledeepseek-v3DeepSeekChoice 1Choice 2Choice 3Choice 4Selectedagent.fallback event loggedEstimated cost only, no language model API call
The switch is logged as an agent.fallback event. Model calls are simulated.
Budget policy80% warning95% warning100% work stopsWork stopped
At 100%, work stops. Costs can be read by day, week, month, and employee.

Model fallback

What this code does: Takes an employee’s model priority list and a set of unavailable models, checks them in order from the front, and picks the first model that can be used. Skipped models are recorded in fallbacks, so it is clear which choice the work fell back to, and an empty list or a fully blocked list raises an error instead of passing silently. It checks only as many entries as the list holds, so fallback can never loop forever.

class FallbackManager:
    """Selects next available agent with bounded fallback traversal."""

    def select(
        self,
        priority_list: list[str],
        unavailable_agents: set[str] | None = None,
    ) -> FallbackResult:
        if not priority_list:
            raise ValueError("priority_list must not be empty")
        blocked = unavailable_agents or set()
        fallbacks: list[str] = []
        for idx, model in enumerate(priority_list):
            if model in blocked:
                fallbacks.append(model)
                continue
            return FallbackResult(selected_agent=model, selected_index=idx, fallbacks=fallbacks)
        raise RuntimeError("All agents are unavailable; fallback exhausted")

Budget states

What this code does: Adds up every recorded cost, computes usage against the budget, and returns one of four states: OK, WARN_80, WARN_95, or HARD_STOP. A budget set to zero or below counts as 100% used and becomes HARD_STOP at once, so a budget typo can never turn into unlimited spending. The orchestrator blocks new work while the state is HARD_STOP.

    @property
    def total_cost(self) -> float:
        return round(sum(e.cost_usd for e in self.entries), 6)

    def percent_used(self) -> float:
        if self.budget_policy.total_budget <= 0:
            return 100.0
        return (self.total_cost / self.budget_policy.total_budget) * 100

    def budget_state(self) -> str:
        pct = self.percent_used()
        if pct >= self.budget_policy.hard_stop_at_pct:
            return "HARD_STOP"
        if pct >= self.budget_policy.warn_at_pct[1]:
            return "WARN_95"
        if pct >= self.budget_policy.warn_at_pct[0]:
            return "WARN_80"
        return "OK"
© 2026 Kim JunHyun · Built with Astro · The infrastructure behind this site is code too

↑↓ move · Enter open · Esc close

Choose a theme

Click a badge to switch to that theme on the same content. Dragging only swings it.

Back to the front page →