agent2agentSourceA2AMiddlewareHistoryLength

class HistoryLength

Parses request.history_length and applies history truncation to the task loaded by FetchTask.

Sets env["a2a.history"]:

Should be placed after FetchTask in the middleware stack so that env["a2a.task"] is available.

Usage:

on "GetTask" do use A2A::Middleware::FetchTask, store: sqlite_store use A2A::Middleware::HistoryLength respond_with -> (env) { task = env["a2a.task"] history = env["a2a.history"] # ... } end