This example demonstrates how to use Toon Agent Bridge with a simple OpenAPI 3.0 schema.
cd examples/basic-openapi
pnpm install
pnpm start
The server will start on http://localhost:3000.
Once the server is running, you can access:
GET /users - Get all usersPOST /users - Create a new userGET /users/{id} - Get user by IDGET /events - SSE event streamGET /ws - WebSocket connectionGET /health - Health checkGET /schema - Schema information# Get all users
curl http://localhost:3000/users
# Create a user
curl -X POST http://localhost:3000/users \
-H "Content-Type: application/json" \
-d '{"name": "John Doe", "email": "john@example.com"}'
# Get user by ID
curl http://localhost:3000/users/1
Open http://localhost:3000/events in your browser or use curl:
curl http://localhost:3000/events
You’ll see events streamed in real-time as you make API calls.
You can use the React components from @programsmagic/toon-frontend to visualize the agent events:
import { AgentVisualizer } from '@programsmagic/toon-frontend';
import '@programsmagic/toon-frontend/styles';
function App() {
return (
<AgentVisualizer
url="http://localhost:3000/events"
protocol="sse"
autoConnect={true}
/>
);
}
openapi.json file to add more endpoints