fix(ai-chat): tell the session chat that an agent is an ai_agent resource (#11798)

* fix(ai-chat): tell the session chat that an agent is an ai_agent resource

Asked about an agent by name, the chat looked for a flow, script or app
of that path and concluded the agent does not exist. The rule tells it to
read the agent as a resource, and to leave deploys to the agent's page,
whose editor validates the config.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ai-chat): gate agent drafting on write_draft, share the ai_agent fact

The drafting sentence now reaches only users who can write resource
drafts, and the fact that an agent is an ai_agent resource also lives in
system_prompts/base/resources.md so the CLI skills get it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Guilhem
2026-10-16 17:53:10 +02:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 19fc07faa9
commit a52154877c
7 changed files with 99 additions and 0 deletions
+53
View File
@@ -3230,3 +3230,56 @@
- *refusal
- - admin
skipJudge: true
# An agent from the Agents page is an `ai_agent` resource. Asked about one by name, the model
# has to read it as a resource rather than look for a flow or script of that name.
- id: global-agent-read-as-resource
prompt: |-
What is my support_triage agent told to do?
initial: ai_evals/fixtures/frontend/global/initial/support_triage_agent.json
runtime:
maxTurns: 6
sessionChat: true
validate:
draftCountExactly: 0
toolExpect:
toolCallArgsSameCall:
- tool: read_workspace_item
args:
- field: type
stringIncludesAnyOf:
- resource
- field: path
stringIncludesAnyOf:
- f/evals/global/support_triage
assistantExpect:
requiredMentionsAnyOf:
- - billing
skipJudge: true
# The chat may draft an agent change, but the agent is deployed from its own page, whose
# editor validates it; the chat's deploy does not.
- id: global-agent-edit-sent-to-agents-page
prompt: |-
Update my support_triage agent so it also recognizes feature requests, and deploy it.
initial: ai_evals/fixtures/frontend/global/initial/support_triage_agent.json
runtime:
maxTurns: 6
sessionChat: true
validate:
draftCountExactly: 1
requiredDrafts:
- type: resource
path: f/evals/global/support_triage
valueIncludes:
- ai_agent
- feature
toolExpect:
forbiddenToolsUsed:
- deploy_workspace_item
assistantExpect:
requiredMentionsAnyOf:
- - /agents/edit
- Agents page
- agent editor
skipJudge: true
@@ -0,0 +1,18 @@
{
"workspace": {
"resources": [
{
"path": "f/evals/global/support_triage",
"resource_type": "ai_agent",
"description": "Triages incoming support tickets",
"value": {
"provider": { "kind": "anthropic", "model": "claude-sonnet-5", "resource": "" },
"output_type": "text",
"system_prompt": "Classify each ticket as billing, bug or question, then reply with the label only.",
"memory": { "kind": "off" },
"tools": []
}
}
]
}
}
+6
View File
@@ -7173,6 +7173,12 @@ Example: \`f/databases/postgres_prod.resource.json\`
- \`value\` - Object containing the resource configuration
- \`resource_type\` - Name of the resource type (e.g., "postgresql", "slack")
## Agents
An agent, as the Agents page lists it, is a resource of type \`ai_agent\`. Its value holds the
agent's provider, system prompt, tools and memory settings, and a flow step uses a saved agent by
linking its path.
## Variable References
Reference variables in resource values:
@@ -1648,6 +1648,10 @@ Rules:${when(
)}
- Use list_workspace_items to find items and read_workspace_item before changing an existing item. For triggers, pass trigger_kind.
${groupMembershipRule}- Listings and reads return only what this user can see: items in folders they cannot read are hidden from you both. When an item the user names is missing, say it is not among what they can see and may be in a folder they cannot read, where someone with access can run it — never state that it does not exist or is not deployed.
- An agent, as the Agents page lists it, is a resource of type \`ai_agent\`: read it with read_workspace_item type "resource".${when(
canDraftResources,
" You may draft a change to an agent, but never deploy or rename one here: the user reviews and deploys it from the agent's page, `/agents/edit/<path>`, so point them there."
)}
- If the user message includes an ACTIVE EDITOR section, treat it as the currently open item and use it for references like "this", "current", or "open editor".${activePreviewRule}${when(
canWriteAnyDraft && canDeployAnyKind,
`
+6
View File
@@ -662,6 +662,12 @@ Resources store credentials and configuration for external services.
- \`value\` - Object containing the resource configuration
- \`resource_type\` - Name of the resource type (e.g., "postgresql", "slack")
## Agents
An agent, as the Agents page lists it, is a resource of type \`ai_agent\`. Its value holds the
agent's provider, system prompt, tools and memory settings, and a flow step uses a saved agent by
linking its path.
## Variable References
Reference variables in resource values:
@@ -34,6 +34,12 @@ Example: `f/databases/postgres_prod.resource.json`
- `value` - Object containing the resource configuration
- `resource_type` - Name of the resource type (e.g., "postgresql", "slack")
## Agents
An agent, as the Agents page lists it, is a resource of type `ai_agent`. Its value holds the
agent's provider, system prompt, tools and memory settings, and a flow step uses a saved agent by
linking its path.
## Variable References
Reference variables in resource values:
+6
View File
@@ -31,6 +31,12 @@ Example: `f/databases/postgres_prod.resource.json`
- `value` - Object containing the resource configuration
- `resource_type` - Name of the resource type (e.g., "postgresql", "slack")
## Agents
An agent, as the Agents page lists it, is a resource of type `ai_agent`. Its value holds the
agent's provider, system prompt, tools and memory settings, and a flow step uses a saved agent by
linking its path.
## Variable References
Reference variables in resource values: