create-agentic-workflow
Skill0 starsChanged 6 months agoMITView on GitHub
Build and verify an sn_aia AI agent (Now Assist AI Agents) on the connected ServiceNow instance — agent anatomy, script tools with matching input schemas, STOP CONDITIONS, published-version lifecycle, dispatch verification, A2A exposure. Use when asked to "create an AI agent", "build an agentic workflow", "add a tool to an agent", "expose an agent via A2A", or when an agent "won't dispatch", "stalls at ready", or dies with security_violation.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- elastic/docs-actionstheir own version, first seen Sep 2, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- elastic/docs-actions★ 4same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- a2a-usageSkill
- create-catalog-itemSkill
- create-dashboardSkill
- flowsSkill
The file
Files
Create an agentic workflow (sn_aia)
The law for this surface lives in .claude/rules/ai-agents.md and .claude/rules/ai-tools.md — read both before building. This skill is the build-and-verify recipe; full payloads in reference/build-recipe.md, A2A exposure in reference/a2a-validation.md.
0. Gate
getCapability('sn_aia.installed') and getCapability('sn_aia.agent_crud_available') must each return true (always via getCapability(), never by reading the report JSON directly). The §3 trigger-free smoke additionally gates on getCapability('sn_aia.external_agent_api_available') — false/unknown fallbacks in build-recipe §4.
1. Agent anatomy — what actually lives where (live-verified)
| Concern | Where it lives |
| Name, description, role, base instructions, channel, agent_type, record_type | sn_aia_agent |
| Versioned instructions (what the runtime reads) | sn_aia_version (target_id = agent) |
run_as_user, public, specialist_enabled, guest access | sn_aia_agent_config (auto-created with the agent) |
Tool definition (script body + input_schema) | sn_aia_tool |
Agent↔tool wiring (+ per-agent inputs, execution_mode, display flags) | sn_aia_agent_tool_m2m |
Three version-lifecycle facts that differ from what you'd guess:
- Creating the agent auto-creates a published V1
sn_aia_versionrow. - PATCHing
sn_aia_agent.instructionssyncs into the current published version in place — convenient while drafting, and exactly why the prompt-versioning rule forbids relying on it once any usage-log row references the version: an in-place sync silently rewrites audit history. Production prompt bumps follow the full rule: new version entry (published), prior retired, hash lockfile regenerated, attribution row seeded post-deploy. - Direct POSTs to
sn_aia_versionare 403-rejected — the platform owns that table's inserts.
Give every agent a STOP CONDITIONS block (no platform tool-error retry policy exists; the block is the only brake) and an external-reader description. The build recipe carries a proven template.
2. Tools
sn_aia_tool script bodies follow the IIFE contract (function(inputs){ ... return <string|object>; })(inputs);. The input_schema JSON array ([{name, description, mandatory}]) must declare every key the body reads, and the m2m row's inputs field mirrors it — a mismatch makes the LLM invent argument names at runtime. Return the structured error shape from the ai-tools rule on failure.
3. Verify dispatch — never declare an agent done from saved records
Dispatch the agent for real and read the trace:
- Trigger-free smoke (no Studio Publish needed):
POST /api/sn_aia/agenticai/v1/agent/id/<agent_sys_id>with{request_id, inputs:[{content_type:"text", content:"<task>"}], metadata:{}}— returns 200 + session_id, dispatches async. This is the platform's external-agent API; it exercises the same plan pipeline as production triggers. Gate ongetCapability('sn_aia.external_agent_api_available')first — build-recipe §4 has thefalse/unknownfallbacks. - Poll
sn_aia_execution_plan(query byagent=<sys_id>): healthy =statereachescompletedwith emptystate_reason.security_violation= identity problem (checksn_aia_agent_config.run_as_userand the access-verification task output). Stuck atreadywithsys_mod_count=0= inserted off-pipeline (see the dispatch-fingerprint rule). debug_agent_execution(<plan sys_id>): assert the Access Verification task showsisAccessAllowed=truefor agent AND each tool, the ReAct step planned your tool with the right arguments, and the tool execution row isSuccesswith your structured payload.- Fingerprint nuance (live-verified): API-path plans carry
conversation,derived_scope,metadatabut NOTtest_version— that fourth field is populated by Studio test runs only.
4. Known traps (all live-verified)
- Agent card 400 "No agent available for your query" on A2A discovery =
sn_aia_agent_configgating, not a missing agent: setpublic=true(+specialist_enabled=true) on the config row. - The default
context_processing_scripttemplate shipped on new agents throws a RhinoInternalError(optional-chaining on some builds) — dispatch survives, but it pollutes every trace. Replace or simplify it when traces matter. - Cleanup cascade is partial: deleting the agent cascades version/config/m2m/plans, but orphans the
sn_aia_toolrow,sn_aia_execution_task,sn_aia_message, andsn_aia_tools_executionrows — delete those explicitly.sys_cs_conversationheader rows resist deletion entirely (platform-protected; even global-scopesetWorkflow(false)rolls back). - Deterministic multi-agent sequences belong in a state-machine BR or flow, not in an orchestrator prompt; trigger conditions use
CHANGESTO— both per the ai-agents rule.
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
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.

