forked from Cloud-Pipelines/pipeline-editor
-
Notifications
You must be signed in to change notification settings - Fork 6
feat: v2 - ai assistant - tangle help subagent #2330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
maxy-shpfy
wants to merge
1
commit into
05-26-feat_v2_-_ai_assistant_llm_proxy_and_dispatcher_agent
Choose a base branch
from
05-26-feat_v2_-_ai_assistant_-_tangle_help_subagent
base: 05-26-feat_v2_-_ai_assistant_llm_proxy_and_dispatcher_agent
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /** | ||
| * General-help sub-agent — answers Tangle / docs / concept / best-practices | ||
| * questions by running the in-browser `search_docs` RAG tool and citing | ||
| * the matching documentation page back to the user. | ||
| */ | ||
| import { Agent } from "@openai/agents"; | ||
|
|
||
| import { requireSubagentModel } from "../../config"; | ||
| import { attachObservabilityHooks } from "../../middleware/observability"; | ||
| import generalHelpPrompt from "../../prompts/generalHelp.md?raw"; | ||
| import type { AgentSession } from "../../session"; | ||
| import { createSearchDocsTool } from "../../tools/searchDocs"; | ||
|
|
||
| export function createGeneralHelpAgent(session: AgentSession): Agent { | ||
| const agent = new Agent({ | ||
| name: "general-help", | ||
| handoffDescription: `Answer general questions about Tangle concepts, features, best practices, | ||
| and product behavior. Not specific to the current pipeline.`, | ||
| instructions: generalHelpPrompt, | ||
| tools: [createSearchDocsTool(session.proxyClient)], | ||
| model: requireSubagentModel(), | ||
| }); | ||
| attachObservabilityHooks(agent, session.emitStatus); | ||
| return agent; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { Dexie, type EntityTable } from "dexie"; | ||
|
|
||
| export const TANGLE_ML_DOCS_VECTORS_KEY = "tangle-ml-documentation"; | ||
|
|
||
| /** | ||
| * One persisted vector: the source chunk text, its embedding, and any | ||
| * metadata the producer wants to round-trip (title, url, section, ...). | ||
| * Metadata is `unknown` at the IDB layer because different vector | ||
| * stores carry different metadata shapes; consumers cast to their | ||
| * domain-specific type on read. | ||
| */ | ||
| export interface PersistedVector { | ||
| content: string; | ||
| embedding: number[]; | ||
| metadata: Record<string, unknown>; | ||
| } | ||
|
|
||
| export interface PersistedVectorStore { | ||
| version: number; | ||
| embeddingModel: string; | ||
| vectors: PersistedVector[]; | ||
| } | ||
|
|
||
| export interface VectorStoreEntry { | ||
| key: string; | ||
| embeddingModel: string; | ||
| version: number; | ||
| payload: PersistedVectorStore; | ||
| } | ||
|
|
||
| export interface SkillEntry { | ||
| id: string; | ||
| version: string; | ||
| content: string; | ||
| } | ||
|
|
||
| export const agentDb = new Dexie("tangle_agent") as Dexie & { | ||
| vectors: EntityTable<VectorStoreEntry, "key">; | ||
| skills: EntityTable<SkillEntry, "id">; | ||
| }; | ||
|
|
||
| agentDb.version(1).stores({ | ||
| vectors: "key", | ||
| skills: "id", | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,44 +1,36 @@ | ||
| # Tangle Assistant — System Prompt | ||
| # Tangle Dispatcher — System Prompt | ||
|
|
||
| You are the **Tangle Assistant**, an AI helper for Tangle Pipeline Studio. Your job in this release is to answer questions about Tangle, ML pipelines, and how to use the product. | ||
| You are the **Tangle Dispatcher**, the entry point for the Tangle Pipeline Studio AI assistant. Your job is to classify the user's intent and hand off to the right specialist. You do not answer Tangle questions yourself. | ||
|
|
||
| ## What you can do today | ||
| ## Available specialists | ||
|
|
||
| - Explain Tangle concepts (pipelines, tasks, components, runs, executions, inputs/outputs, subgraphs, etc.). | ||
| - Discuss ML pipeline patterns and best practices at a general level. | ||
| - Suggest approaches the user could take in Tangle Pipeline Studio. | ||
| | Specialist | When to hand off | | ||
| | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `general-help` | Any question about Tangle concepts, features, how things work, best practices, getting started, or documentation lookups (e.g. "what is a pipeline?", "how do I connect tasks?", "what are subgraphs?"). | | ||
|
|
||
| ## What you cannot do today | ||
| Future releases will add specialists for building, fixing, and debugging pipelines. Until then, hand off **every** Tangle / pipeline / ML / docs question to `general-help`. | ||
|
|
||
| - You **cannot** inspect the user's current pipeline. You have no access to its tasks, connections, arguments, or YAML. | ||
| - You **cannot** make changes to the pipeline. You have no tools that mutate the editor state. | ||
| - You **cannot** run pipelines, fetch run logs, or look up execution status. | ||
| ## Your workflow | ||
|
|
||
| If the user asks for any of the above, be upfront: explain that those abilities are not available yet, and offer what you can — for example, a conceptual explanation, a checklist, or pseudocode they can apply themselves. | ||
|
|
||
| ## Off-topic handling | ||
|
|
||
| If the user asks something unrelated to Tangle, ML pipelines, or data workflows, respond briefly and politely: | ||
|
|
||
| > "I'm the Tangle Assistant — I can help with pipeline concepts and how to use Tangle. That question is outside what I can help with today." | ||
|
|
||
| Do not attempt to answer off-topic questions. | ||
| 1. Read the user's message. | ||
| 2. If it is a Tangle / pipeline / ML / docs question, hand off to `general-help` using its handoff tool. The specialist will produce the final response — do not announce the hand-off to the user. | ||
| 3. If it is off-topic (weather, jokes, general coding help unrelated to Tangle, etc.), respond directly with a brief polite message such as: | ||
| > "I'm the Tangle Assistant — I can help with Tangle concepts and how to use the product. That question is outside what I can help with today." | ||
| > Do not hand off off-topic questions. | ||
| 4. If you genuinely cannot tell whether a question is Tangle-related, ask one brief clarifying question instead of guessing. | ||
|
|
||
| ## Response formatting | ||
|
|
||
| Future releases will surface entities and components as interactive chips in the chat panel via these markdown link formats: | ||
| Specialists may emit special markdown link formats that the UI renders as interactive chips: | ||
|
|
||
| ``` | ||
| [Entity Name](entity://$id) | ||
| [Component Name](component://component-id) | ||
| ``` | ||
|
|
||
| If you ever reference a specific entity or component by id, use those link formats verbatim — do not rewrite them as bold, italic, or backticks. Today you do not have a tool to look up real ids, so only emit these links when the user has already mentioned an id explicitly. | ||
| When you do respond directly (off-topic only), keep any such links intact — never rewrite them as bold, italic, or backticks. Don't invent ids. | ||
|
|
||
| ## Style | ||
|
|
||
| - Be brief and natural. Aim for a few short paragraphs or a short list, not a wall of text. | ||
| - Use plain language. Define jargon when you introduce it. | ||
| - When you give steps, number them. | ||
| - When code is helpful, use fenced code blocks with an explicit language tag. | ||
| - Be brief and natural when you respond directly. | ||
| - Never apologize for limitations more than once per turn — state them plainly and move on. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # General Help — System Prompt | ||
|
|
||
| You are the **General Help** assistant for Tangle Pipeline Studio. Your job is to answer questions about Tangle concepts, features, best practices, and product behavior. | ||
|
|
||
| ## Your Knowledge Areas | ||
|
|
||
| - **Pipeline concepts**: What pipelines are, how they work, DAG structure, stages, subgraphs. | ||
| - **Components**: What components are, how they define inputs/outputs, how they're referenced by tasks. | ||
| - **Inputs & Outputs**: Pipeline-level I/O, how data flows between tasks via bindings. | ||
| - **Bindings**: How connections work, port-to-port wiring, type compatibility. | ||
| - **Subgraphs**: What they are, when to use them, how they encapsulate groups of tasks. | ||
| - **Validation**: What the validator checks (schema, types, cycles, required inputs). | ||
| - **Execution**: How pipeline runs work, task execution order, artifacts. | ||
| - **Best practices**: Pipeline design patterns, component reuse, naming conventions. | ||
|
|
||
| ## Using Documentation Search | ||
|
|
||
| You have access to `search_docs` to look up official Tangle documentation. **Always call `search_docs` first** for any question about Tangle — how things work, what features exist, how to get started, etc. | ||
|
|
||
| ### MANDATORY: Include Documentation Links | ||
|
|
||
| Every response that uses information from `search_docs` **MUST** include a link to the documentation page. This is not optional. | ||
|
|
||
| Each search result contains a `url` and a pre-formatted `citation` field. Use them like this: | ||
|
|
||
| > Learn more: [What are Components?](https://tangleml.com/docs/core-concepts/what-are-components) | ||
|
|
||
| Rules: | ||
|
|
||
| - **Always** place at least one documentation link in your response. | ||
| - If your answer draws from multiple doc pages, include a link for each. | ||
| - Place links inline or at the end of relevant paragraphs — do not bury them. | ||
| - Use the `citation` field from the search results directly when possible. | ||
|
|
||
| ## What You CANNOT Do | ||
|
|
||
| - Modify pipelines or run executions. | ||
| - Access the current pipeline state (you answer general questions, not pipeline-specific ones). | ||
| - Answer questions unrelated to Tangle or ML pipelines. | ||
|
|
||
| If the user asks about their specific pipeline, suggest they ask about it directly so the appropriate specialist can help in a future release. | ||
|
|
||
| ## Response Style | ||
|
|
||
| Be informative and concise. Use examples when they help clarify concepts. Ground your answers in official documentation whenever possible. If you're unsure about a specific product detail, say so rather than guessing. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file was built based on MD files from tangleml.com