camel icon indicating copy to clipboard operation
camel copied to clipboard

[Feature Request] Access to full trajectory and token usage for each request

Open Lawhy opened this issue 3 months ago • 13 comments

Required prerequisites

  • [x] I have searched the Issue Tracker and Discussions that this hasn't already been reported. (+1 or comment there if it has.)
  • [ ] Consider asking first in a Discussion.

Motivation

When planning budget for agentic systems, we would like to see which request along the trajectory costs more tokens than others. The token usage of each base model request can be a good signal for budget planning, reward model, and more. Would like to see CAMEL support easy access to full trajectory and token usage for each request along the trajectory, attributing to individual agents and tool calls.

@boerz-coding please add some specific examples to describe the gap.

Solution

No response

Alternatives

No response

Additional context

No response

Lawhy avatar Sep 26 '25 07:09 Lawhy

I have submitted two sub-issues to further clarify our request in this current issue.

boerz-coding avatar Sep 29 '25 07:09 boerz-coding

thanks @boerz-coding !

Wendong-Fan avatar Sep 29 '25 07:09 Wendong-Fan

Hi @Wendong-Fan , I can take a closer look into this feature. Can I take this one?

lllllyh01 avatar Sep 29 '25 08:09 lllllyh01

@lillyh01 I am also working on these. We can collaborate on these issue

Saedbhati avatar Oct 03 '25 06:10 Saedbhati

thanks @lllllyh01 and @Saedbhati ! issue assigned to you

Wendong-Fan avatar Oct 03 '25 13:10 Wendong-Fan

@Saedbhati Awesome! I'd love to collaborate and discuss further about this issue. I'm currently exploring possible solutions, and let's stay in touch for any ideas we have :)

lllllyh01 avatar Oct 05 '25 07:10 lllllyh01

@lllllyh01 @Saedbhati Thank you. I am also happy to

  1. provide more context / example code script that we are running where we different tools are called, if necessary.
  2. discuss solutions.

boerz-coding avatar Oct 05 '25 17:10 boerz-coding

@lllllyh01 you can drop your email/discord so we can have discussion on this issue. Thanks

Saedbhati avatar Oct 08 '25 09:10 Saedbhati

@Saedbhati here is my discord: yihan_lin Thanks!

lllllyh01 avatar Oct 09 '25 04:10 lllllyh01

hey @Saedbhati and @lllllyh01 , thanks for taking this issue! Please feel free to share any updates from your discussion here. If there's anything I can do to support you, don't hesitate to tag me

Wendong-Fan avatar Oct 19 '25 13:10 Wendong-Fan

Thanks @Wendong-Fan . We're still aligning calendars for a short sync; to avoid blocking progress, I started on sub-issue #3219 first. I'm preparing a draft commit for it and I'll try to finish it within a couple days.

@Saedbhati please feel free to share any updates from your side, or we can also schedule a quick sync meeting by your preference

lllllyh01 avatar Oct 20 '25 05:10 lllllyh01

thanks @lllllyh01 , left some comments for the PR, feel free to check

Wendong-Fan avatar Oct 25 '25 15:10 Wendong-Fan

Hi @Wendong-Fan , thank you for your review. I've updated this PR and left some responses for your comments. Please feel free to review, and let me know any further feedbacks.

Another thing I would like to bring up is that I found another PR #3325 from @LIHUA919 also works on this issue. I think we are technically on the same track on solving this issue. Since this PR is earlier than mine, to avoid redundancy I am considering migrate my changes to #3325 .

lllllyh01 avatar Nov 01 '25 05:11 lllllyh01