Skip to content

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

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

@foleydang foleydang commented Oct 23, 2026 •

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

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) and is exported from
dashscope.agentstudio; agents.create/update take either a ModelConfig or a bare
model id, Agent.model coerces the server object, and Agent.model_id reads the id
alone.

Unset parameters are omitted so the server default applies, and on update a sent
config replaces the whole object -- so agent.model.copy_with(...) changes one knob
without clearing the rest. copy_with also accepts a keyword the config already
carries (a forward-compat field the server added), while a typo and inventing a
wire field still raise.

Ranges stay server-side. name is console-only: the public API neither accepts nor
returns it, so the wire case no longer pins it in an assertion.
The stream wraps a single-use EventSource, so a second pass read whatever was left
behind -- silently nothing on a live run, StreamClosedError once closed -- while
looking like an empty turn. It now raises and says to open another stream.

Delta reading itself is unchanged: chunks still come from event_delta frames. The
tests cover the second pass on both the sync and the async stream.
@foleydang
foleydang force-pushed the dev/agent-model-config branch from ff83b1b to dbf5224 Compare October 23, 2026 10:28
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