[S3] Agent.get() hydration papercuts: llm_id TypeError, null-budget RuntimeWarning, execution_config clobbered, max_iterations dropped on save · Issue #1124 · aixplain/aiXplain · GitHub
Skip to content

[S3] Agent.get() hydration papercuts: llm_id TypeError, null-budget RuntimeWarning, execution_config clobbered, max_iterations dropped on save #1124

Open

Description

@aix-ahmet

Source: external black-box user audit of PyPI aixplain 0.2.48 (findings #6 minors and 'additional minor issues'). Verified offline against development @ e9f7061; the aixplain/ package there is byte-identical to main/0.2.48, so this is present on all branches.

Problems (all reproduced offline against development)

  1. agent.llm_id raises TypeError after Agent.get() because llm comes back as a {id, name} dict (_decode_role_ref, aixplain/v2/agent.py:157-196) and llm_id accepts only str/Model (:2061-2067).
  2. Every Agent.get() prints RuntimeWarning: 'NoneType' ... non-optional type budget when the response has budget: null; field is typed non-Optional at agent.py:704.
  3. Session.execution_config is None after save(): _create copies every non-excluded field from the POST response (resource.py:571-583) and overwrites the local value when the response omits executionConfig. ExecutionConfig.to_dict() also omits budget (session.py:361, exclude=lambda v: True) even though the budget reaches the backend via to_api_dict(), which is confusing when inspecting.
  4. agent.max_iterations = 1 after construction is silently dropped on save(): build_save_payload pops maxIterations and the fold into budget.maxIterations only runs in __post_init__, so the PUT carries budget=None. (Constructor path folds correctly with a DeprecationWarning; not a bug.)

Suggested fixes

Handle dict in llm_id (self.llm["id"]); type budget: Optional[Budget] or pop null in _agent_from_dict (agent.py:2657); skip keys the server omitted when hydrating from a create response; fold max_iterations in build_save_payload or raise; emit budget in ExecutionConfig.to_dict(). Also consider Agent.Budget = Budget alias like Agent.Task (audit claimed Budget is missing from the public surface; it is exported from aixplain.v2, just not reachable as aix.Budget).

Activity

  1. added
    bugSomething isn't working
    severity-3Medium/low: papercuts, docs, robustness
    on Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingseverity-3Medium/low: papercuts, docs, robustness

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions