{"record":{"id":"97b8f61b99df2994","repo":"langchain-ai/deepagents","slug":"assistant-id-must-be-1-128-characters-and-contain","errorCode":null,"errorMessage":"assistant id must be 1-128 characters and contain only letters, numbers, underscore, hyphen, or dot","messagePattern":"assistant id must be 1-128 characters and contain only letters, numbers, underscore, hyphen, or dot","errorType":"validation","errorClass":"TalonConfigError","httpStatus":null,"severity":"error","filePath":"libs/talon/deepagents_talon/config.py","lineNumber":155,"sourceCode":"    default: str | None,\n) -> str | None:\n    for key in keys:\n        if key in env:\n            return env[key]\n    return default\n\n\ndef _validate_assistant_id(assistant_id: str | None) -> None:\n    if (\n        not assistant_id\n        or assistant_id in {\".\", \"..\"}\n        or not _ASSISTANT_ID_PATTERN.fullmatch(assistant_id)\n    ):\n        msg = (\n            \"assistant id must be 1-128 characters and contain only letters, numbers, \"\n            \"underscore, hyphen, or dot\"\n        )\n        raise TalonConfigError(msg)\n\n\ndef _is_runtime_env(key: str) -> bool:\n    return key in _RUNTIME_ENV_KEYS or key.startswith(_RUNTIME_ENV_PREFIXES)\n","sourceCodeStart":137,"sourceCodeEnd":160,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/talon/deepagents_talon/config.py#L137-L160","documentation":"After resolving the assistant id, `_validate_assistant_id` enforces a format contract: 1–128 characters drawn only from letters, digits, underscore, hyphen, and dot (`_ASSISTANT_ID_PATTERN.fullmatch`). Ids used as filesystem/path or identifier components must be safe, so anything else raises `TalonConfigError`.","triggerScenarios":"`from_env` reads `DEEPAGENTS_TALON_ASSISTANT_ID` (or `AGENT_ASSISTANT_ID`) containing whitespace, slashes, unicode, an empty string, or a value longer than 128 chars; `_validate_assistant_id` then rejects it.","commonSituations":"Quoted values with stray spaces in .env files (`ASSISTANT_ID=\"my agent\"`); ids containing `/` or `:` copied from URLs or ARN-like strings; shell interpolation injecting extra characters; overlong generated ids from other systems.","solutions":["Set the assistant id to a value matching ^[A-Za-z0-9._-]{1,128}$ (e.g. my-assistant.v2).","Trim whitespace and remove quoting artifacts from your .env or shell export.","If the id comes from another system, sanitize/slugify it before passing it into Talon."],"exampleFix":"// before\nexport DEEPAGENTS_TALON_ASSISTANT_ID='my agent/prod!'\n// after\nexport DEEPAGENTS_TALON_ASSISTANT_ID=my-agent-prod","handlingStrategy":"validation","validationCode":"import re\n_ASSISTANT_ID_RE = re.compile(r\"^[A-Za-z0-9._-]{1,128}$\")\ndef valid_assistant_id(value: str) -> bool:\n    return bool(_ASSISTANT_ID_RE.fullmatch(value))","typeGuard":"from typing import TypeGuard\ndef is_safe_assistant_id(value: str | None) -> TypeGuard[str]:\n    return value is not None and bool(_ASSISTANT_ID_RE.fullmatch(value))","tryCatchPattern":"try:\n    config = TalonConfig.from_env(os.environ)\nexcept TalonConfigError as exc:\n    logging.error(\"assistant id rejected: %s\", exc)\n    raise SystemExit(1)","preventionTips":["Slugify ids sourced from URLs/ARNs/other systems before export","Strip quotes and whitespace from .env values","Keep ids under 128 chars when generating them programmatically","Sanitize in CI: validate DEEPAGENTS_TALON_ASSISTANT_ID against the pattern before deploy"],"tags":["configuration","validation","assistant-id"],"backgroundTag":"schema-validation-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}