xml-pipeline/xml_pipeline/server/__init__.py
dullfig bf31b0d14e Add AgentServer REST/WebSocket API
Implements the AgentServer API from docs/agentserver_api_spec.md:

REST API (/api/v1):
- Organism info and config endpoints
- Agent listing, details, config, schema
- Thread and message history with filtering
- Control endpoints (inject, pause, resume, kill, stop)

WebSocket:
- /ws: Main control channel with state snapshot + real-time events
- /ws/messages: Dedicated message stream with filtering

Infrastructure:
- Pydantic models with camelCase serialization
- ServerState bridges StreamPump to API
- Pump event hooks for real-time updates
- CLI 'serve' command: xml-pipeline serve [config] --port 8080

35 new tests for models, state, REST, and WebSocket.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 20:22:58 -08:00

26 lines
624 B
Python

"""
server — FastAPI-based AgentServer API for monitoring and controlling organisms.
Provides:
- REST API for querying organism state (agents, threads, messages)
- WebSocket for real-time events
- Message injection endpoint
Usage:
from xml_pipeline.server import create_app, run_server
# With existing pump
app = create_app(pump)
uvicorn.run(app, host="0.0.0.0", port=8080)
# Or use CLI
xml-pipeline serve config/organism.yaml --port 8080
"""
from xml_pipeline.server.app import create_app, run_server, run_server_sync
__all__ = [
"create_app",
"run_server",
"run_server_sync",
]