Token usage from a flow execution?

Hello,

Can anyone explain how to get the final total token usage by the various crews at the end of a flow execution?

I have read this doc, but can’t figure out how I would extract this token usage information with a flow, like the write_a_book_with_flows example.

Thanks,
Jeff

@Jeff_Chen I suggest you use AgentOps, which is a Python SDK for AI agents monitoring, including information about token usage and cost. It takes just 2 lines of code!

1 Like

Thank you for our suggestion, @rokbenko.

I also realized that I could save token_usage from the crew output into my state variable then summarize the token usage at the end of the flow.