Skip to content

feat: agent model config add maxTokens/temperature parameters - #284

Open
foleydang wants to merge 2 commits into
mainfrom
dev/agent-model-config
Open

foleydang wants to merge 2 commits into
mainfrom
dev/agent-model-config

Conversation

@foleydang

Copy link
Copy Markdown
Collaborator

Description

The agent model field is a config object, not only a model id. ModelConfig gains the four optional inference parameters of the Managed Agent API reference (temperature, max_tokens, enable_thinking, thinking_budget) and is exported from dashscope.agentstudio. agents.create/update accept either a ModelConfig or a bare model id (the ModelConfig(id=...) shorthand), and Agent.model coerces the server object, with Agent.model_id for the id alone.

Related Issue: Fixes #[issue_number] or Relates to #[issue_number]

Security Considerations: [Check if API keys or sensitive credentials are exposed in code/logs]

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactoring

Component(s) Affected

  • Model
  • Application
  • Common
  • Documentation
  • Tests
  • CI/CD

Checklist

  • Pre-commit hooks pass
  • Tests pass locally
  • Documentation updated (if needed)
  • Ready for review

Testing

[How to test these changes]
Pass

Additional Notes

[Optional: any other context]
None

@foleydang
foleydang force-pushed the dev/agent-model-config branch 3 times, most recently from aa2932c to 73a2d04 Compare October 23, 2026 08:44
The agent `model` field is a config object, not only a model id. ModelConfig
gains the four optional inference parameters of the Managed Agent API
(temperature, max_tokens, enable_thinking, thinking_budget) plus builder(),
toBuilder() and of(id); the param classes send that object as-is instead of
rebuilding {"id": ...}.

Shaped after the Claude Managed Agents client, where beta.agents
AgentCreateParams exposes model(...) overloads for a bare model id and for a
ModelConfigParams object:

- the field is modelConfig, so the whole config has a matching accessor pair;
  String getModel() still returns the id (base-class contract unchanged)
- model(String) / model(ModelConfig) builder aliases, setModel(String) as an
  alias of setModelConfig; unset parameters are omitted so the server default
  applies, and an update replaces the config as a whole
- create validates model.id the way update already does, instead of only failing
  server-side after the request has left
- name is console-only: the public API neither accepts nor returns it, so the
  read-back case asserts it is absent
- samples/AgentStudioSimple.java points at the object form, which was otherwise
  only discoverable from javadoc

Public surface is additive: javap against the released 2.23.2 shows no removed
or re-typed member.
…m single-pass

`delta` was typed as a JsonObject, so a frame carrying anything else made Gson
throw while parsing it; the stream queued that exception and re-raised it as an
ApiException, dropping every event after it. It is held as a JsonElement and read
as a payload object when it is one, so such a frame is simply not a chunk instead
of an aborted stream. getEventDelta() still returns a JsonObject.

A second pass over one stream could never work either: the queue drains into a
single reader, so the next iterator blocked for the whole timeout and then
reported stream_timeout. iterator() now fails fast, the way the Python SDK's
second pass raises.
@foleydang
foleydang force-pushed the dev/agent-model-config branch from 7050cc2 to 7725e78 Compare October 23, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant