本文へ移動
cccskills
無料GitHub で公開

agent-action-input-slot-extraction

Use when designing how an Agentforce agent extracts structured input parameters (slots) from a user's natural-language utterance to invoke an action. Triggers: 'agent extract date from user', 'agent action argument extraction', 'agentforce slot filling', 'agent invocable input mapping', 'agent fails to fill required parameter'. NOT for action authoring (use agentforce/agent-actions) or for prompt-template variable binding (use agentforce/prompt-builder-templates).

インストール方法を見る

含まれるファイル(7)

  • SKILL.md9.1 KB
  • references/examples.md4.0 KB
  • references/gotchas.md2.0 KB
  • references/llm-anti-patterns.md2.6 KB
  • references/well-architected.md2.3 KB
  • scripts/check_agent_action_input_slot_extraction.py2.4 KB
  • templates/agent-action-input-slot-extraction-template.md655 B

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Agent Action Input Slot Extraction

Activate when the agent invokes an Apex/Flow action correctly but with the wrong arguments — date misread, account id missing, picklist value paraphrased, phone number truncated. The skill produces tuned input-variable descriptions, utterance-level test cases, and a re-prompt policy for ambiguous or missing inputs.


Before Starting

Gather this context before working on anything in this domain:

  • The action's invocable definition: each input variable's name, type, description, and required flag. The description is the primary signal the LLM uses to extract values; vague descriptions → wrong slots.
  • Real user utterances. Synthetic test cases miss the verbal patterns users actually produce ("schedule it for next Tuesday afternoon, ish").
  • Whether the action is a one-shot invocation or part of a multi-turn flow. Multi-turn allows re-prompts; one-shot must succeed-or-fail with the first utterance.

Core Concepts

How slot extraction works

When the agent recognizes that an action should be invoked, it constructs an LLM prompt containing:

  • The action's invocable input variables and their descriptions
  • The user's utterance(s)
  • The conversation context

The LLM extracts values for each input variable and validates them against the input type. Missing required inputs trigger a re-prompt cycle.

The description field is the lever. A description like "Date" gets misread for any date in the utterance. "The customer's preferred appointment date in ISO 8601 (YYYY-MM-DD); reject relative phrases like 'next week'" constrains extraction.

Types and coercion

Input typeExtraction behaviorCommon failure
DateLLM parses natural language → ISO date"next Tuesday" parses inconsistently across timezones
DateTimeSame + time-of-dayVague times ("afternoon") get pinned to noon by default
StringFree-formVerbose users put unrelated content in the slot
Picklist (Apex enum / Flow choice)LLM matches utterance to one of the valuesSynonyms get rejected unless described
Id (lookup)LLM extracts a name; the action must resolve to an IdLLM hallucinates IDs starting with valid prefixes
BooleanAffirmative/negative cuesNegation in mid-sentence ("no, wait, yes")

Re-prompt strategy

When a required slot can't be extracted, the agent re-prompts: "What date should I schedule the appointment for?". The re-prompt template should be configured per input. Without configuration, the agent generates a generic prompt that often confuses the user.

For ambiguous extraction (two plausible values), the better pattern is to confirm: "Did you mean Tuesday March 12 or March 19?".


Common Patterns

Pattern: explicit format constraint in description

When to use: Date, datetime, phone, id, anything with a canonical format.

How it works: Description includes the format and an explicit reject clause. "Account record ID; must be exactly 18 alphanumeric characters starting with '001'. Reject names or fragments."

Why not the alternative: A description of "Account ID" alone causes the LLM to hallucinate IDs from account names.

Pattern: enumerate picklist values inline

When to use: Apex enum or Flow choice as input.

How it works: Description lists every valid value with disambiguation. "Severity: one of LOW (cosmetic, no impact), MEDIUM (workaround exists), HIGH (production blocked). Synonyms: 'critical' = HIGH; 'minor' = LOW."

Why not the alternative: Without enumeration, the LLM matches user phrasing to the closest type member, often wrong ('urgent' → MEDIUM when policy says HIGH).

Pattern: name-to-Id resolution outside the LLM

When to use: Action takes a record Id but users speak in names.

How it works: Define the input as a String accountName. Inside the Apex/Flow action, resolve to Id via SOQL with proper escaping and ambiguity handling. Never let the LLM emit IDs.


Decision Guidance

SituationRecommended ApproachReason
User must specify an exact dateDate input + ISO-format description + reject relativesRelative phrasing parses inconsistently
Action takes a lookup recordString name input; Apex resolves to IdLLMs hallucinate IDs; resolution belongs in Apex
Required slot may be missingConfigure re-prompt text per inputGeneric re-prompt confuses users
Multiple plausible values for a slotDisambiguate via confirmation prompt before actionAction with wrong slot is worse than slow action
Free-form note textString with no constraint descriptionLLM extracts the user's verbatim sentence; no extraction logic needed

Recommended Workflow

  1. List every invocable input the action exposes. For each, ask: what's the canonical type? what synonyms or formats might appear? is it required?
  2. Write a specific description per input. Include format, examples, reject clauses. Treat the description as the LLM's instruction manual for that slot.
  3. Build a sample-utterance test set: 10–20 utterances per slot covering typical, edge-case, and adversarial phrasings.
  4. For required slots, configure a re-prompt template that names the missing slot and gives an example.
  5. For lookup-type slots, change the input from Id to String <name> and resolve inside the action; document the lookup ambiguity policy (first match? prompt for clarification? abort?).
  6. Run the test utterances through the agent test harness (Agent Builder → Test in App). Record extraction accuracy per slot.
  7. Iterate on the descriptions until extraction accuracy crosses your bar (typically ≥95% for high-stakes actions, lower for low-stakes).

Review Checklist

  • Each input has a description that includes format + examples + reject clauses
  • Picklist/enum inputs enumerate values with synonym disambiguation
  • Lookup/Id inputs are taken as names, resolved inside the action
  • Required-slot re-prompts configured with slot name and example
  • Test-utterance suite covers ≥10 utterances per slot
  • Accuracy measured and meets the action's stakes

Salesforce-Specific Gotchas

  1. Description text is the primary lever; the variable name is secondary — String d with description "appointment date" extracts as well as String appointmentDate with the same description. Don't rely on naming.
  2. Date inputs default to the running user's timezone — "next Tuesday" relative to which timezone? Specify in the description.
  3. Required + no value extracted = agent emits a built-in re-prompt — Often phrased awkwardly. Always override.
  4. Hallucinated IDs validate as the right shape but reference no record — Apex must check existence and surface a clear error to the agent loop, not silently fail.
  5. Picklist values must match exactly — The LLM may emit "high" when the picklist value is "HIGH". Apex enum coercion fails. Normalize case in the action.

Output Artifacts

ArtifactDescription
Tuned invocable input definitionsUpdated description= strings on every input
Test-utterance suiteYAML/CSV: utterance → expected slot values
Re-prompt template per slotPer-input override of the generic agent re-prompt
Resolution policy for lookup inputsDocumented in the action's class header

Related Skills

  • agentforce/agent-actions — for the broader action design and invocation flow
  • agentforce/agentforce-tool-use-patterns — for when an action call leads into another tool call
  • agentforce/agentforce-eval-harness — for measuring extraction accuracy at scale
  • agentforce/custom-agent-actions-apex — for Apex implementation patterns of name-to-Id resolution

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Use this skill when writing test-first, behavior-driven acceptance criteria in Given/When/Then format for a Salesforce user story. Covers happy path, edge cases, negative paths, permission boundaries, and data-state preconditions so the AC block can drive UAT scripts and Apex test design downstream. Trigger keywords: given when then, gherkin, behavior driven AC, test first acceptance criteria, scenario outline, BDD acceptance criteria. NOT for the user-story format itself (use admin/user-story-writing-for-salesforce). NOT for UAT script writing (use admin/uat-test-case-design). NOT for Apex test method generation (use agents/test-class-generator). NOT for high-level UAT planning (use admin/uat-and-acceptance-criteria). More triggers: acceptance criteria record, ac_id, req_id on a criterion, artefact under test, negative case for a rule-type requirement, no-match fall-through criterion, oracle for a Then clause, test type apex flow manual, criteria linter, check_ac_format.py, --manifest-dir.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Task and Event objects: polymorphic WhatId/WhoId, Activity object model, ActivityHistory vs OpenActivity, activity timeline customization, bulk task creation, Einstein Activity Capture boundaries. NOT for turning on EAC or calendar sync — use admin/einstein-activity-capture-setup. NOT for Email-to-Case — use admin/case-management-setup. Covers ActivitiesSettings metadata, enableActivities, shared Task/Event custom fields and FLS, TaskStatus value sets, Shared Activities and TaskRelation/EventRelation, recurring and child activities, and partial-success bulk DML on Task.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Design Invocable Apex actions that return deterministic, agent-friendly errors instead of surfacing raw exceptions to the LLM. NOT for authoring the action itself — @InvocableMethod schema, labels, security context — use agentforce/custom-agent-actions-apex. NOT for the Apex tests that force each error branch — use agentforce/agent-action-unit-tests.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Apex test patterns for @InvocableMethod agent actions: per-reason-code branch coverage, bulk safety, callout mocking, deterministic assertions. NOT for testing whether the agent routes to the right topic or answers well — use agentforce/agent-testing-and-evaluation. NOT for designing the error envelope the tests assert on — use agentforce/agent-action-error-handling.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Designing or reviewing Agentforce actions: Flow actions, Apex invocable actions, prompt-template actions, action naming, input and output contracts, confirmation requirements, and safe error behavior. Triggers: 'agent actions', 'build an agent that can look up an order', 'make the agent able to check order status', 'give the agent a capability', 'agent that can retrieve a record', 'flow action for agent', 'agent invocable action', 'action schema design'. NOT for writing the Apex class itself — use agentforce/custom-agent-actions-apex. NOT for the reason_code error envelope that stops an agent retry loop — use agentforce/agent-action-error-handling.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Use when deploying an Agentforce agent to a channel surface: Embedded Service web chat, Slack, Experience Cloud, Agent REST API, or Salesforce Mobile. Triggers: 'deploy agent to website', 'add Agentforce to Slack', 'enable agent for mobile app', 'configure embedded service for agent', 'agent API for custom integration', 'multi-channel agent deployment'. NOT for agent logic design — use agentforce/agent-topic-design or agentforce/agent-actions for topics, instructions, and action contracts.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

PranavNagrecha のスキルをすべて見る

このスキルの問題を報告する