Skip to content

feat(skill): cost-aware batch workflow + agentkey_account in tools table#57

Open
f0rmatting wants to merge 2 commits into
mainfrom
feat/cost-aware-batch-confirm
Open

feat(skill): cost-aware batch workflow + agentkey_account in tools table#57
f0rmatting wants to merge 2 commits into
mainfrom
feat/cost-aware-batch-confirm

Conversation

@f0rmatting
Copy link
Copy Markdown
Contributor

Summary

Teaches the LLM the batch-confirmation workflow that PR chainbase-labs/AgentKey-Server#70 (`describe_tool` cost field) makes possible.

Trigger: `≥3 calls` OR estimated cost `≥10 credits`.

Workflow: `describe_tool` → read `cost.credits_per_call` → multiply by N → `agentkey_account` for balance → present plan + estimate + balance to user → wait for confirmation → execute.

Layer separation

  • SKILL.md (Layer 1): gained 5 lines total — one row in the MCP Tools table for `agentkey_account` (marked "Free" + graceful fallback note), one rule under Rules pointing to the reference, one clause in step 0.C clarifying the 4 core tools are required and `account` is optional. No long-form prose.
  • `references/cost-aware.md` (Layer 2, new, ~870 tokens): full workflow — pre-batch checklist, how to read `describe_tool`'s cost field (three shapes: number+map, billing_note only, free), user-confirmation script, cost-saving moves (provider switch, probe-first, dedup, trim N), balance-check failure recovery.

Lazy-loaded — the reference only enters the model's context when the trigger fires.

Backwards compat

  • Old servers without `agentkey_account` exposed via MCP: 0.C does not gate Setup on its presence; the reference doc's "balance check failed" branch covers the case.
  • Existing 4-tool clients keep working unchanged.

Test plan

  • Install the local branch (`npx skills add .`) and ask Claude something obviously bulk: "find 5 xiaohongshu creators in skincare and get each one's profile" — expect the agent to call `describe_tool`, then `agentkey_account`, then present the plan before executing.
  • Ask a one-shot lookup ("search for AI news"): expect the agent to skip the workflow per the "single call + ≤1 credit + no batch intent" carve-out in the reference.
  • Ask against a server without `agentkey_account`: expect the agent to proceed without setup-loop failures.

Release

No `version.txt` bump — release-please will pick up the `feat:` prefix and open the bump PR. Per repo CLAUDE.md, plugin updates trigger on GitHub Release publication, not on commits, so this lands quietly until the next cut.

Adds the Layer 2 reference at skills/agentkey/references/cost-aware.md
covering the pre-batch workflow: read cost.credits_per_call from
describe_tool, check balance via agentkey_account, present the plan to
the user, wait for confirmation. Also covers cheaper-provider picks,
input dedup, probe-first to surface failures free-of-charge, and the
"balance check failed" recovery path.

SKILL.md changes (kept minimal — Layer 1 token budget):

- Add agentkey_account to the MCP Tools table with a "Free" callout and
  a note that older servers may not expose it (don't gate Setup on it).
- Step 0.C explicitly marks the 4 core tools as required and account as
  optional so older deployments don't get stuck in a Setup loop.
- New rule under Rules: load references/cost-aware.md when ≥3 calls OR
  ≥10 estimated credits. The reference owns the workflow detail; the
  rule entry is one sentence.

No bump to version.txt — release-please will pick up the feat: prefix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant