agentune icon indicating copy to clipboard operation
agentune copied to clipboard

Design and implement LLM execution strategy and error handling

Open leonidb opened this issue 1 year ago • 3 comments

Currently, our simulation executes conversations sequentially and processes intent extraction one by one, which is inefficient. More importantly, we need to establish project-wide standards for LLM interactions.

Current Issues

  • Sequential execution limits throughput
  • No standardized approach to LLM error handling
  • No strategy for rate limit management
  • No retry policies for failed LLM calls
  • Intent extraction processed individually

Key Decisions Needed

  1. Execution Strategy: How should we handle concurrent LLM calls?

    • Conversation-level parallelism
    • Batch processing for intent extraction and other similar cases. In those cases we can leverage langchain's batch methods. Should we use them, or use a general solution for conversation-level parallelism and simple LLM calls batches
  2. Error Handling: How should we handle LLM failures?

    • Graceful degradation strategies
    • Error classification and response
    • Max retries
  3. Rate Limiting: How should we manage API rate limits?

    • Is there a built in way in Langchain?
    • Backoff strategies - simple exponential, or more sophisticated strategy of taking into account the delay recommended in the error message

leonidb avatar Jun 22 '25 06:06 leonidb

@leonidb what's left to do here, after our last talk?

danarmak avatar Jun 24 '25 17:06 danarmak

@danarmak I'd like to make the outcome detection and intent extraction also parallel. We can add a batch method to it, like in AdverserialTester, and use langchain abatch.

In general I'd like to use the same parameter for parallelism between conversation runner and all batch operations. I mean if we allow 10 parallel executions, then have outcome detection/intent extraction/adverserial test also use the same level of parallelism.

What do you think?

leonidb avatar Jun 25 '25 11:06 leonidb

That makes sense!

danarmak avatar Jun 25 '25 15:06 danarmak