Skip to content

Override aiXplain tool parameters in agent create/run payloads (SDK) #966

Description

@aix-ahmet

Summary

Add support for setting/overriding per-tool parameters on aiXplain tools attached to an agent, in both the create and run payloads. This is the SDK half of PROD-2481 (engine half tracked separately in aixplain/aixplain-agents).

Today only role models (llm/supervisor/planner/responder) accept {id, parameters} and support run-time override via modelParameters. Tools snapshot their params only at save time (as_tool() / get_parameters()) and have no run-time override path.

User-facing shape

tools is a list of dicts, each carrying its own params — same shape at create and run:

# creation
agent = Agent(name="...", tools=[
    {"id": "<tool_id>", "parameters": {"top_k": 5, "filters": {...}}},
    {"id": "<other_id>", "parameters": {"language": "es"}},
])
agent.save()

# run (overrides persisted params by tool id)
agent.run(query="...", tools=[{"id": "<tool_id>", "parameters": {"top_k": 8}}])

Mirrors the existing role-model shape (agent.llm = {"id": ..., "parameters": {...}}).

Work (aixplain/v2/agent.py)

  • Accept tools entries as {id, parameters: {...}}; normalize parameters into the API name/value shape in build_save_payload — reuse the existing _params_dict_to_namevalue_list / _normalize_tool_dict_for_api helpers used for role models.
  • Forward per-tool params at run time in build_run_payload, mirroring how modelParameters already rides the run payload.
  • Keep backward compatibility: plain string tool ids and existing as_tool() dicts must continue to work unchanged.

Decisions (from PROD-2481)

  • Params are defaults the LLM can override (engine merges {**parameters, **llm_args}). The SDK side just transports them.
  • Run-time tools entries override persisted per-tool params by tool id.

Acceptance criteria

  • Create payload carries per-tool parameters in the API name/value shape.
  • Run payload carries per-tool params so run(tools=[...]) forwards overrides.
  • Backward compatible with existing string-id / as_tool() usage.
  • Unit tests for build_save_payload and build_run_payload covering the new shape.

Refs

  • Jira: PROD-2481
  • Engine issue: aixplain/aixplain-agents (parse + inject)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions