Skip to content

Commit 14e2fe2

Browse files
Update Context Transfer Assistant Config (#461)
1 parent c284c19 commit 14e2fe2

1 file changed

Lines changed: 162 additions & 9 deletions

File tree

  • assistants/codespace-assistant/assistant

assistants/codespace-assistant/assistant/config.py

Lines changed: 162 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,17 @@ class ResponseBehaviorConfigModel(BaseModel):
9898
description="The message to display when the conversation starts.",
9999
),
100100
UISchema(widget="textarea"),
101-
] = (
102-
"Hello! I am an assistant that can help you with coding projects within the context of the Semantic Workbench."
103-
"Let's get started by having a conversation about your project. You can ask me questions, request code"
104-
" snippets, or ask for help with debugging. I can also help you with markdown, code snippets, and other types"
105-
" of content. You can also attach .docx, text, and image files to your chat messages to help me better"
106-
" understand the context of our conversation. Where would you like to start?"
107-
)
101+
] = dedent("""
102+
Welcome! I'm here to help you with your coding and development projects. Here's how we can work together:
103+
- 💻 Explore your code - share files, snippets, or describe what you're working on
104+
- 🔧 Debug and refine - I can help troubleshoot issues and suggest improvements
105+
- 📋 Generate solutions - ask for code snippets, algorithms, or implementation ideas
106+
- 📚 Learn and understand - I can explain concepts, patterns, and approaches
107+
108+
Simply upload your code files, describe your project, or ask technical questions. I'm ready to assist with languages, frameworks, debugging, and development best practices.
109+
110+
What coding project can I help you with today?
111+
""").strip()
108112

109113
only_respond_to_mentions: Annotated[
110114
bool,
@@ -712,7 +716,7 @@ class WorkspaceResponseBehaviorConfigModel(ResponseBehaviorConfigModel):
712716
- 🗃️ Upload files you are working with and I'll take it from there
713717
- 📝 I can make you an initial draft like *Write a proposal for new project management software in our department*
714718
- 🧪 Ask me to conduct research for example, *Find me the latest competitors in the wearables market*
715-
""")
719+
""").strip()
716720

717721

718722
class WorkspaceAssistantConfigModel(AssistantConfigModel):
@@ -754,6 +758,118 @@ class WorkspaceAssistantConfigModel(AssistantConfigModel):
754758
# region: Context Transfer Assistant Configuration
755759

756760

761+
class ContextTransferHostedMCPServersConfigModel(HostedMCPServersConfigModel):
762+
web_research: Annotated[
763+
HostedMCPServerConfig,
764+
Field(
765+
title="Web Research",
766+
description="Enable your assistant to perform web research on a given topic. It will generate a list of facts it needs to collect and use Bing search and simple web requests to fill in the facts. Once it decides it has enough, it will summarize the information and return it as a report.",
767+
),
768+
UISchema(collapsible=False),
769+
] = HostedMCPServerConfig.from_env("web-research", "MCP_SERVER_WEB_RESEARCH_URL", enabled=True)
770+
771+
open_deep_research_clone: Annotated[
772+
HostedMCPServerConfig,
773+
Field(
774+
title="Open Deep Research Clone",
775+
description="Enable a web research tool that is modeled after the Open Deep Research project as a demonstration of writing routines using our Skills library.",
776+
),
777+
UISchema(collapsible=False),
778+
] = HostedMCPServerConfig.from_env(
779+
"open-deep-research-clone", "MCP_SERVER_OPEN_DEEP_RESEARCH_CLONE_URL", enabled=False
780+
)
781+
782+
giphy: Annotated[
783+
HostedMCPServerConfig,
784+
Field(
785+
title="Giphy",
786+
description="Enable your assistant to search for and share GIFs from Giphy.",
787+
),
788+
UISchema(collapsible=False),
789+
] = HostedMCPServerConfig.from_env("giphy", "MCP_SERVER_GIPHY_URL", enabled=False)
790+
791+
memory_user_bio: Annotated[
792+
HostedMCPServerConfig,
793+
Field(
794+
title="User-Bio Memories",
795+
description=dedent("""
796+
Enable this assistant to store long-term memories about you, the user (\"user-bio\" memories).
797+
This implementation is modeled after ChatGPT's memory system.
798+
These memories are available to the assistant in all conversations, much like ChatGPT memories are available
799+
to ChatGPT in all chats.
800+
To determine what memories are saved, you can ask the assistant what memories it has of you.
801+
To forget a memory, you can ask the assistant to forget it.
802+
""").strip(),
803+
),
804+
UISchema(collapsible=False),
805+
] = HostedMCPServerConfig.from_env(
806+
"memory-user-bio",
807+
"MCP_SERVER_MEMORY_USER_BIO_URL",
808+
# scopes the memories to the assistant instance
809+
roots=[MCPClientRoot(name="session-id", uri="file://{assistant_id}")],
810+
# auto-include the user-bio memory prompt
811+
prompts_to_auto_include=["user-bio"],
812+
enabled=False,
813+
)
814+
815+
filesystem_edit: Annotated[
816+
HostedMCPServerConfig,
817+
Field(
818+
title="Document Editor",
819+
description=dedent("""
820+
Enable this to create, edit, and refine markdown (*.md) documents, all through chat
821+
""").strip(),
822+
),
823+
UISchema(collapsible=False),
824+
] = HostedMCPServerConfig.from_env(
825+
"filesystem-edit",
826+
"MCP_SERVER_FILESYSTEM_EDIT_URL",
827+
# configures the filesystem edit server to use the client-side storage (using the magic hostname of "workspace")
828+
roots=[MCPClientRoot(name="root", uri="file://workspace/")],
829+
prompts_to_auto_include=["instructions"],
830+
enabled=False,
831+
)
832+
833+
@property
834+
def mcp_servers(self) -> list[HostedMCPServerConfig]:
835+
"""
836+
Returns a list of all hosted MCP servers that are configured.
837+
"""
838+
# Get all fields that are of type HostedMCPServerConfig
839+
configs = [
840+
getattr(self, field)
841+
for field in self.model_fields
842+
if isinstance(getattr(self, field), HostedMCPServerConfig)
843+
]
844+
# Filter out any configs that are missing command (URL)
845+
return [config for config in configs if config.command]
846+
847+
848+
class ContextTransferMCPToolsConfigModel(MCPToolsConfigModel):
849+
enabled: Annotated[
850+
bool,
851+
Field(title="Enable experimental use of tools"),
852+
] = True
853+
854+
hosted_mcp_servers: Annotated[
855+
HostedMCPServersConfigModel,
856+
Field(
857+
title="Hosted MCP Servers",
858+
description="Configuration for hosted MCP servers that provide tools to the assistant.",
859+
),
860+
UISchema(collapsed=False, items=UISchema(title_fields=["key", "enabled"])),
861+
] = ContextTransferHostedMCPServersConfigModel()
862+
863+
personal_mcp_servers: Annotated[
864+
list[MCPServerConfig],
865+
Field(
866+
title="Personal MCP Servers",
867+
description="Configuration for personal MCP servers that provide tools to the assistant.",
868+
),
869+
UISchema(items=UISchema(collapsible=False, hide_title=True, title_fields=["key", "enabled"])),
870+
] = []
871+
872+
757873
class ContextTransferPromptsConfigModel(PromptsConfigModel):
758874
instruction_prompt: Annotated[
759875
str,
@@ -783,13 +899,50 @@ class ContextTransferPromptsConfigModel(PromptsConfigModel):
783899
] = helpers.load_text_include("guardrails_prompt_workspace.txt")
784900

785901

786-
class ContextTransferConfigModel(WorkspaceAssistantConfigModel):
902+
class ContextTransferResponseBehaviorConfigModel(ResponseBehaviorConfigModel):
903+
welcome_message: Annotated[
904+
str,
905+
Field(
906+
title="Welcome Message",
907+
description="The message to display when the conversation starts.",
908+
),
909+
UISchema(widget="textarea"),
910+
] = dedent("""
911+
Welcome! I'm here to help you capture and share complex information in a way that others can easily explore and understand. Think of me as your personal knowledge bridge - I'll help you:
912+
- 📚 **Organize your thoughts** - whether from documents, code, research papers, or brainstorming sessions
913+
- 🔄 **Establish shared understanding** - I'll ask questions to ensure we're aligned on what matters most
914+
- 🔍 **Make your knowledge interactive** - so others can explore the "why" behind decisions, alternatives considered, and deeper context
915+
- 🔗 **Create shareable experiences** - when we're done, share a link that gives others a self-service way to explore your knowledge
916+
917+
Simply share your content or ideas, tell me who needs to understand them, and what aspects you want to highlight. We'll work together to create an interactive knowledge space that others can explore at their own pace.
918+
919+
What knowledge would you like to transfer today?
920+
""").strip()
921+
922+
923+
class ContextTransferConfigModel(AssistantConfigModel):
924+
tools: Annotated[
925+
MCPToolsConfigModel,
926+
Field(
927+
title="Tools",
928+
),
929+
UISchema(collapsed=False, items=UISchema(schema={"hosted_mcp_servers": {"ui:options": {"collapsed": False}}})),
930+
] = ContextTransferMCPToolsConfigModel()
931+
787932
prompts: Annotated[
788933
PromptsConfigModel,
789934
Field(
790935
title="Prompts",
791936
),
792937
] = ContextTransferPromptsConfigModel()
793938

939+
response_behavior: Annotated[
940+
ResponseBehaviorConfigModel,
941+
Field(
942+
title="Response Behavior",
943+
description="Configuration for the response behavior of the assistant.",
944+
),
945+
] = ContextTransferResponseBehaviorConfigModel()
946+
794947

795948
# endregion

0 commit comments

Comments
 (0)