Repository: emcie-co/parlant
File: sdk/src/emcie/sdk/bin/emcie.py (Python)

Code before:
        agents = Actions.list_agents(ctx)

        if not agents:
            rich.print("No data available")
            return

        Interface._print_table(agents)

    @staticmethod
    def get_default_agent(ctx: click.Context) -> str:
        agents = Actions.list_agents(ctx)
        assert agents
        return str(agents[0]["id"])

    @staticmethod
    def patch_agent(
        ctx: click.Context,
        agent_id: str,
        description: Optional[str],
        max_engine_iterations: Optional[int],
    ) -> None:
        try:
            Actions.patch_agent(ctx, agent_id, description, max_engine_iterations)
            Interface._write_success(f"Updated agent (id={agent_id})")
        except Exception as e:
            Interface._write_error(f"error: {type(e).__name__}: {e}")

    @staticmethod
    def _render_events(events: list[EventDTO]) -> None:
        event_items = [
            {
                "ID": e["id"],
                "Creation Date": format_datetime(e["creation_utc"]),
                "Correlation ID": e["correlation_id"],
                "Source": e["source"],
                "Offset": e["offset"],
                "Message": e["data"]["message"],
            }
            for e in events
        ]

        Interface._print_table(event_items, maxcolwidths=[None, None, None, None, None, 40])

    @staticmethod
    def view_session(ctx: click.Context, session_id: str) -> None:
        events = Actions.list_events(ctx, session_id)

        if not events:
            rich.print("No data available")
            return


Review comment (suggestion):
Note I think you went for a capitalized Error in the other PR. Either one is fine with me, but let's choose one and stay consistent.

Code after:
        agents = Actions.list_agents(ctx)

        if not agents:
            rich.print("No data available")
            return

        Interface._print_table(agents)

    @staticmethod
    def get_default_agent(ctx: click.Context) -> str:
        agents = Actions.list_agents(ctx)
        assert agents
        return str(agents[0]["id"])

    @staticmethod
    def patch_agent(
        ctx: click.Context,
        agent_id: str,
        description: Optional[str],
        max_engine_iterations: Optional[int],
    ) -> None:
        try:
            Actions.patch_agent(ctx, agent_id, description, max_engine_iterations)
            Interface._write_success(f"Updated agent (id={agent_id})")
        except Exception as e:
            Interface._write_error(f"Error: {type(e).__name__}: {e}")

    @staticmethod
    def _render_events(events: list[EventDTO]) -> None:
        event_items = [
            {
                "ID": e["id"],
                "Creation Date": format_datetime(e["creation_utc"]),
                "Correlation ID": e["correlation_id"],
                "Source": e["source"],
                "Offset": e["offset"],
                "Message": e["data"]["message"],
            }
            for e in events
        ]

        Interface._print_table(event_items, maxcolwidths=[None, None, None, None, None, 40])

    @staticmethod
    def view_session(ctx: click.Context, session_id: str) -> None:
        events = Actions.list_events(ctx, session_id)

        if not events:
            rich.print("No data available")
            return