Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions typescript-sdk/apps/dojo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@ag-ui/pydantic-ai": "workspace:*",
"@ag-ui/server-starter": "workspace:*",
"@ag-ui/server-starter-all-features": "workspace:*",
"@ag-ui/superoptix": "workspace:*",
"@ag-ui/vercel-ai-sdk": "workspace:*",
"@ai-sdk/openai": "^1.3.22",
"@copilotkit/react-core": "1.9.2",
Expand Down
6 changes: 6 additions & 0 deletions typescript-sdk/apps/dojo/scripts/generate-content-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ const agentFilesMapper: Record<string, (agentKeys: string[]) => Record<string, s
...acc,
[agentId]: [path.join(__dirname, integrationsFolderPath, `/crewai/python/ag_ui_crewai/examples/${agentId}.py`)]
}), {})
},
'superoptix': (agentKeys: string[]) => {
return agentKeys.reduce((acc, agentId) => ({
...acc,
[agentId]: [path.join(__dirname, integrationsFolderPath, `/superoptix/python/ag_ui_superoptix/endpoint.py`)]
}), {})
}
}

Expand Down
26 changes: 26 additions & 0 deletions typescript-sdk/apps/dojo/src/agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { LangGraphAgent, LangGraphHttpAgent } from "@ag-ui/langgraph";
import { AgnoAgent } from "@ag-ui/agno";
import { LlamaIndexAgent } from "@ag-ui/llamaindex";
import { CrewAIAgent } from "@ag-ui/crewai";
import { SuperOptiXAgent } from "@ag-ui/superoptix";
import getEnvVars from "./env";
import { mastra } from "./mastra";
import { PydanticAIAgent } from "@ag-ui/pydantic-ai";
Expand Down Expand Up @@ -220,4 +221,29 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
};
},
},
{
id: "superoptix",
agents: async () => {
return {
agentic_chat: new SuperOptiXAgent({
url: `${envVars.superoptixUrl || "http://localhost:8000"}/agentic_chat`,
}),
human_in_the_loop: new SuperOptiXAgent({
url: `${envVars.superoptixUrl || "http://localhost:8000"}/human_in_the_loop`,
}),
tool_based_generative_ui: new SuperOptiXAgent({
url: `${envVars.superoptixUrl || "http://localhost:8000"}/tool_based_generative_ui`,
}),
agentic_generative_ui: new SuperOptiXAgent({
url: `${envVars.superoptixUrl || "http://localhost:8000"}/agentic_generative_ui`,
}),
shared_state: new SuperOptiXAgent({
url: `${envVars.superoptixUrl || "http://localhost:8000"}/shared_state`,
}),
predictive_state_updates: new SuperOptiXAgent({
url: `${envVars.superoptixUrl || "http://localhost:8000"}/predictive_state_updates`,
}),
};
},
},
];
2 changes: 2 additions & 0 deletions typescript-sdk/apps/dojo/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type envVars = {
llamaIndexUrl: string;
crewAiUrl: string;
pydanticAIUrl: string;
superoptixUrl: string;
}

export default function getEnvVars(): envVars {
Expand All @@ -21,5 +22,6 @@ export default function getEnvVars(): envVars {
llamaIndexUrl: process.env.LLAMA_INDEX_URL || 'http://localhost:9000',
crewAiUrl: process.env.CREW_AI_URL || 'http://localhost:9002',
pydanticAIUrl: process.env.PYDANTIC_AI_URL || 'http://localhost:9000',
superoptixUrl: process.env.SUPEROPTIX_URL || 'http://localhost:8000',
}
}
156 changes: 156 additions & 0 deletions typescript-sdk/apps/dojo/src/files.json

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions typescript-sdk/apps/dojo/src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,16 @@ export const menuIntegrations: MenuIntegrationConfig[] = [
"predictive_state_updates",
],
},
{
id: "superoptix",
name: "SuperOptiX",
features: [
"agentic_chat",
"human_in_the_loop",
"tool_based_generative_ui",
"agentic_generative_ui",
"shared_state",
"predictive_state_updates",
],
},
];
13 changes: 13 additions & 0 deletions typescript-sdk/integrations/superoptix/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.turbo
.DS_Store
.git
.gitignore
.idea
.vscode
.env
__tests__
src
tsup.config.ts
tsconfig.json
jest.config.js
server
141 changes: 141 additions & 0 deletions typescript-sdk/integrations/superoptix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# SuperOptiX AG-UI Integration

This integration enables [SuperOptiX](https://superoptix.ai) agents to work seamlessly with the AG-UI ecosystem. SuperOptiX is a [DSPy](https://dspy.ai)-powered agent framework for agent development and optimization.

## πŸš€ Quick Start

### Prerequisites
- Python 3.12+
- Node.js 18+
- SuperOptiX CLI

### Installation

1. **Install SuperOptiX CLI:**
```bash
pip install superoptix
```

2. **Install AG-UI SuperOptiX packages:**
```bash
# Install Python package
cd typescript-sdk/integrations/superoptix/python
pip install -e .

# Install TypeScript package (from typescript-sdk root)
cd ../../..
pnpm install
```

### Setup SuperOptiX Project

1. **Create a SuperOptiX project:**
```bash
super init swe
cd swe
```

2. **Pull and compile an agent:**
```bash
super agent pull developer
super agent compile developer
```

3. **Configure the server:**
- Edit `typescript-sdk/integrations/superoptix/python/example_server.py`
- Update `PROJECT_ROOT` to point to your SuperOptiX project
- Update `AGENT_NAME` if using a different agent

### Running the Integration

1. **Start the SuperOptiX server:**
```bash
cd typescript-sdk/integrations/superoptix/python
python example_server.py
```

2. **Start the AG-UI dojo:**
```bash
cd typescript-sdk/apps/dojo
pnpm dev
```

3. **Test the integration:**
- Open `http://localhost:3000/superoptix/feature/agentic_chat`
- Start chatting with your SuperOptiX agent!

## πŸ“ Project Structure

```
typescript-sdk/integrations/superoptix/
β”œβ”€β”€ python/
β”‚ β”œβ”€β”€ example_server.py # AG-UI server with setup instructions
β”‚ β”œβ”€β”€ ag_ui_superoptix/ # AG-UI integration package
β”‚ └── README.md # This file
β”œβ”€β”€ src/ # TypeScript SDK
└── README.md # Integration documentation
```

## πŸ”§ Configuration

### Server Configuration

The `example_server.py` file contains configuration options:

```python
# Update these paths to match your setup
PROJECT_ROOT = Path("/path/to/your/superoptix/project")
AGENT_NAME = "developer" # Your agent name
```

### Environment Variables

- `PORT`: Server port (default: 8000)
- `SUPEROPTIX_URL`: SuperOptiX server URL (default: http://localhost:8000)

## 🎯 Available Features

Test these SuperOptiX features in the AG-UI dojo:

- **Agentic Chat**: `http://localhost:3000/superoptix/feature/agentic_chat`
- **Human in the Loop**: `http://localhost:3000/superoptix/feature/human_in_the_loop`
- **Tool-based Generative UI**: `http://localhost:3000/superoptix/feature/tool_based_generative_ui`
- **Agentic Generative UI**: `http://localhost:3000/superoptix/feature/agentic_generative_ui`
- **Shared State**: `http://localhost:3000/superoptix/feature/shared_state`
- **Predictive State Updates**: `http://localhost:3000/superoptix/feature/predictive_state_updates`

## πŸ› οΈ Troubleshooting

### Common Issues

1. **"SuperOptiX project not found"**
- Ensure you ran `super init` and created a project
- Update `PROJECT_ROOT` in `example_server.py`

2. **"Agent not found"**
- Run `super agent pull developer` and `super agent compile developer`
- Verify the agent name in `AGENT_NAME`

3. **"404 Not Found" errors**
- Ensure SuperOptiX server is running on port 8000
- Check that both servers are accessible

4. **Build errors**
- Run `pnpm build` in typescript-sdk directory
- Ensure all dependencies are installed

### Debugging

- Check server logs for Python errors
- Check browser console for JavaScript errors
- Verify SuperOptiX project structure with `.super` file and agents directory

## πŸ“š Additional Resources

- [SuperOptiX Documentation](https://superoptix.ai)
- [AG-UI Documentation](https://docs.ag-ui.com)
- [DSPy Documentation](https://dspy.ai)

## 🀝 Contributing

This integration follows the standard AG-UI integration patterns. See the main AG-UI repository for contribution guidelines.
10 changes: 10 additions & 0 deletions typescript-sdk/integrations/superoptix/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
testMatch: ["**/*.test.ts"],
passWithNoTests: true,
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1",
},
};
40 changes: 40 additions & 0 deletions typescript-sdk/integrations/superoptix/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "@ag-ui/superoptix",
"author": "Your Name <[email protected]>",
"version": "0.0.1",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"sideEffects": false,
"files": [
"dist/**",
"README.md"
],
"private": false,
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"clean": "rm -rf dist",
"typecheck": "tsc --noEmit",
"test": "jest",
"link:global": "pnpm link --global",
"unlink:global": "pnpm unlink --global"
},
"dependencies": {
"@ag-ui/client": "workspace:*"
},
"peerDependencies": {
"rxjs": "7.8.1"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^20.11.19",
"jest": "^29.7.0",
"ts-jest": "^29.1.2",
"tsup": "^8.0.2",
"typescript": "^5.3.3"
}
}
69 changes: 69 additions & 0 deletions typescript-sdk/integrations/superoptix/python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# AG-UI SuperOptiX Python Server

This package provides the Python server implementation for AG-UI integration with SuperOptiX agents.

## Features

- FastAPI server for SuperOptiX DSPy pipelines
- AG-UI event streaming
- Tool call handling
- State management

## Installation

```bash
poetry install
```

## Development

```bash
poetry run dev
```

## Prerequisites

Your SuperOptiX project must follow the standard SuperOptiX project structure:

```
your_project/
β”œβ”€β”€ .super # Project configuration file
β”œβ”€β”€ your_project_name/ # Project name directory
β”‚ └── agents/
β”‚ └── your_agent_name/ # Agent directory
β”‚ β”œβ”€β”€ pipelines/
β”‚ β”‚ └── your_agent_name_pipeline.py # Pipeline file
β”‚ └── playbook/
β”‚ └── your_agent_name_playbook.yaml # Playbook file
```

## Usage

### Basic Usage

```python
from ag_ui_superoptix.endpoint import add_superoptix_fastapi_endpoint
from fastapi import FastAPI

app = FastAPI()
add_superoptix_fastapi_endpoint(app, agent_name="developer", path="/")
```

### Example with swe project

```python
from pathlib import Path
from fastapi import FastAPI
from ag_ui_superoptix.endpoint import add_superoptix_fastapi_endpoint

app = FastAPI()

# Point to the swe project directory
project_root = Path(__file__).parent.parent.parent.parent.parent / "swe"
add_superoptix_fastapi_endpoint(
app,
agent_name="developer", # Matches swe/swe/agents/developer/
project_root=project_root,
path="/"
)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""
AG-UI integration for SuperOptiX agents.
"""

from .endpoint import add_superoptix_fastapi_endpoint

__version__ = "0.0.1"
__all__ = ["add_superoptix_fastapi_endpoint"]
Loading