Skip to content

docs(examples): add an AG-UI stream example - #171

Open
apucacao wants to merge 1 commit into
mainfrom
cursor/agui-stream-example-7ca3
Open

apucacao wants to merge 1 commit into
mainfrom
cursor/agui-stream-example-7ca3

Conversation

@apucacao

Copy link
Copy Markdown
Contributor

Adds a standalone example of launchdarkly_ai_server.agui.stream for one AI Config turn.

config().stream() stays chunk then done. This file shows the opt-in reader: RUN_STARTED, text and tool events, then RUN_FINISHED. Text goes to stdout. Run and tool events go to stderr.

main.py and the README layout are unchanged, so this does not collide with another example PR editing that index. run(flag_key, user_input) matches the other examples.

Open in Web Open in Cursor 

Show launchdarkly_ai_server.agui.stream for one config turn: RUN_STARTED,
text and tool events, then RUN_FINISHED. The file is standalone so it
does not edit the shared example index.

Co-authored-by: alexis <alexis@launchdarkly.com>
@cursor

cursor Bot commented Oct 14, 2026

Copy link
Copy Markdown

@cursor review

@jeffdupont jeffdupont left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not ready yet: the example can't be run.

  • examples/agui_stream.py:14-15 says it isn't registered in main.py, and the file has no if __name__ == "__main__" block. Every other example runs through the EXAMPLES dict in main.py, so nothing calls init_client() here and python -m examples.agui_stream just imports and exits. Fix: add "agui-stream": "examples.agui_stream" to main.py and a Usage (via main.py): line to the docstring, like examples/streaming.py.

Non-blocking:

  • TOOL_CALL_ARGS deltas are empty unless capture_content is on. One docstring line would save users wondering why args are blank.
  • RUN_FINISHED without usage prints Usage: null. Same as streaming.py, so consistency only.

The API usage itself checks out against main: agui.stream(...) signature and the event field names all match RunReader/TurnEmitter.

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.

3 participants