Skip to content

feat: support structured output for agents#192

Open
crazybolillo wants to merge 1 commit intocharmbracelet:mainfrom
crazybolillo:object-tool-calls
Open

feat: support structured output for agents#192
crazybolillo wants to merge 1 commit intocharmbracelet:mainfrom
crazybolillo:object-tool-calls

Conversation

@crazybolillo
Copy link
Copy Markdown

To enable this, LanguageModel required updates to support tool calls as normal, non structured generation methods already do.

These changes are fully backwards compatible. Note that for this feature to work, each provider must explicitly support tool calls alongside structured output. This commit only implements it for the OpenAI provider.

If a provider lacks support, the agent will only generate structured output without executing tool calls.

  • I have read CONTRIBUTING.md.
  • I have created a discussion that was approved by a maintainer (for new features).

@crazybolillo
Copy link
Copy Markdown
Author

I opened this to solve #118. I did not create a discussion for this feature but this can be a good conversation starter 😄. I can make changes as maintainers see fit to adapt this into the existing project plans. Will hold-off on adding unit tests till then.

To enable this, LanguageModel required updates to support tool calls as normal, non
structured generation methods already do.

These changes are fully backwards compatible. Note that for this feature to work, each provider
must explicitly support tool calls alongside structured output. This commit only implements it for
the OpenAI provider.

If a provider lacks support, the agent will only generate structured output without
executing tool calls.

Closes charmbracelet#118.
@andreynering andreynering linked an issue Apr 29, 2026 that may be closed by this pull request
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.

Native json output support for agents

1 participant