You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[S2] Agent.run(tasks=[Agent.Task(...)]) raises TypeError: Object of type Task is not JSON serializable #1108
Source: external black-box user audit of PyPI aixplain 0.2.48 (finding #42). Verified offline against development @ e9f7061; the aixplain/ package there is byte-identical to main/0.2.48, so this is present on all branches.
Problem
Using the documented type in the documented per-run field fails:
ag.run("...", tasks=[aix.Agent.Task(name="t", description="d", expected_output="o")])
# TypeError: Object of type Task is not JSON serializable
tasks=[t.to_dict()] works, and construct-time Agent(tasks=[t]) works. Only the per-run path is broken.
Evidence
aixplain/v2/agent.py:2363-2366: the catch-all kwargs forwarder puts raw kwargs into the payload; Task objects reach json.dumps. The construct path serialises them via to_dict().
Suggested fix
payload["tasks"] = [t.to_dict() if isinstance(t, Task) else t for t in tasks] in build_run_payload, plus a unit test.
Activity