### Install Example Requirements Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/python/README.md Install the necessary requirements for running the examples. ```bash uv pip install -r requirements.txt ``` -------------------------------- ### Install and Run Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/server-starter/typescript/README.md Navigate to the Python examples directory and install dependencies, then run the development server. ```bash cd integrations/server-starter/python/examples poetry install && poetry run dev ``` -------------------------------- ### Install Dependencies for Examples Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/claude-agent-sdk/typescript/README.md Navigate to the integration directory and install project dependencies using pnpm. ```bash # Install dependencies cd integrations/claude-agent-sdk/typescript pnpm install ``` -------------------------------- ### Run Dojo Examples with Poetry Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/langgraph/python/README.md Navigate to the examples directory and use Poetry to install dependencies and run the development server for the dojo examples. ```bash cd python/ag_ui_langgraph/examples poetry install poetry run dev ``` -------------------------------- ### Run Example Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/langgraph/typescript/README.md Navigate to the example directory and start the development server using the 'langgraph dev' command. ```bash cd integrations/langgraph/typescript/examples langgraph dev ``` -------------------------------- ### Install Rails Example Dependencies Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/community/ruby/example/rails/README.md Navigate to the Rails example directory and install project dependencies using Bundler. ```bash cd sdks/community/ruby/example/rails bundle install ``` -------------------------------- ### Install Dependencies and Run Example Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/claude-agent-sdk/python/README.md Install project dependencies and run the example server for the Claude Agent SDK. Ensure you set your Anthropic API key. ```bash # Install dependencies cd integrations/claude-agent-sdk/python pip install -e . # Start server (port 8019) cd examples ANTHROPIC_API_KEY=sk-ant-xxx python server.py ``` -------------------------------- ### Run the Server Starter Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/server-starter-all-features/typescript/README.md Navigate to the Python examples directory and install dependencies, then run the development server. ```bash cd integrations/server-starter-all-features/python/examples poetry install && poetry run dev ``` -------------------------------- ### Start Backend Server with uv Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/microsoft-agent-framework/python/examples/README.md Starts the Dojo backend server using uv. Ensure you are in the examples directory. ```bash cd integrations/microsoft-agent-framework/python/examples uv run dev ``` -------------------------------- ### Run Example Server with Both Runtimes Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/agent-spec/python/README.md Starts the example server with both Wayflow and LangGraph runtimes enabled, serving on http://localhost:9003. Ensure all dependencies are synced first. ```bash cd ag-ui/integrations/agent-spec/python/examples uv sync --extra langgraph --extra wayflow && uv run dev ``` -------------------------------- ### Run Example Server in Python Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/crew-ai/typescript/README.md Navigate to the Python integration directory and install dependencies, then run the development server. ```bash cd integrations/crew-ai/python poetry install && poetry run dev ``` -------------------------------- ### Install Dart Dependencies Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/community/dart/example/README.md Navigate to the Dart example directory and install its dependencies using 'dart pub get'. ```bash # Navigate to the Dart example directory cd sdks/community/dart/example # Install dependencies dart pub get ``` -------------------------------- ### Install Dependencies and Start Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/claude-agent-sdk/python/examples/README.md Installs the necessary Python dependencies and starts the Claude Agent SDK server. Ensure your ANTHROPIC_API_KEY is set. ```bash # Install dependencies cd ../ pip install -e . # Start server cd examples ANTHROPIC_API_KEY=sk-ant-xxx python server.py ``` -------------------------------- ### Launch Frontend Dojo Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/llama-index/python/examples/README.md Navigate to the parent directory, install dependencies with 'pnpm install', and start the development server with 'pnpm dev'. ```bash cd ../.. pnpm install pnpm dev ``` -------------------------------- ### Run Example Server with LangGraph Only Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/agent-spec/python/README.md Starts the example server with only the LangGraph runtime enabled. Ensure all dependencies are synced first. ```bash cd ag-ui/integrations/agent-spec/python/examples uv sync --extra langgraph && uv run dev ``` -------------------------------- ### Install Ruby Dependencies Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/community/ruby/example/simple-use/README.md Navigate to the Ruby example directory and install project dependencies using Bundler. ```bash cd sdks/community/ruby/example/simple-use bundle install ``` -------------------------------- ### Install Dependencies with uv Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/microsoft-agent-framework/python/examples/README.md Installs project dependencies using uv. Navigate to the examples directory first. ```bash cd integrations/microsoft-agent-framework/python/examples uv sync ``` -------------------------------- ### Run Example Server with Wayflow Only Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/agent-spec/python/README.md Starts the example server with only the Wayflow runtime enabled. Ensure all dependencies are synced first. ```bash cd ag-ui/integrations/agent-spec/python/examples uv sync --extra wayflow && uv run dev ``` -------------------------------- ### Install Dependencies Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/python/examples/README.md Use 'uv sync' to install the necessary dependencies for the ADK middleware examples. ```bash uv sync ``` -------------------------------- ### Run LangGraph Python Examples Locally Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/langgraph/python/examples/README.md Navigate to the examples directory and use the LangGraph CLI to start the development server. ```bash cd integrations/langgraph/python/examples pnpx @langchain/langgraph-cli@1.1.13 dev ``` -------------------------------- ### Run Examples with Uvicorn Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/python/CLAUDE.md Commands to navigate to the examples directory, install dependencies with uv, and run the development server or directly with uvicorn. ```bash cd examples uv sync uv run dev ``` ```bash uvicorn server:app --host 0.0.0.0 --port 8000 ``` -------------------------------- ### Start Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/claude-agent-sdk/typescript/README.md Start the example server using tsx, ensuring the ANTHROPIC_API_KEY environment variable is set. ```bash # Start server (port 8889) ANTHROPIC_API_KEY=sk-ant-xxx npx tsx examples/server.ts ``` -------------------------------- ### Install and Run AG-UI Dojo Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/typescript/README.md In the root directory of the cloned ag-ui repository, install dependencies with pnpm install and start the development server with pnpm run dev. ```bash pnpm install && pnpm run dev ``` -------------------------------- ### create-ag-ui-app with Framework Flags Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/typescript/packages/cli/README.md Run the create-ag-ui-app installer with specific framework flags for direct project setup. ```bash # Interactive setup npx create-ag-ui-app@latest # With framework flags npx create-ag-ui-app@latest --langgraph-py npx create-ag-ui-app@latest --mastra # See all options npx create-ag-ui-app@latest --help ``` -------------------------------- ### Complete SSE Client Usage Example Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/go/client/overview.mdx A full example demonstrating how to create an SSE client, start a stream with a payload, and process incoming text and finished events. Ensure proper error handling for stream initialization and event processing. ```go package main import ( "context" "fmt" "log" "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/client/sse" "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/core/events" ) func main() { // Create SSE client client := sse.NewClient(sse.Config{ Endpoint: "https://api.example.com/agent", APIKey: "your-api-key", }) // Start streaming ctx := context.Background() frames, errors, err := client.Stream(sse.StreamOptions{ Context: ctx, Payload: map[string]interface{}{ "threadId": "thread_123", "messages": []interface{}{ map[string]string{ "role": "user", "content": "What is the weather today?", }, }, }, }) if err != nil { log.Fatal("Failed to start stream:", err) } // Process events decoder := events.NewEventDecoder() for { select { case frame := <-frames: event, err := decoder.Decode(frame.Data) if err != nil { log.Printf("Decode error: %v", err) continue } // Handle different event types switch e := event.(type) { case *events.TextMessageContentEvent: fmt.Print(e.Delta) case *events.RunFinishedEvent: fmt.Println("\nAgent finished processing") return } case err := <-errors: log.Printf("Stream error: %v", err) return } } } ``` -------------------------------- ### Start Dojo Application Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/quickstart/server.mdx In a separate terminal, install project dependencies using pnpm and then start the dojo development server. This command compiles the project and runs the dojo. ```bash # Install dependencies pnpm install # Compile the project and run the dojo pnpm dev ``` -------------------------------- ### Manual Development Setup Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/python/README.md Manually set up the development environment, including virtual environment and editable package installation. ```bash # Create virtual environment python -m venv venv source venv/bin/activate # Install this package in editable mode pip install -e . # For development (includes testing and linting tools) pip install -e ".[dev]" # OR pip install -r requirements-dev.txt ``` -------------------------------- ### Start Python Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/quickstart/server.mdx Navigate to the Python server directory and start the server using Poetry. This command installs dependencies and runs the development server. ```bash cd integrations/openai-server/server/python poetry install && poetry run dev ``` -------------------------------- ### Complete Go SSE Client Example Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/go/client/sse-client.mdx This example shows how to create an SSE client, manage context with timeout, start a stream with a payload, decode incoming events, and handle different event types including run status, text messages, tool calls, and errors. It also demonstrates graceful shutdown. ```go package main import ( "context" "fmt" "log" "time" "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/client/sse" "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/core/events" ) func main() { // Create SSE client client := sse.NewClient(sse.Config{ Endpoint: "https://api.example.com/agent", APIKey: "your-api-key", }) defer client.Close() // Create context with timeout ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() // Start streaming frames, errors, err := client.Stream(sse.StreamOptions{ Context: ctx, Payload: map[string]interface{}{ "threadId": events.NewThreadID(), "runId": events.NewRunID(), "messages": []map[string]interface{}{ { "role": "user", "content": "What's the weather like?", }, }, }, }) if err != nil { log.Fatalf("Failed to start stream: %v", err) } // Create event decoder decoder := events.NewEventDecoder() // Process stream for { select { case frame := <-frames: if frame.Data == nil { fmt.Println("Stream completed") return } event, err := decoder.Decode(frame.Data) if err != nil { log.Printf("Decode error: %v", err) continue } // Handle different event types switch e := event.(type) { case *events.RunStartedEvent: fmt.Printf("Run started: %s\n", e.RunID) case *events.TextMessageStartEvent: fmt.Printf("\nAssistant: ") case *events.TextMessageContentEvent: fmt.Print(e.Delta) case *events.TextMessageEndEvent: fmt.Println() case *events.ToolCallStartEvent: fmt.Printf("Tool call: %s\n", e.FunctionName) case *events.ToolCallResultEvent: fmt.Printf("Tool result: %v\n", e.Result) case *events.RunFinishedEvent: fmt.Printf("Run completed: %s\n", e.RunID) return case *events.RunErrorEvent: fmt.Printf("Run error: %v\n", e.Error) return } case err := <-errors: if err != nil { log.Printf("Stream error: %v", err) return } case <-ctx.Done(): fmt.Println("Context timeout") return } } } ``` -------------------------------- ### Install Dependencies with Poetry Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/aws-strands/python/examples/README.md Navigate to the example directory and install project dependencies using Poetry. Ensure you select a compatible Python interpreter if your default is 3.14 or higher. ```bash cd integrations/aws-strands/python/examples # pick a supported interpreter if your global default is 3.14 poetry env use python3.13 poetry install ``` -------------------------------- ### Quick Start: HttpAgent Setup and Event Subscription Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/java/overview.mdx Initialize an HttpAgent, subscribe to text message content events, and run the agent with initial parameters. Ensure you provide a concrete HTTP client implementation. ```java import com.agui.http.HttpAgent; import com.agui.http.BaseHttpClient; // choose an implementation, e.g., OkHttp import com.agui.core.agent.*; import com.agui.core.message.*; import com.agui.core.state.State; HttpAgent agent = HttpAgent.builder() .agentId("my-agent") .threadId("thread-123") .httpClient(myHttpClient) // e.g., new com.agui.okhttp.HttpClient("https://api.example.com/agent") .state(new State()) .build(); agent.subscribe(new AgentSubscriber() { @Override public void onTextMessageContentEvent(TextMessageContentEvent event) { System.out.print(event.getDelta()); } }); RunAgentParameters params = new RunAgentParameters(); params.setContext(List.of()); params.setTools(List.of()); agent.runAgent(params, null).join(); ``` -------------------------------- ### Run Full Project from Repo Root Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/agent-spec/python/examples/README.md Installs dependencies and starts the development server for the entire project from the repository root. ```bash cd ../../../ pnpm install pnpm dev ``` -------------------------------- ### Run Development Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/python/examples/README.md Use 'uv run dev' to start the development server for the ADK middleware examples. ```bash uv run dev ``` -------------------------------- ### Run Dojo and Integration Locally Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/CONTRIBUTING.md Execute preparation and run scripts for the Dojo and a specific framework. Ensure dependencies are installed and the agent server is started. ```bash ./scripts/prep-dojo-everything.js --only dojo,my-framework ./scripts/run-dojo-everything.js --only dojo,my-framework ``` -------------------------------- ### Tool Configuration and ADK Agent Setup Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/python/TOOLS.md Example of creating multiple tools (approval, calculator, weather) and configuring an ADK agent with AG-UI tool support. Includes setting tool and execution timeouts. ```python from ag_ui_adk import ADKAgent, AGUIToolset from google.adk.agents import LlmAgent from ag_ui.core import RunAgentInput, UserMessage, Tool # 1. Create tools for different purposes # Tool for human approval task_approval_tool = Tool( name="request_approval", description="Request human approval for task execution", parameters={ "type": "object", "properties": { "task": {"type": "string", "description": "Task requiring approval"}, "risk_level": {"type": "string", "enum": ["low", "medium", "high"]} }, "required": ["task"] } ) # Tool for calculations calculator_tool = Tool( name="calculate", description="Perform mathematical calculations", parameters={ "type": "object", "properties": { "expression": {"type": "string", "description": "Mathematical expression"} }, "required": ["expression"] } ) # Tool for API calls weather_tool = Tool( name="get_weather", description="Get current weather information", parameters={ "type": "object", "properties": { "location": {"type": "string", "description": "City name"} }, "required": ["location"] } ) # 2. Set up ADK agent with tool support agent = LlmAgent( name="assistant", model="gemini-3.5-flash", instruction="""You are a helpful assistant that can request approvals and perform calculations. Use request_approval for sensitive operations that need human review. Use calculate for math operations and get_weather for weather information.""" tools=[ AGUIToolset(), # Add the tools provided by the AG-UI client ] ) # 3. Create middleware adk_agent = ADKAgent( adk_agent=agent, user_id="user123", tool_timeout_seconds=60, # Timeout configuration execution_timeout_seconds=300 # Overall execution timeout ) # 4. Include tools in RunAgentInput user_input = RunAgentInput( thread_id="thread_123", run_id="run_456", messages=[UserMessage( id="1", role="user", content="Calculate 15 * 8 and then request approval for the result" )], tools=[task_approval_tool, calculator_tool, weather_tool], context=[], state={}, forwarded_props={} ) ``` -------------------------------- ### Run ADK Backend Server for Dojo App Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/typescript/README.md Start the ADK backend server compatible with the Dojo app by running the example server from the specified directory. ```bash cd examples uv sync uv run dev ``` -------------------------------- ### Install Pydantic AI Examples Package Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/pydantic-ai/typescript/README.md Install the necessary package for Pydantic AI examples using pip. Alternatively, use uv for virtual environment management. ```shell pip install pydantic-ai-examples ``` ```shell uv venv uv pip install pydantic-ai-examples ``` -------------------------------- ### Run Example Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/community/spring-ai/typescript/README.md Navigate to the example server directory and run the development server. ```bash cd integrations/llama-index/python/examples uv sync && uv run dev ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/aws-strands/typescript/README.md Install project dependencies and build the project for development. Includes commands for installing, building, and testing. ```bash pnpm install pnpm build pnpm test ``` -------------------------------- ### Run Example Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/mastra/typescript/README.md Navigate to the example directory and run the development server using pnpm. ```bash cd integrations/mastra/typescript/examples pnpm install pnpm run dev ``` -------------------------------- ### Install @ag-ui/proto Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/typescript/packages/proto/README.md Install the @ag-ui/proto package using npm, pnpm, or yarn. ```bash npm install @ag-ui/proto pnpm add @ag-ui/proto yarn add @ag-ui/proto ``` -------------------------------- ### Install @ag-ui/client Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/js/client/overview.mdx Install the @ag-ui/client package using npm. ```bash npm install @ag-ui/client ``` -------------------------------- ### Run Example FastAPI Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/typescript/README.md Set the GOOGLE_API_KEY environment variable, navigate to the examples directory, sync dependencies with uv, and run the development server with uv run dev. ```bash export GOOGLE_API_KEY= cd examples uv sync uv run dev ``` -------------------------------- ### C++ SDK Basic Agent Setup and Run Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/community/c++/tests/mock_server/README.md Demonstrates the basic setup of the HttpAgent, including URL, Agent ID, subscriber creation, and running an agent with a simple text scenario. Requires the agent/http_agent.h header. ```cpp #include "agent/http_agent.h" using namespace agui; int main() { // Create Agent auto agent = HttpAgent::builder() .withUrl("http://localhost:8080") .withAgentId(AgentId("test_agent")) .build(); // Create subscriber class MySubscriber : public IAgentSubscriber { AgentStateMutation onTextMessageContent( const TextMessageContentEvent& event) override { std::cout << event.delta; return AgentStateMutation(); } }; auto subscriber = std::make_shared(); agent->subscribe(subscriber); // Run Agent RunAgentParams params; params.input.message = "Hello"; params.input.scenario = "simple_text"; // Specify scenario agent->runAgent( params, [](const RunAgentResult& result) { std::cout << "\nSuccess!" << std::endl; }, [](const AgentError& error) { std::cerr << "Error: " << error.message << std::endl; } ); return 0; } ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/langroid/README.md Installs the necessary Python packages for the Langroid integration. Navigate to the python directory and then the examples subdirectory. ```bash cd python pip install -e . cd examples pip install -e . ``` -------------------------------- ### Start Dojo Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/claude-agent-sdk/python/README.md Instructions to start the Dojo application in a separate terminal, which is required for interacting with the Claude Agent SDK examples. ```bash cd apps/dojo pnpm dev ``` -------------------------------- ### Run Dojo Examples Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/crew-ai/python/README.md Instructions to set up and run the dojo examples for ag-ui-crewai. ```bash cd python/ag_ui_crewai poetry install poetry run dev ``` -------------------------------- ### Install and Run create-ag-ui-app Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/typescript/packages/cli/README.md Use npx, pnpx, or bunx to run the create-ag-ui-app installer. ```bash npx create-ag-ui-app@latest ``` ```bash pnpx create-ag-ui-app@latest ``` ```bash bunx create-ag-ui-app@latest ``` -------------------------------- ### Run Dojo Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/aws-strands/typescript/README.md Navigate to the examples directory and run the dojo server to access all demos on http://localhost:8022. ```bash cd integrations/aws-strands/typescript/examples pnpm dojo ``` -------------------------------- ### Install AG-UI Genkit Go Package Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/community/genkit/go/README.md Install the AG-UI Genkit Go integration package using go get. ```bash go get github.com/ag-ui-protocol/ag-ui/integrations/community/genkit/go/genkit ``` -------------------------------- ### Setup Development Environment Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/python/README.md Execute the setup script for ADK Middleware development. ```bash # From the adk-middleware directory chmod +x setup_dev.sh ./setup_dev.sh ``` -------------------------------- ### Quick API Key Setup Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/kotlin/client/agui-agent.mdx Use the convenience builder for quick API key setup. ```kotlin import com.agui.client.builders.* val agent = agentWithApiKey("https://api.example.com/agent", "your-api-key") ``` -------------------------------- ### Start Dojo Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/claude-agent-sdk/typescript/README.md Navigate to the Dojo apps directory and start the development server. ```bash # Start Dojo (in another terminal) cd apps/dojo pnpm dev ``` -------------------------------- ### Check Python Version Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/community/dart/example/README.md Ensure your Python installation is version 3.10 or higher, as required by the example server. ```bash # Check your Python version python --version ``` -------------------------------- ### Deploy AG-UI Server using AgentCore Starter Toolkit Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/aws-strands/typescript/README.md Use the AgentCore Starter Toolkit to configure and deploy your AG-UI server. This involves installing the toolkit, configuring your server file, and initiating the deployment process. ```bash pip install bedrock-agentcore-starter-toolkit agentcore configure -e my_agui_server.ts --protocol AGUI agentcore deploy ``` -------------------------------- ### Start the Development Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/quickstart/applications.mdx After setting up your application, run this command to start the development server. This allows you to see your application in action. ```sh npm run dev ``` -------------------------------- ### Start Mock Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/community/c++/tests/mock_server/README.md Execute the mock server script from the command line to start the server. This command initiates the mock server with default settings. ```bash python3 tests/mock_server/mock_ag_server.py ``` -------------------------------- ### Run LangGraph Python Examples with FastAPI Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/langgraph/python/examples/README.md Install dependencies using Poetry and run the FastAPI development server. ```bash cd integrations/langgraph/python/examples poetry install poetry run dev ``` -------------------------------- ### Basic AgUiAgent Setup with Authentication Options Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/kotlin/client/agui-agent.mdx Demonstrates basic setup of AgUiAgent with various authentication methods (bearer token, API key, basic auth) and optional system prompt/user ID. ```kotlin val agent = AgUiAgent( url = "https://api.example.com/agent" ) { // Authentication (choose one) bearerToken = "your-bearer-token" // OR apiKey = "your-api-key" // OR basicAuth("username", "password") // Optional system prompt systemPrompt = "You are a helpful assistant" // Optional user ID userId = "user-123" } ``` -------------------------------- ### TextMessageEndEvent Example Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/dotnet/abstractions/events.mdx Marks the end of an assistant's text message. Requires the message ID from the start event. ```csharp var evt = new TextMessageEndEvent { MessageId = "msg-1" }; ``` -------------------------------- ### Get Mock Server Help Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/community/c++/tests/mock_server/README.md Run the mock server script with the --help flag to display available command-line options and usage instructions. ```bash python3 tests/mock_server/mock_ag_server.py --help ``` -------------------------------- ### TextMessageContentEvent Example Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/dotnet/abstractions/events.mdx Represents a chunk of text content for an ongoing message. Requires the message ID from the start event. ```csharp var evt = new TextMessageContentEvent { MessageId = "msg-1", Delta = "Hello" }; ``` -------------------------------- ### Run AG-UI Client Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/quickstart/clients.mdx Execute this command in your terminal to start the AG-UI client. Ensure you have the necessary dependencies installed. ```bash pnpm dev ``` -------------------------------- ### TextMessageStartEvent Example Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/dotnet/abstractions/events.mdx Represents the start of an assistant's text message. Includes message ID, role, and optional name. ```csharp var evt = new TextMessageStartEvent { MessageId = "msg-1", Role = AGUIRoles.Assistant, Name = "assistant" }; ``` -------------------------------- ### Run Sample Server with .NET CLI Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/dotnet/AGENTS.md Execute a sample server application using the .NET CLI. Ensure you are in the project root directory. ```bash dotnet run --project samples/GettingStarted/Step01_GettingStarted/Step01_GettingStarted.Server/ ``` -------------------------------- ### Run Standalone Examples Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/aws-strands/typescript/README.md Run individual examples on their default port (8000) by executing their respective commands. ```bash pnpm agentic-chat pnpm agentic-chat-reasoning pnpm agentic-chat-multimodal pnpm backend-tool-rendering pnpm shared-state pnpm agentic-generative-ui pnpm human-in-the-loop ``` -------------------------------- ### Setup Python Server Dependencies Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/community/dart/example/README.md Install Python server dependencies using either Poetry or uv in a separate terminal. ```bash # Navigate to the Python server directory cd typescript-sdk/integrations/server-starter-all-features/server/python # Install dependencies with poetry poetry install # OR with uv (faster) ``` ```bash uv pip install -e . ``` -------------------------------- ### Predictive State Updates - Story Example Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/pydantic-ai/typescript/README.md Demonstrates the Predictive State Updates feature with a starting document text for a story about a dog named Bruce. ```markdown Bruce was a good dog, ``` -------------------------------- ### Install @ag-ui/client SDK Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/typescript/packages/client/README.md Install the client SDK using npm, pnpm, or yarn. ```bash npm install @ag-ui/client pnpm add @ag-ui/client yarn add @ag-ui/client ``` -------------------------------- ### Set Session Manager Log Level via Environment Variable Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/python/LOGGING.md Example of how to set the LOG_SESSION_MANAGER environment variable to DEBUG before running the quickstart script. ```bash LOG_SESSION_MANAGER=DEBUG ./quickstart.sh ``` -------------------------------- ### Dart Example Output - Initial Request Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/community/dart/example/README.md Observe the initial client messages when starting a tool-based generative UI flow, including thread and run IDs. ```text 📍 Starting Tool Based Generative UI flow 📍 Starting run with thread_id: thread_xxx, run_id: run_xxx 📍 User message: Create a haiku ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/aws-strands/python/examples/README.md Create a .env file in the example directory to set up model provider credentials and other configurations. This file is used by all examples to load settings automatically. ```bash # Choose your provider: openai (default), anthropic, or gemini MODEL_PROVIDER=openai # Provider API keys (only the one for your chosen provider is required) OPENAI_API_KEY=your-openai-key ANTHROPIC_API_KEY=your-anthropic-key GOOGLE_API_KEY=your-google-key # Optional overrides MODEL_ID= # Override default model for your provider PORT=8000 # FastAPI listen port ``` -------------------------------- ### Provision and Build SDK (Windows) Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/dotnet/AGENTS.md Use this command on Windows to provision a local .NET SDK and build the project. ```bash ./build.cmd ``` -------------------------------- ### Echo Agent Implementation Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/java/server/spring.mdx An example of a simple agent that extends `LocalAgent` and emits a sequence of events, including run start, text messages, and run finish. ```java public class EchoAgent extends LocalAgent { public EchoAgent() { super("echo", new State(), null, "You are echo."); } @Override protected void run(RunAgentInput input, AgentSubscriber sub) { var runId = input.getRunId(); emitEvent(EventFactory.runStartedEvent(input.getThreadId(), runId), sub); var messageId = UUID.randomUUID().toString(); emitEvent(EventFactory.textMessageStartEvent(messageId, "assistant"), sub); emitEvent(EventFactory.textMessageContentEvent(messageId, "Hello"), sub); emitEvent(EventFactory.textMessageEndEvent(messageId), sub); emitEvent(EventFactory.runFinishedEvent(input.getThreadId(), runId), sub); } } ``` -------------------------------- ### Subscribe to Agent Events Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/java/client/subscriber.mdx Subscribe to agent events by implementing the AgentSubscriber interface. This example shows how to handle the start of a run and receive text message content. ```java agent.subscribe(new AgentSubscriber() { @Override public void onRunStartedEvent(RunStartedEvent event) { System.out.println("Run started: " + event.getRunId()); } @Override public void onTextMessageContentEvent(TextMessageContentEvent event) { System.out.print(event.getDelta()); } }); ``` -------------------------------- ### Install Go SDK Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/go/overview.mdx Install the AG-UI Go SDK using Go's standard package management. ```bash go get github.com/ag-ui-protocol/ag-ui/sdks/community/go ``` -------------------------------- ### Dart Example Output - Tool Response Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/community/dart/example/README.md Observe the client messages after a tool response is sent, indicating a new run has started and the assistant's final response. ```text 📍 Sending tool response(s) to server with new run... 📨 RUN_STARTED 📨 MESSAGES_SNAPSHOT 🤖 Haiku created 📨 RUN_FINISHED ``` -------------------------------- ### Copy Environment Example Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/langgraph/typescript/examples/README.md Copies the example environment file to a new file for API key configuration. ```bash cp .env.example .env ``` -------------------------------- ### Run Server in Mock Mode Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/community/genkit/go/examples/README.md Starts the server in mock mode for testing the AG-UI protocol without requiring an API key. Navigate to the example directory first. ```bash cd integrations/community/genkit/go/examples go run ./cmd/server --mock-mode ``` -------------------------------- ### Quick Start: Initialize and Run A2AAgent Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/a2a/typescript/README.md Initialize an A2AAgent with an A2AClient and run it to get a result and new messages. You can inject your own A2AClient, override instructions, or force blocking mode. ```typescript import { A2AAgent } from "@ag-ui/a2a"; import { A2AClient } from "@a2a-js/sdk/client"; const client = new A2AClient("https://my-a2a-agent"); const agent = new A2AAgent({ a2aClient: client, initialMessages: [{ id: "user-1", role: "user", content: "Plan a team offsite" } as any], }); const { result, newMessages } = await agent.runAgent(); console.log(result); console.log(newMessages); ``` -------------------------------- ### Run Development Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/ag2/python/examples/README.md Starts the development server using uv. The server will listen on http://localhost:8018 by default. ```bash uv run dev ``` -------------------------------- ### Run the Demo Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/aws-strands/python/examples/README.md Start the FastAPI demo server using Poetry. This command exposes all mounted applications on http://localhost:8000 (or the port specified in .env). ```bash poetry run dev # uses the Poetry script entry point (server:main) # or poetry run python -m server ``` -------------------------------- ### Environment Variable Setup and Dart Run Command Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/community/dart/example/README.md Example of setting environment variables for AG-UI and running the Dart SDK command. Ensure the base URL and debug mode are configured as needed. ```bash export AG_UI_BASE_URL=http://localhost:8000 export DEBUG=true dart run -- -m "Hello" ``` -------------------------------- ### Start Mock Server Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/community/c++/README.md Starts the mock AG-UI server. Ensure this is running before executing integration tests. ```bash cd tests/mock_server python3 mock_ag_server.py --host 127.0.0.1 --port 8080 ``` -------------------------------- ### Install Browser Package Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/quickstart/clients.mdx Install the 'open' package to enable web browsing functionality. ```bash pnpm add open ``` -------------------------------- ### Troubleshooting: Python Server Won't Start Source: https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/community/dart/example/README.md Offers solutions for Python server startup failures, including import errors. Covers Python version checks, poetry installation, cache clearing, and dependency management. ```text Problem: Server fails to start or import errors Solutions: - Ensure Python version is 3.10+: `python --version` - Install poetry correctly: `curl -sSL https://install.python-poetry.org | python3 -` - Clear poetry cache: `poetry cache clear pypi --all` - Try uv instead: `uv pip install -e .` then `uv run dev` - Check for port conflicts: `lsof -i :8000` (macOS/Linux) - Install in a clean virtual environment ```