Skip to content

[inference-out] upstream: resolved-route enrichment middleware with a cost-estimator callback #75

Closed

Description

@senamakel

agent/tinyagents/routes.rs (194) is mostly ResolvedRouteMiddleware. It emits generation enrichment, records the resolved route, applies :free pricing and calls pricing::lookup. All of that is generic apart from the cost estimator and the run-context slot.

Add, in tinyagents-harness/src/middleware/library/workload.rs:

  • ResolvedRouteMiddleware<C: CostEstimator>;
  • trait CostEstimator { fn estimate(&self, model, usage) -> Option<f64> };
  • a route sink callback.

The host passes agent::cost::estimate_call_cost_usd and its OpenHumanRunContext.resolved_route slot. Inline turn_required_capabilities / route_fallback_policy at their two call sites (turn_exec.rs:556, turn_plan.rs:54).

Host row unblocked (H9): agent/tinyagents/routes.rs.

Blocked by

None.

Definition of done

The listed APIs exist upstream with tests, are released/tagged, and the matching host-adoption leaf can pin them. Gates: the repo's own cargo test, cargo clippy -D warnings and CI.

Agent brief

  • Files to consider: the rows above; the epic's Evaluation section has each row's reason.
  • Research: the gaps listed above. Read the cited upstream symbols before writing code.
  • Workflow: one implementing-an-epic step. Follow OpenHuman's .claude/skills/migrate-to-submodule: upstream PR to the canonical tinyhumansai/<repo>, then tag/release; the OpenHuman gitlink bump and host deletion happen in the matching host-adoption leaf. tinyinference must not depend on tinyagents or OpenHuman.
  • Subagent: tdd-implementer.

Parent: tinyhumansai/openhuman#8092

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrustPull requests that update rust code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions