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
26 changes: 26 additions & 0 deletions apps/dojo/src/agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,32 @@ export const agentsIntegrations = {
}
),

"agent-spec-langgraph": async () =>
mapAgents(
(path) => new HttpAgent({
url: `${envVars.agentSpecUrl}/langgraph/${path}`,
}),
{
agentic_chat: "agentic_chat",
backend_tool_rendering: "backend_tool_rendering",
human_in_the_loop: "human_in_the_loop",
tool_based_generative_ui: "tool_based_generative_ui",
}
),

"agent-spec-wayflow": async () =>
mapAgents(
(path) => new HttpAgent({
url: `${envVars.agentSpecUrl}/wayflow/${path}`,
}),
{
agentic_chat: "agentic_chat",
backend_tool_rendering: "backend_tool_rendering",
tool_based_generative_ui: "tool_based_generative_ui",
human_in_the_loop: "human_in_the_loop",
}
),

"microsoft-agent-framework-python": async () =>
mapAgents(
(path) => new HttpAgent({ url: `${envVars.agentFrameworkPythonUrl}/${path}` }),
Expand Down
2 changes: 2 additions & 0 deletions apps/dojo/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type envVars = {
springAiUrl: string;
llamaIndexUrl: string;
crewAiUrl: string;
agentSpecUrl: string;
pydanticAIUrl: string;
adkMiddlewareUrl: string;
agentFrameworkPythonUrl: string;
Expand Down Expand Up @@ -41,6 +42,7 @@ export default function getEnvVars(): envVars {
agnoUrl: process.env.AGNO_URL || 'http://localhost:9001',
llamaIndexUrl: process.env.LLAMA_INDEX_URL || 'http://localhost:9000',
crewAiUrl: process.env.CREW_AI_URL || 'http://localhost:9002',
agentSpecUrl: process.env.AGENT_SPEC_URL || 'http://localhost:9003',
pydanticAIUrl: process.env.PYDANTIC_AI_URL || 'http://localhost:9000',
adkMiddlewareUrl: process.env.ADK_MIDDLEWARE_URL || 'http://localhost:8000',
agentFrameworkPythonUrl: process.env.AGENT_FRAMEWORK_PYTHON_URL || 'http://localhost:8888',
Expand Down
20 changes: 20 additions & 0 deletions apps/dojo/src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ import type { IntegrationFeatures, MenuIntegrationConfig } from "./types/integra
*/

export const menuIntegrations = [
{
id: "agent-spec-langgraph",
name: "Open Agent Spec (LangGraph)",
features: [
"agentic_chat",
"backend_tool_rendering",
"human_in_the_loop",
"tool_based_generative_ui",
],
},
{
id: "agent-spec-wayflow",
name: "Open Agent Spec (Wayflow)",
features: [
"agentic_chat",
"backend_tool_rendering",
"human_in_the_loop",
"tool_based_generative_ui",
],
},
{
id: "langgraph",
name: "LangGraph (Python)",
Expand Down
57 changes: 57 additions & 0 deletions integrations/agent-spec/python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
Open Agent Spec <> AG‑UI (Python)
=================================

Agent runner that emits AG‑UI events and a small FastAPI/uvicorn server to stream them to Dojo via SSE.

What this is
- Agent runner: `ag_ui_agentspec/agent.py` executes an Agent Spec configuration on a chosen runtime and bridges spans to AG‑UI events.
- Server wiring: `ag_ui_agentspec/endpoint.py` exposes a POST SSE endpoint that streams those events to the Dojo frontend.

Supported agent runtimes and Dojo features
- Wayflow (Oracle's reference agent framework) (chat, frontend tools, backend tools)
- LangGraph (chat, frontend tools, backend tools, tool call streaming)

## Install

Base library plus optional extras so you can choose runtimes. Routers are lazy-loaded; if you don't install a runtime, its routes will not work.

Before installation, please clone the following GitHub repositories:
- [AG-UI](https://github.com/ag-ui-protocol/ag-ui) and `cd ag-ui/integrations/agent-spec/python`
- [Agent Spec](https://github.com/oracle/agent-spec)
- [WayFlow](https://github.com/oracle/wayflow)
- Please put these 3 repos in the same directory.


```bash
# Wayflow only
uv pip install -e .[wayflow]

# LangGraph only
uv pip install -e .[langgraph]

# Multiple
uv pip install -e .[wayflow,langgraph]
```

Run the example server
```bash
cd ag-ui/integrations/agent-spec/python/examples
uv sync --extra langgraph --extra wayflow && uv run dev # both runtimes; serves http://localhost:9003
# or pick one runtime:
# uv sync --extra langgraph && uv run dev
# uv sync --extra wayflow && uv run dev
# then run Dojo (in a separate terminal):
# Option A — run everything from repo root (multiple apps):
# pnpm turbo run dev
# Option B — run only Dojo:
# cd ag-ui/apps/dojo
# AGENT_SPEC_URL=http://localhost:9003 pnpm dev (make sure to run pnpm build first)
```

Environment
- OpenAI-compatible variables commonly used by the examples (pick your provider):
- `OPENAI_BASE_URL` (or provider-specific: `OSS_API_URL`, `LLAMA_API_URL`, etc.)
- `OPENAI_MODEL` (the model slug, defaults to `gpt-4o` availble through OpenAI API)
- `OPENAI_API_KEY`
- Dojo server URL:
- `AGENT_SPEC_URL=http://localhost:9003` when running the local example server
5 changes: 5 additions & 0 deletions integrations/agent-spec/python/ag_ui_agentspec/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from ag_ui_agentspec.endpoint import add_agentspec_fastapi_endpoint

__all__ = [
"add_agentspec_fastapi_endpoint",
]
35 changes: 35 additions & 0 deletions integrations/agent-spec/python/ag_ui_agentspec/agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from typing import Literal

from ag_ui.core import RunAgentInput
from ag_ui_agentspec.agentspec_tracing_exporter import AgUiSpanProcessor
from pyagentspec.tracing.trace import Trace
from pyagentspec.tracing.spans.span import Span
from ag_ui_agentspec.agentspecloader import load_agent_spec


class AgentSpecAgent:
def __init__(
self,
agent_spec_config: str,
runtime: Literal["langgraph", "wayflow"],
tool_registry=None,
additional_processors=None
):
if runtime not in {"langgraph", "wayflow"}:
raise NotImplementedError("other runtimes are not supported yet")
self.runtime = runtime
self.framework_agent = load_agent_spec(runtime, agent_spec_config, tool_registry)
self.processors = [AgUiSpanProcessor(runtime=runtime)] + (additional_processors or [])

async def run(self, input_data: RunAgentInput) -> None:
agent = self.framework_agent
async with Trace(name="ag-ui run wrapper", span_processors=self.processors):
async with Span(name="invoke_graph"):
if self.runtime == "langgraph":
from ag_ui_agentspec.runtimes.langgraph_runner import run_langgraph_agent
await run_langgraph_agent(agent, input_data)
elif self.runtime == "wayflow":
from ag_ui_agentspec.runtimes.wayflow_runner import run_wayflow
await run_wayflow(agent, input_data)
else:
raise NotImplementedError(f"Unsupported runtime: {self.runtime}")
Loading