Skip to content

Conversation

@ultmaster
Copy link
Contributor

@ultmaster ultmaster commented Oct 27, 2025

This PR includes several hot fixes in preparation for the Tinker example.

  1. Support tracing and processing logprobs
  2. Allow to skip token IDs that are empty list
  3. minor bug fix in Baseline
  4. Support _add_return_token_ids in LLMProxy.

Most API updates are very experimental (and underscored). They are only to make the Tinker integration work quickly.

We may need to rethink about:

  1. Opt-in/out of callbacks in LLMProxy.
  2. Re-design agent-lightning specific logprobs and token_ids otel spans.
  3. Refactor adapters.

Copilot AI review requested due to automatic review settings October 27, 2025 12:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates internal APIs to support upcoming Tinker integration by enhancing token ID handling, logprobs tracing, and configuration flexibility.

Key changes:

  • Added support for tracing and processing log probabilities from LLM responses
  • Enhanced token ID extraction with null-safety checks and support for skipping empty token IDs
  • Added _add_return_token_ids configuration parameter to LLMProxy for conditional callback registration

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
examples/.gitignore Added Tinker-specific ignore patterns for logs and HTML reports
agentlightning/llm_proxy.py Added _add_return_token_ids parameter to control token ID callback registration
agentlightning/instrumentation/agentops.py Enhanced token ID extraction with null checks and added logprobs serialization
agentlightning/emitter/reward.py Added TODO comment for tracer context improvement
agentlightning/algorithm/fast.py Fixed exception handling order to check adapter existence before usage
agentlightning/adapter/triplet.py Added span_to_triplet method and _skip_empty_token_spans parameter for filtering

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

filtered_llm_calls: List[Tuple[TraceTree, str]] = []
for llm_call, agent_name in llm_calls:
triplet = self.span_to_triplet(llm_call.span, agent_name)
# This is a hot-fix for Tinker+CrewAI, which has some anonymous requests outside the trained agent.
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

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

Corrected spelling of 'hot-fix' to 'hotfix'.

Suggested change
# This is a hot-fix for Tinker+CrewAI, which has some anonymous requests outside the trained agent.
# This is a hotfix for Tinker+CrewAI, which has some anonymous requests outside the trained agent.

Copilot uses AI. Check for mistakes.
attributes["response_token_ids"] = list(first_choice.provider_specific_fields["token_ids"])

# log probability
# This is temporarily. We need a unified conventions for classifying and naming logprobs.
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

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

Corrected 'temporarily' to 'temporary' and 'conventions' to 'convention' for grammatical accuracy.

Suggested change
# This is temporarily. We need a unified conventions for classifying and naming logprobs.
# This is temporary. We need a unified convention for classifying and naming logprobs.

Copilot uses AI. Check for mistakes.
@ultmaster
Copy link
Contributor Author

/ci

@github-actions
Copy link

✅ CI retrigger requested by @ultmaster. Fired repository_dispatch:ci-all.

@ultmaster
Copy link
Contributor Author

/ci

1 similar comment
@ultmaster
Copy link
Contributor Author

/ci

@github-actions
Copy link

github-actions bot commented Oct 27, 2025

🚀 CI Watcher for correlation id-3452083391-mh9buyit triggered by comment 3452083391
🏃‍♀️ Tracking 5 workflow run(s):

✅ All runs completed.

@github-actions
Copy link

github-actions bot commented Oct 27, 2025

🚀 CI Watcher for correlation id-3452075952-mh9bva2a triggered by comment 3452075952
🏃‍♀️ Tracking 5 workflow run(s):

✅ All runs completed.

@ultmaster ultmaster merged commit d16538d into main Oct 28, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants