Skip to content

Rework arguments to models.stream and Agents.run - #94

Closed
msullivan wants to merge 3 commits into
mainfrom
stream-kwarg
Closed

Rework arguments to models.stream and Agents.run#94
msullivan wants to merge 3 commits into
mainfrom
stream-kwarg

Conversation

@msullivan

Copy link
Copy Markdown
Contributor

Make model and messages keyword only for both stream and run,
but also allow run to take Context positionally. Enforced via
overloads and at runtime.

This was a plan we discussed but I'm not totally sure that I love the
results? Thoughts?

msullivan added 3 commits May 10, 2026 17:28
Update all callers in src/, tests/, examples/, and README to pass
`model=` and `messages=` explicitly.
Adds a `StreamContext` Protocol (so the model layer doesn't have to
import the agents package) and overloads `stream` to accept either a
context positionally or explicit `model=`/`messages=`/`tools=` kwargs.
The runtime check rejects mixing the two forms.

Updates the default agent loop, all custom-loop examples, and the
context-bearing tests to use the shorthand.
Mirrors the kwargs-only style now used by `stream`.
@msullivan
msullivan requested review from 1st1 and anbuzin May 11, 2026 00:30
@vercel

vercel Bot commented May 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
py-ai Ready Ready Preview, Comment May 11, 2026 0:30am

Request Review

@anbuzin

anbuzin commented May 11, 2026

Copy link
Copy Markdown
Collaborator

This was a plan we discussed but I'm not totally sure that I love the results? Thoughts?

Somehow this looks more verbose than the old version

@msullivan

Copy link
Copy Markdown
Contributor Author

Closing in favor of #98

@msullivan msullivan closed this May 11, 2026
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.

2 participants