diff --git a/apps/copilot/copilot.py b/apps/copilot/copilot.py index 035029be..9b61c726 100644 --- a/apps/copilot/copilot.py +++ b/apps/copilot/copilot.py @@ -6,7 +6,7 @@ import json from lib import AgentContext, PromptContext, ToolContext, ChatContext openai_client = OpenAI() -MODEL_NAME = "gpt-4o" # OpenAI model name +MODEL_NAME = "gpt-4.1" # OpenAI model name class UserMessage(BaseModel): role: Literal["user"] @@ -155,6 +155,7 @@ You are responsible for providing delivery information to the user. 1. Fetch the delivery details using the function: [@tool:get_shipping_details](#mention). 2. Answer the user's question based on the fetched delivery details. 3. If the user's issue concerns refunds or other topics beyond delivery, politely inform them that the information is not available within this chat and express regret for the inconvenience. +4. If the user's request is out of scope, call [@agent:Delivery Hub](#mention). --- ## šŸŽÆ Scope: @@ -183,7 +184,7 @@ You are responsible for providing delivery information to the user. - Do not leave the user with partial information. Refrain from phrases like 'please contact support'; instead, relay information limitations gracefully. ''' -use GPT-4o as the default model for new agents. +use GPT-4o as the default model for new agents. Always add a line to the agents instruction to call the parent agent if the user's request is out of scope. ## Section 9: General Guidelines @@ -200,6 +201,8 @@ Note: 7. When you are suggesting a set of actions, add a text section that describes the changes being made before and after the actions. 8. After providing the actions, add a text section with something like 'Once you review and apply the high-level plan, you can try out a basic chat first. I can then help you better configure each agent.' 9. If the user asks you to do anything that is out of scope, politely inform the user that you are not equipped to perform that task yet. E.g. "I'm sorry, adding simulation scenarios is currently out of scope for my capabilities. Is there anything else you would like me to do?" +10. Always edit the examples as well when editing an agent. +11. Always add a line to the agents instruction to call the parent agent if the user's request is out of scope. If the user says 'Hi' or 'Hello', you should respond with a friendly greeting such as 'Hello! How can I help you today?' @@ -318,7 +321,7 @@ Copilot output: "name": "2FA Setup", "type": "conversation", "description": "Agent to guide users in setting up 2FA.", - "instructions": "## šŸ§‘ā€šŸ’¼ Role:\nHelp users set up their 2FA preferences.\n\n---\n## āš™ļø Steps to Follow:\n1. Ask the user about their preferred 2FA method (e.g., SMS, Email).\n2. Confirm the setup method with the user.\n3. Guide them through the setup steps.\n4. If the user request is out of scope, pass control to [@agent:2FA Hub](#mention)\n\n---\n## šŸŽÆ Scope:\nāœ… In Scope:\n- Setting up 2FA preferences\n\nāŒ Out of Scope:\n- Changing existing 2FA settings\n- Handling queries outside 2FA setup.\n- General knowledge queries.\n\n---\n## šŸ“‹ Guidelines:\nāœ”ļø Dos:\n- Clearly explain setup options and steps.\n\n🚫 Don'ts:\n- Assume preferences without user confirmation.\n- Extend the conversation beyond 2FA setup.", + "instructions": "## šŸ§‘ā€šŸ’¼ Role:\nHelp users set up their 2FA preferences.\n\n---\n## āš™ļø Steps to Follow:\n1. Ask the user about their preferred 2FA method (e.g., SMS, Email).\n2. Confirm the setup method with the user.\n3. Guide them through the setup steps.\n4. If the user request is out of scope, call [@agent:2FA Hub](#mention)\n\n---\n## šŸŽÆ Scope:\nāœ… In Scope:\n- Setting up 2FA preferences\n\nāŒ Out of Scope:\n- Changing existing 2FA settings\n- Handling queries outside 2FA setup.\n- General knowledge queries.\n\n---\n## šŸ“‹ Guidelines:\nāœ”ļø Dos:\n- Clearly explain setup options and steps.\n\n🚫 Don'ts:\n- Assume preferences without user confirmation.\n- Extend the conversation beyond 2FA setup.", "examples": "- **User** : I'd like to set up 2FA for my account.\n - **Agent response**: Sure, can you tell me your preferred method for 2FA? Options include SMS, Email, or an Authenticator App.\n\n- **User** : I want to use SMS for 2FA.\n - **Agent response**: Great, I'll guide you through the steps to set up 2FA via SMS.\n\n- **User** : How about using an Authenticator App?\n - **Agent response**: Sure, let's set up 2FA with an Authenticator App. I'll walk you through the necessary steps.\n\n- **User** : Can you help me set up 2FA through Email?\n - **Agent response**: No problem, I'll explain how to set up 2FA via Email now.\n\n- **User** : I changed my mind, can we start over?\n - **Agent response**: Of course, let's begin again. Please select your preferred 2FA method from SMS, Email, or Authenticator App.", "model": "gpt-4o", "toggleAble": true, @@ -341,7 +344,7 @@ Copilot output: "name": "2FA Change", "type": "conversation", "description": "Agent to assist users in changing their 2FA method.", - "instructions": "## šŸ§‘ā€šŸ’¼ Role:\nAssist users in changing their 2FA method preferences.\n\n---\n## āš™ļø Steps to Follow:\n1. Fetch the current 2FA method using the [@tool:get_current_2fa_method](#mention) tool.\n2. Confirm with the user if they want to change the method.\n3. Guide them through the process of changing the method.\n4. If the user request is out of scope, pass control to [@agent:2FA Hub](#mention)\n\n---\n## šŸŽÆ Scope:\nāœ… In Scope:\n- Changing existing 2FA settings\n\nāŒ Out of Scope:\n- Initial setup of 2FA\n- Handling queries outside 2FA setup.\n- General knowledge queries.\n\n---\n## šŸ“‹ Guidelines:\nāœ”ļø Dos:\n- Ensure the user is aware of the current method before change.\n\n🚫 Don'ts:\n- Change methods without explicit user confirmation.\n- Extend the conversation beyond 2FA change.", + "instructions": "## šŸ§‘ā€šŸ’¼ Role:\nAssist users in changing their 2FA method preferences.\n\n---\n## āš™ļø Steps to Follow:\n1. Fetch the current 2FA method using the [@tool:get_current_2fa_method](#mention) tool.\n2. Confirm with the user if they want to change the method.\n3. Guide them through the process of changing the method.\n4. If the user request is out of scope, call [@agent:2FA Hub](#mention)\n\n---\n## šŸŽÆ Scope:\nāœ… In Scope:\n- Changing existing 2FA settings\n\nāŒ Out of Scope:\n- Initial setup of 2FA\n- Handling queries outside 2FA setup.\n- General knowledge queries.\n\n---\n## šŸ“‹ Guidelines:\nāœ”ļø Dos:\n- Ensure the user is aware of the current method before change.\n\n🚫 Don'ts:\n- Change methods without explicit user confirmation.\n- Extend the conversation beyond 2FA change.", "examples": "- **User** : I want to change my 2FA method from SMS to Email.\n - **Agent response**: I can help with that. Let me fetch your current 2FA setting first.\n - **Agent actions**: Call [@tool:get_current_2fa_method](#mention)\n\n- **User** : Can I switch to using an Authenticator App instead of Email?\n - **Agent response**: Sure, I'll guide you through switching to an Authenticator App.\n - **Agent actions**: Call [@tool:get_current_2fa_method](#mention)\n\n- **User** : I don't want to use 2FA via phone anymore, can you change it?\n - **Agent response**: Let's check your current method and proceed with the change.\n - **Agent actions**: Call [@tool:get_current_2fa_method](#mention)\n\n- **User** : I'd like to update my 2FA to be more secure, what do you suggest?\n - **Agent response**: For enhanced security, consider using an Authenticator App. Let's fetch your current method and update it.\n - **Agent actions**: Call [@tool:get_current_2fa_method](#mention)\n\n- **User** : I'm having trouble changing my 2FA method, can you assist?\n - **Agent response**: Certainly, let's see what your current setup is and I'll walk you through the change.", "model": "gpt-4o", "toggleAble": true, diff --git a/apps/docs/docs/add_tools.md b/apps/docs/docs/add_tools.md index 3e95e175..f88ce710 100644 --- a/apps/docs/docs/add_tools.md +++ b/apps/docs/docs/add_tools.md @@ -10,7 +10,15 @@ You can mock any tool you have created by checking the 'Mock tool responses' opt ### Adding MCP tools -[![MCP server](https://img.youtube.com/vi/EbkIPCTyD58/0.jpg)](https://www.youtube.com/watch?v=EbkIPCTyD58) +You can add a running MCP server in Settings -> Tools. + +![Example Tool](img/add-mcp-server.png) + +You can use [supergateway](https://github.com/supercorp-ai/supergateway) to expose any MCP stdio server as an SSE server. + +Now, you can import the tools from the MCP server in the Build view. + +![Example Tool](img/import-mcp-tools.png) ### Debug tool calls in the playground diff --git a/apps/docs/docs/create_agents.md b/apps/docs/docs/create_agents.md index 9237cfc4..72ee7853 100644 --- a/apps/docs/docs/create_agents.md +++ b/apps/docs/docs/create_agents.md @@ -4,7 +4,7 @@ Copilot can set up agents for you from scratch. ### Instruct copilot First, tell it about the initial set of agents that make up your assistant. -[![Prompt to agents](https://img.youtube.com/vi/3t2Fpn6Vyds/0.jpg)](https://www.youtube.com/watch?v=3t2Fpn6Vyds) +![Agent Config](img/create-agents-delivery.png) Using copilot to create your initial set of agents helps you leverage best practices in formatting agent instructions and connecting agents to each other as a graph, all of which have been baked into copilot. @@ -12,9 +12,3 @@ Using copilot to create your initial set of agents helps you leverage best pract Once you apply changes, inspect the agents to see how copilot has built them. Specifically, note the Instructions, and Examples in each agent. ![Agent Config](img/agent-instruction.png) - - -### Make changes if needed -Tweak the instructions and examples through the copilot, or generate instructions button, or by manually editing it. - -[![Feedback](https://img.youtube.com/vi/uoCEQtOe7eE/0.jpg)](https://www.youtube.com/watch?v=uoCEQtOe7eE) \ No newline at end of file diff --git a/apps/docs/docs/img/add-mcp-server.png b/apps/docs/docs/img/add-mcp-server.png new file mode 100644 index 00000000..18b629df Binary files /dev/null and b/apps/docs/docs/img/add-mcp-server.png differ diff --git a/apps/docs/docs/img/create-agents-delivery.png b/apps/docs/docs/img/create-agents-delivery.png new file mode 100644 index 00000000..a22ac8d5 Binary files /dev/null and b/apps/docs/docs/img/create-agents-delivery.png differ diff --git a/apps/docs/docs/img/import-mcp-tools.png b/apps/docs/docs/img/import-mcp-tools.png new file mode 100644 index 00000000..e2c2efff Binary files /dev/null and b/apps/docs/docs/img/import-mcp-tools.png differ diff --git a/apps/docs/docs/img/update-agent-copilot.png b/apps/docs/docs/img/update-agent-copilot.png new file mode 100644 index 00000000..adb5dffd Binary files /dev/null and b/apps/docs/docs/img/update-agent-copilot.png differ diff --git a/apps/docs/docs/img/update-agent-generate.png b/apps/docs/docs/img/update-agent-generate.png new file mode 100644 index 00000000..6e076405 Binary files /dev/null and b/apps/docs/docs/img/update-agent-generate.png differ diff --git a/apps/docs/docs/img/update-agent-manual.png b/apps/docs/docs/img/update-agent-manual.png new file mode 100644 index 00000000..cf3648d0 Binary files /dev/null and b/apps/docs/docs/img/update-agent-manual.png differ diff --git a/apps/docs/docs/update_agents.md b/apps/docs/docs/update_agents.md index 28b24482..10fd437b 100644 --- a/apps/docs/docs/update_agents.md +++ b/apps/docs/docs/update_agents.md @@ -1,8 +1,19 @@ ## Update agent behavior +There are three ways for you to update the agent's behavior: + +### 1. With help of Copilot + Copilot can help you update agent behavior. It is also aware of the current chat in the playground so you can make references to the current chat while instructing copilot to update agents. -![Update Agent Behavior](img/update-agent-with-copilot.png) +![Update Agent Behavior](img/update-agent-copilot.png) -Playground: -![Test Updated Agent](img/test-updated-agent.png) \ No newline at end of file +### 2. Using the Generate button + +![Update Agent Behavior](img/update-agent-generate.png) + +### 3. By manually editing the instructions + +You can manually edit the agent instructions anytime. + +![Update Agent Behavior](img/update-agent-manual.png) diff --git a/apps/rowboat/app/globals.css b/apps/rowboat/app/globals.css index d7b5d1bb..359e21ab 100644 --- a/apps/rowboat/app/globals.css +++ b/apps/rowboat/app/globals.css @@ -102,11 +102,6 @@ html, body { transition-all duration-200 ease-in-out; } - .card:hover { - @apply shadow-[0_4px_12px_rgba(0,0,0,0.06)] - transform translate-y-[-1px]; - } - /* Update input styles */ input, textarea, select { @apply rounded-lg border-[#E5E7EB] dark:border-[#2E2E30] diff --git a/apps/rowboat/app/lib/feature_flags.ts b/apps/rowboat/app/lib/feature_flags.ts index caf95116..7040874d 100644 --- a/apps/rowboat/app/lib/feature_flags.ts +++ b/apps/rowboat/app/lib/feature_flags.ts @@ -7,4 +7,5 @@ export const USE_AUTH = process.env.USE_AUTH === 'true'; // Hardcoded flags export const USE_MULTIPLE_PROJECTS = true; export const USE_TESTING_FEATURE = false; -export const USE_VOICE_FEATURE = false; \ No newline at end of file +export const USE_VOICE_FEATURE = false; +export const USE_TRANSFER_CONTROL_OPTIONS = false; \ No newline at end of file diff --git a/apps/rowboat/app/projects/[projectId]/copilot/app.tsx b/apps/rowboat/app/projects/[projectId]/copilot/app.tsx index 52358666..881fd0ef 100644 --- a/apps/rowboat/app/projects/[projectId]/copilot/app.tsx +++ b/apps/rowboat/app/projects/[projectId]/copilot/app.tsx @@ -29,6 +29,7 @@ interface AppProps { dispatch: (action: any) => void; chatContext?: any; onCopyJson?: (data: { messages: any[], lastRequest: any, lastResponse: any }) => void; + onMessagesChange?: (messages: z.infer[]) => void; } const App = forwardRef<{ handleCopyChat: () => void }, AppProps>(function App({ @@ -37,6 +38,7 @@ const App = forwardRef<{ handleCopyChat: () => void }, AppProps>(function App({ dispatch, chatContext = undefined, onCopyJson, + onMessagesChange, }, ref) { const messagesEndRef = useRef(null); const [messages, setMessages] = useState[]>([]); @@ -47,6 +49,11 @@ const App = forwardRef<{ handleCopyChat: () => void }, AppProps>(function App({ const [lastRequest, setLastRequest] = useState(null); const [lastResponse, setLastResponse] = useState(null); + // Notify parent of message changes + useEffect(() => { + onMessagesChange?.(messages); + }, [messages, onMessagesChange]); + // Check for initial prompt in local storage and send it useEffect(() => { const prompt = localStorage.getItem(`project_prompt_${projectId}`); @@ -303,10 +310,12 @@ export function Copilot({ }) { const [copilotKey, setCopilotKey] = useState(0); const [showCopySuccess, setShowCopySuccess] = useState(false); + const [messages, setMessages] = useState[]>([]); const appRef = useRef<{ handleCopyChat: () => void }>(null); function handleNewChat() { setCopilotKey(prev => prev + 1); + setMessages([]); } function handleCopyJson(data: { messages: any[], lastRequest: any, lastResponse: any }) { @@ -320,6 +329,7 @@ export function Copilot({ return (
@@ -364,6 +374,7 @@ export function Copilot({ dispatch={dispatch} chatContext={chatContext} onCopyJson={handleCopyJson} + onMessagesChange={setMessages} />
diff --git a/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx b/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx index b301c02e..7b534fc0 100644 --- a/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx +++ b/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx @@ -19,6 +19,7 @@ import { Panel } from "@/components/common/panel-common"; import { Button as CustomButton } from "@/components/ui/button"; import clsx from "clsx"; import { EditableField } from "@/app/lib/components/editable-field"; +import { USE_TRANSFER_CONTROL_OPTIONS } from "@/app/lib/feature_flags"; // Common section header styles const sectionHeaderStyles = "text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400"; @@ -61,6 +62,13 @@ export function AgentConfig({ setLocalName(agent.name); }, [agent.name]); + // Add effect to handle control type update when transfer control is disabled + useEffect(() => { + if (!USE_TRANSFER_CONTROL_OPTIONS && agent.controlType !== 'retain') { + handleUpdate({ ...agent, controlType: 'retain' }); + } + }, [USE_TRANSFER_CONTROL_OPTIONS, agent.controlType, agent, handleUpdate]); + const validateName = (value: string) => { if (value.length === 0) { setNameError("Name cannot be empty"); @@ -414,23 +422,25 @@ export function AgentConfig({ /> -
- - handleUpdate({ - ...agent, - controlType: value as z.infer['controlType'] - })} - /> -
+ {USE_TRANSFER_CONTROL_OPTIONS && ( +
+ + handleUpdate({ + ...agent, + controlType: value as z.infer['controlType'] + })} + /> +
+ )} void, readOnly?: boolean }) { + const [localName, setLocalName] = useState(param.name); + + useEffect(() => { + setLocalName(param.name); + }, [param.name]); + return (
@@ -65,11 +71,11 @@ export function ParameterConfig({ Name