Skip to content

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

Open
apucacao wants to merge 3 commits into
mainfrom
cursor/agui-stream-example-7ca3
Open

apucacao wants to merge 3 commits 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.

jeffdupont and others added 2 commits October 23, 2026 12:22
…ample-7ca3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds agui-stream to EXAMPLES so python main.py agui-stream runs it, a
Usage line in its docstring, and a note that TOOL_CALL_ARGS and
TOOL_CALL_RESULT content are empty unless capture_content is on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeffdupont

Copy link
Copy Markdown
Contributor

Replying to the 10-15 review. Pushed two commits:

  • 2ab47e4 merges origin/main.
  • a37eda9 addresses the review:
    • Blocking: "agui-stream": "examples.agui_stream" is now in main.py's EXAMPLES, and the docstring has a Usage (via main.py): line like examples/streaming.py. The "Not registered in main.py" line is gone.
    • Non-blocking: the docstring now says TOOL_CALL_ARGS deltas and TOOL_CALL_RESULT content are empty unless capture_content is on, and how to turn it on.
    • Not changed: Usage: null on a RUN_FINISHED without usage. It matches streaming.py.

Lint and typecheck pass. I have not run the example against a live flag. Needs a human reviewer.

🤖 Generated with Claude Code

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