Pick the correct region-specific knowledge source(s) for a query based on the
user's location, so answers are grounded in content that is accurate for
where the user is. Always do this BEFORE calling the KnowledgeSearch tool, and
pass the chosen source(s) as the sources parameter of that call — on every
knowledge-grounded question. Policies, benefits, pricing, legal/compliance,
support hours, and product availability frequently differ by country or region,
so read from the source that matches the user's location before answering.
Available sources
| Source | Use when the user is located in... |
|---|---|
Global |
Any location, for content that is the same everywhere (fallback / default). |
Americas |
United States, Canada, Mexico, Central & South America. |
EMEA |
Europe, the Middle East, and Africa. |
APAC |
Asia, Australia, and the Pacific. |
Run this — do not improvise
This capability's deterministic implementation is a RAPP single-file agent, linked beside this file as knowledge_source_router_agent.py and embedded as the fenced Python below (sha256 7852acf6808b8095…; a byte-exact copy is also vaulted in the capsule comment at the end of this file). On a host with sandbox execution, run the linked file directly — if it is missing, write the fence contents verbatim to knowledge_source_router_agent.py first:
python3 knowledge_source_router_agent.py '{"key": "value"}' # arguments as one JSON object
echo '{"key": "value"}' | python3 knowledge_source_router_agent.py # or on stdin
python3 knowledge_source_router_agent.py --tool # emit the JSON tool contract
Treat stdout as a tool result. If it reports missing or unresolved inputs, stop and collect them. If it returns steps, execute those steps in order exactly as returned; if it returns instructions, follow them with the supplied inputs. Otherwise use the result verbatim. Do not invent behavior beyond that output. On a host without code execution, treat the Parameters schema and the code below as the exact specification and never paraphrase a step. Never edit inside the generated markers; a converter-equipped host can instead restore the original file checksum-verified with the installed rapp-agent-converter/scripts/toast.py convert SKILL.md --to agent.
"""KnowledgeSourceRouter -- Determines which region-specific knowledge source(s) to search based on the user's location. You MUST invoke this skill BEFORE calling the KnowledgeSearch tool, and pass the chosen source(s) as its `sources` parameter.
Generated by the rapp skill from knowledge-source-router. The RCI capsule at the bottom of this file carries the full original; `toast.py convert` restores it byte-exact."""
import json
import re
import sys
try:
from agents.basic_agent import BasicAgent
except ImportError: # running OUTSIDE a brainstem -- stay executable anyway.
class BasicAgent: # noqa: D101 - minimal stand-in, same contract
def __init__(self, name=None, metadata=None):
if name:
self.name = name
if metadata:
self.metadata = metadata
def perform(self, **kwargs):
return "Not implemented."
def system_context(self):
return None
def to_tool(self):
return {"type": "function", "function": {
"name": self.name,
"description": self.metadata.get("description", ""),
"parameters": self.metadata.get("parameters", {})}}
# The procedural layer, verbatim from the source capability.
INSTRUCTIONS = "Pick the correct region-specific knowledge source(s) for a query based on the\n**user's location**, so answers are grounded in content that is accurate for\nwhere the user is. Always do this BEFORE calling the `KnowledgeSearch` tool, and\npass the chosen source(s) as the `sources` parameter of that call — on every\nknowledge-grounded question. Policies, benefits, pricing, legal/compliance,\nsupport hours, and product availability frequently differ by country or region,\nso read from the source that matches the user's location before answering.\n\n## Available sources\n| Source | Use when the user is located in... |\n| --- | --- |\n| `Global` | Any location, for content that is the same everywhere (fallback / default). |\n| `Americas` | United States, Canada, Mexico, Central & South America. |\n| `EMEA` | Europe, the Middle East, and Africa. |\n| `APAC` | Asia, Australia, and the Pacific. |"
# Ordered commands lifted verbatim from the capability's own documentation.
STEPS = []
class KnowledgeSourceRouterAgent(BasicAgent):
def __init__(self):
self.name = 'KnowledgeSourceRouter'
self.metadata = {
"name": "KnowledgeSourceRouter",
"description": "Determines which region-specific knowledge source(s) to search based on the user's location. You MUST invoke this skill BEFORE calling the KnowledgeSearch tool, and pass the chosen source(s) as its `sources` parameter.",
"parameters": {
"type": "object",
"properties": {},
"required": []
}
}
super().__init__(name=self.name, metadata=self.metadata)
def perform(self, **kwargs): # toaster:generated-perform
return json.dumps({"status": "ok", "instructions": INSTRUCTIONS,
"inputs": kwargs,
"note": "Prose-only capability: follow INSTRUCTIONS "
"with the given inputs."}, indent=2)
if __name__ == "__main__":
# echo '{"arg": "value"}' | python3 knowledge_source_router_agent.py
# python3 knowledge_source_router_agent.py '{"arg": "value"}'
# python3 knowledge_source_router_agent.py --tool # emit the JSON tool contract
_a = sys.argv[1:]
if _a and _a[0] == "--tool":
print(json.dumps(KnowledgeSourceRouterAgent().to_tool(), indent=2))
else:
_raw = _a[0] if _a else (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