agentleFS
albertoclementealbertoclemente/agentic-design-patterns-skills/skills/agentic-resource-aware-optimization/SKILL.md

agentic-resource-aware-optimization

Skill4 starsChanged 5 months agoMITView on GitHub

Lets an agent dynamically monitor and manage compute, time, and money during operation — trading output quality against cost. A common design uses a Router Agent to classify request complexity (cheap model for simple, strong model for complex), a Critique Agent to refine routing, and fallback mechanisms for graceful degradation. Use under budget, latency, or hardware constraints.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No visibility into cost per task

    line 30

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Resource-Aware Optimization

Agentic Design Pattern 16 of 21 — distilled from Antonio Gulli, Agentic Design Patterns: A Hands-On Guide to Building Intelligent Systems (Ch. 16).

What it is. Tier work to the cheapest sufficient resource: classify request complexity and route to a fast/cheap or powerful/expensive model accordingly, prune or summarize context, enforce budgets, and fall back gracefully when a model is throttled or unavailable.

Reach for this when

  • Operating under financial budgets for API/compute
  • Latency-sensitive applications needing fast responses
  • Deploying on resource-constrained hardware (edge, limited battery)
  • Balancing response quality against operational cost across varied task complexity

Don't reach for this when

  • Prototype or low-volume usage
  • Optimizing before correctness is established
  • The savings are negligible relative to the added complexity

Shape of the solution

Use a Router Agent to classify incoming complexity and direct simple queries to a fast cheap model and hard ones to a powerful model; add a Critique Agent to evaluate quality and improve routing over time. Apply contextual pruning/summarization, set budgets, and define fallback to a default model for graceful degradation under throttling.

Common failure modes

  • Premature optimization before it works
  • Cache or routing staleness
  • Quality regressions from cheaper models
  • No visibility into cost per task

Composes with

  • agentic-routing — the complexity-based router at its core
  • agentic-evaluation-monitoring — guard quality while cutting cost
  • agentic-memory-management — context pruning/summarization
  • agentic-exception-handling — fallback on throttling

Selection signals live in this skill's description (used for auto-triggering). To choose among all 21 patterns, see agentic-pattern-selector. Conceptual source: Antonio Gulli, Agentic Design Patterns: A Hands-On Guide to Building Intelligent Systems, Ch. 16 — original distillation from the text, not reproduced prose, code, or figures.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.