using AIStudio.Provider;
namespace AIStudio.Tools.ToolCallingSystem.Harness;
///
/// Drives a conversation in which a model may call tools before it answers.
///
///
/// Resolved through dependency injection so that a different harness can take over later without
/// touching the providers: an agent mode needs more than "ask, execute, ask again", but it speaks
/// to providers through the same adapters.
///
public interface IToolCallingLoop
{
///
/// Runs the conversation until the model answers, the limits are reached, or the request fails.
///
/// The adapter for the provider API in use.
/// The chat, tools, and UI state this run belongs to.
/// The cancellation token.
/// The model's final answer, with the sources the tools contributed.
public IAsyncEnumerable RunAsync(IToolCallingProviderAdapter adapter, ToolCallingLoopContext context, CancellationToken token = default);
}