Skip to content

Latest commit

 

History

History
38 lines (31 loc) · 1.37 KB

File metadata and controls

38 lines (31 loc) · 1.37 KB

chat.py Improvement Plan

1. Streaming Assistant Messages

Priority: High
Stream AssistantMessageData deltas in on_event so the assistant's response prints incrementally instead of waiting for the full reply.

2. Configurable CLI Path

Priority: High
Replace the hardcoded cli_path with an environment variable fallback:

cli_path=os.environ.get("COPILOT_CLI_PATH", "copilot")

3. Graceful Shutdown

Priority: Medium
Add a finally block to cleanly stop the client on exit:

finally:
    await client.stop()

4. Optional Telemetry

Priority: Medium
Make New Relic telemetry opt-in. Only configure OTEL env vars and require NEW_RELIC_LICENSE_KEY if telemetry is explicitly enabled (e.g., via ENABLE_TELEMETRY=true).

5. Error Handling

Priority: Medium
Wrap send_and_wait in a try/except block to gracefully handle network failures, tool errors, and unexpected exceptions without crashing the loop.

6. Tool Result Display

Priority: Low
Subscribe to ToolExecutionResultData events and print tool outputs so users can see what tools returned, not just that they were called.

7. /quit Command & Better Input UX

Priority: Low

  • Support a /quit command as an alternative to Ctrl+C.
  • Print a subtle message on empty input instead of silently looping.
  • Add a turn counter [N] prefix to each exchange.