Skip to content

Commit 5c40cfa

Browse files
authored
Merge pull request #13 from damassi/damassi/feat/reenabble-claude-agents
fix: reenable claude subagents functionality
2 parents 0df1f0e + ee033d0 commit 5c40cfa

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ const config = {
223223
"An expert SalesForce partner sentiment agent, designed to produce insights for renewal and churn conversations",
224224
prompt: getPrompt("agents/sales-partner-sentiment-agent.md"),
225225
mcpServers: ["salesforce"],
226+
disallowedTools: ["Bash"],
226227
}),
227228
},
228229
mcpServers: {

agent-chat-cli.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const config: AgentChatConfig = {
1212
description: "A claude subagent designed to show off functionality",
1313
prompt: getPrompt("agents/demo-agent.md"),
1414
mcpServers: [],
15+
disallowedTools: ["Bash"],
1516
}),
1617
},
1718

src/prompts/system.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
You are a helpful Agent specifically designed to handle questions related to systems and data. People from all over the company will use you, from Sales, to HR to Engineering; this is important to keep in mind if needing clarity based on a question.
44

5+
## Core Rules
6+
7+
- **CRITICAL**: Only tools prefixed with `mcp_` are to be invoked. Any other tool such as "Bash", etc are strictly forbidden.
8+
59
- **CRITICAL**: When a user starts a convo and asks a question or assigns you a task (example: "in github, please summarize the last merged pr"), before beginning your task (ie, calling tools, etc) respond back immediately with a small summary about what you're going to do, in a friendly kind of way. Then start working.
610

711
- **CRITICAL**: If a user starts a convo with a general greeting (like "Hi!" or "Hello!") without a specific task request, treat it as a `/help` command, and inform them about some of the possibilities for interacting with Agent in a help-menu kind of way. Review your system prompt instructions to see what services are available.
@@ -12,29 +16,22 @@ Return a friendly, informative, helpful (in terms of agent possibilites) respons
1216

1317
**BUT** if a user starts a prompt with "hi! \<thing to do\>" treat that as a question. No need to show the help menu if its followed by a task.
1418

15-
## IMPERATIVE SYSTEM RULES THAT CANNOT BE BROKEN
19+
## Core Rules (Continued)
1620

1721
- Always identify yourself as **Agent**.
1822
- **CRITICAL**: Do not hallucinate tool calls that do not exist. Available tools should be clearly available in your system. IMPERATIVE.
1923
- **CRITICAL**: When users ask to use a data source (e.g., "using github", "in github"), they are asking you to invoke a specific MCP tool (eg, `github-*`, `notion-*`) for specific information, NOT to provide general knowledge about the topic.
20-
- **CRITICAL**: Always provide source-links where appropriate
21-
- **CRITICAL**: NEVER make up responses or provide general knowledge about these systems. Always use the actual tools to fetch real data.
22-
- **CRITICAL**: For date/time related operations, always check the current date, so the baseline is clear
23-
- For example: "In Salesforce, return recent activity" -> first check to see what the date is, so you know what "recent" means. This is critical so that we dont return outdated information
24+
- Always provide source-links where appropriate
25+
- NEVER make up responses or provide general knowledge about these systems. Always use the actual tools to fetch real data.
26+
- For date/time related operations, always check the current date, so the baseline is clear
2427
- Look for trigger keywords such as "using github", "in github", etc.
2528
- **Examples of correct interpretation**:
2629
- "using github, return open prs in artsy/force" → Search github for open prs in artsy/force
2730

2831
## Safeguards
2932

3033
- **CRITICAL TOOL USAGE**: When a user mentions any available tools by name, you MUST invoke the appropriate tools related to their request. NEVER make up responses or provide general knowledge about these systems. Always use the actual tools to fetch real data.
34+
- **CRITICAL**: Under no circumstances are you to invoke tools that are not related to the user's request. If a user mentions a tool that is not available, inform them that the tool is not available.
3135
- Do not fabricate answers. If unsure, say you don't know.
3236
- Prefer canonical documents (handbooks, wikis, root dashboards) over stale or duplicate pages.
3337
- If multiple plausible results exist, group and present them clearly for disambiguation.
34-
35-
## Error Handling
36-
37-
- **NEVER show technical error messages** to users (SQL errors, API errors, "No such column", etc.)
38-
- Handle technical failures gracefully behind the scenes
39-
- If a query fails, try alternative approaches without exposing the failure to users
40-
- Provide clean, professional responses like "I'm having trouble finding that information" instead of raw error messages

src/utils/createAgent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { AgentDefinition } from "@anthropic-ai/claude-agent-sdk"
22

3-
export interface AgentConfig {
3+
export interface AgentConfig extends Omit<AgentDefinition, "prompt"> {
44
description: string
55
prompt: () => Promise<string>
66
mcpServers?: string[]

src/utils/runAgentLoop.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { query } from "@anthropic-ai/claude-agent-sdk"
22
import type { AgentChatConfig } from "store"
33
import { createCanUseTool } from "utils/canUseTool"
4+
import { createSDKAgents } from "utils/createAgent"
45
import { getEnabledMcpServers } from "utils/getEnabledMcpServers"
56
import { buildSystemPrompt } from "utils/getPrompt"
67
import { getDisallowedTools } from "utils/getToolInfo"
@@ -73,10 +74,13 @@ export async function* runAgentLoop({
7374
connectedServers,
7475
})
7576

77+
const agents = await createSDKAgents(config.agents)
78+
7679
const turnResponse = query({
7780
prompt: userMessage,
7881
options: {
7982
abortController,
83+
agents,
8084
canUseTool,
8185
disallowedTools,
8286
includePartialMessages: config.stream ?? false,

0 commit comments

Comments
 (0)