AI Agent Interface
Relevant source files
The following files were used as context for generating this wiki page:
- packages/web/src/components/agent/AgentInterface.tsx
- packages/web/src/lib/agent/agent-context.ts
- packages/web/src/lib/agent/agent-prompts.ts
- packages/web/src/lib/agent/registries/tool-registry.ts
- packages/web/src/components/agent/welcome/AgentWelcomeExamples.tsx
- packages/web/src/lib/agent/skills/content/superglue-concepts.md
The AI Agent Interface provides a conversational environment for users to build, manage, and debug integration systems and tools. It serves as an AI-native workspace where an expert integration agent interacts with users to automate the creation of deterministic workflows. The interface manages complex state including message history, tool execution results, and system documentation contexts to ensure that AI-generated tool configurations remain technically accurate and functional.
Sources: packages/web/src/lib/agent/agent-prompts.ts:4-53, packages/web/src/lib/agent/skills/content/superglue-concepts.md:3-8
System Architecture
The interface follows a client-side provider pattern that coordinates between the user UI, the AI model, and the superglue backend services. It utilizes a registry of tools that the agent can call to perform actions such as system creation, tool building, and documentation searching.
The diagram shows the data flow from the UI components through the context provider to specialized tools and backend APIs.
Sources: packages/web/src/components/agent/AgentInterface.tsx:187-210, packages/web/src/lib/agent/registries/tool-registry.ts:1330-1410
Core Components
AgentInterface
The primary React component manages the chat layout, including the conversation history, message list, and input area. It handles real-time message streaming and provides UI hooks for editing sent messages and managing file attachments.
Sources: packages/web/src/components/agent/AgentInterface.tsx:212-426
Tool Registry
The registry defines the schema and execution logic for every capability available to the AI agent. Each tool in the registry includes an inputSchema for the AI to follow and an execute function that performs the action.
Sources: packages/web/src/lib/agent/registries/tool-registry.ts:1330-1410
| Tool Name | Description | Required Inputs |
|---|---|---|
build_tool | Generates a new workflow configuration. | id, instruction, steps |
create_system | Sets up a new external integration. | name |
call_system | Executes a direct API or DB request. | url |
search_documentation | Queries system docs for technical details. | systemId, keywords |
load_skill | Injects specialized knowledge/tools. | skills |
Sources: packages/web/src/lib/agent/registries/tool-registry.ts:68-1410
Tool Building Workflow
The agent follows a structured multi-step process to create tools. This process ensures that the resulting tool is deterministic and correctly authenticated.
The sequence illustrates the transition from system setup to tool construction using specialized skills.
Sources: packages/web/src/lib/agent/agent-prompts.ts:6-23, packages/web/src/lib/agent/registries/tool-registry.ts:133-170
Skill Management
The agent uses load_skill to dynamically update its context. Skills are internal operations that provide detailed reference documentation for specific protocols (e.g., http-apis, databases, redis) or complex features like tool-building and access-rules.
Sources: packages/web/src/lib/agent/agent-prompts.ts:137-154, packages/web/src/lib/agent/registries/tool-registry.ts:1143-1172
Context Injection and Prompts
The interface generates dynamic system prompts based on the current workspace state. Before each turn, it retrieves a list of AVAILABLE SYSTEMS and AVAILABLE TOOLS to ground the AI's responses in the user's actual environment.
Prompt Types
- Main Agent: Used for general interaction and orchestration.
- Tool Playground: Optimized for refining existing tool JSON configurations.
- System Playground: Focused on debugging authentication and credentials.
- Discovery: Guides users through setting up new integrations by searching documentation.
Sources: packages/web/src/lib/agent/agent-context.ts:168-305
Implementation Detail: Initialization Markers
The system uses hidden initialization markers to sync the state between the UI editor and the chat agent.
export const TOOL_PLAYGROUND_INIT_MARKER = "[TOOL PLAYGROUND INITIAL STATE]";
export const SYSTEM_PLAYGROUND_INIT_MARKER = "[SYSTEM PLAYGROUND INITIAL STATE]";
Sources: packages/web/src/lib/agent/agent-context.ts:101-131
User Interaction and Mentions
Users interact via a text area that supports "mentions" (using the @ symbol) to reference specific tools, systems, or previous runs. The AgentInterface reconciles these references to ensure the AI agent knows exactly which entity is being discussed.
- Tools: Referenced to trigger edits or executions.
- Systems: Referenced to discuss configuration or documentation.
- Runs: Referenced (within a 7-day window) to debug specific failures.
Sources: packages/web/src/components/agent/AgentInterface.tsx:437-478, packages/web/src/lib/agent/agent-context.ts:327-567
The AI Agent Interface centralizes integration management by combining natural language processing with deterministic tool execution, allowing for rapid, guided construction of reliable software workflows.