FastAPI server for Eventuali event sourcing system with real-time streaming
Project description
Eventuali API Server
A FastAPI-based REST and Server-Sent Events (SSE) API server for the Eventuali event sourcing system.
Features
- Event Management: Emit and query events across agent, workflow, and system aggregates
- Real-time Streaming: Server-Sent Events (SSE) for live event monitoring
- RESTful API: Complete REST API with OpenAPI documentation
- Health Monitoring: Built-in health checks for API and database
- CORS Support: Configurable cross-origin resource sharing
- CLI Interface: Simple command-line interface for server management
Installation
pip install eventuali-api-server
Quick Start
Start the server with defaults:
eventuali-api-server
The server will start on http://127.0.0.1:8765 with Swagger UI available at /docs.
Start with custom configuration:
eventuali-api-server --host 0.0.0.0 --port 9000 --reload
Environment Variables
All CLI options can also be set via environment variables:
export HOST=0.0.0.0
export PORT=9000
export RELOAD=true
export LOG_LEVEL=debug
export DATA_DIR=/path/to/events
export CORS_ORIGINS="http://localhost:3000,https://app.example.com"
eventuali-api-server
API Endpoints
Events
POST /events/emit/agent- Emit agent lifecycle eventsPOST /events/emit/workflow- Emit workflow lifecycle eventsPOST /events/emit/system- Emit system lifecycle eventsGET /events/- Query events with pagination and filtersGET /events/agents/{agent_id}- Get events for specific agentGET /events/workflows/{workflow_id}- Get events for specific workflowGET /events/workflows/{workflow_id}/agents- Get agents in workflowGET /events/stream- Real-time event stream via SSE
Health
GET /health/- Overall health checkGET /health/database- Database connection health
Documentation
GET /docs- Swagger UI documentationGET /openapi.json- OpenAPI schema
Event Types
Agent Events
{
"name": "agent.started",
"attributes": {
"agent_name": "url-cacher",
"message": "Agent started successfully"
},
"aggregate_id": "url-cacher-abc123",
"correlation_id": "workflow-def456",
"causation_id": "parent-agent-789"
}
Workflow Events
{
"name": "workflow.started",
"attributes": {
"user_prompt": "Cache the documentation page"
},
"aggregate_id": "workflow-def456"
}
System Events
{
"name": "session.started",
"attributes": {
"session_type": "interactive"
},
"aggregate_id": "session-ghi789"
}
Configuration
The server can be configured via CLI options, environment variables, or programmatically:
from eventuali_api_server import APIServerConfig, set_config
config = APIServerConfig(
host="0.0.0.0",
port=8765,
data_dir="/custom/events/path",
cors_origins=["https://myapp.com"],
log_level="debug"
)
set_config(config)
Development
Install for development:
git clone <repository>
cd eventuali-api-server
pip install -e ".[dev]"
Run tests:
pytest
Code quality:
black src/ tests/
flake8 src/ tests/
mypy src/
Integration
The API server integrates with:
- Eventuali Event Store: SQLite-based event storage
- eventuali-mcp-server: MCP server for Claude Code integration
- @eventuali/dashboard: React-based UI dashboard
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file eventuali_api_server-0.2.2.tar.gz.
File metadata
- Download URL: eventuali_api_server-0.2.2.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8aba397b1899c7c8ac47db79d0b736bd9554038ea2ee02ca9c0fa5b601bf2a84
|
|
| MD5 |
df1c385122d92ff8cf851e25b4ae9e6f
|
|
| BLAKE2b-256 |
81819fb277ebe8b59d417cf96839e050289d75ec4af5e1ad533215dcc0cffe07
|
Provenance
The following attestation bundles were made for eventuali_api_server-0.2.2.tar.gz:
Publisher:
publish.yml on primevalai/onyx-octopus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eventuali_api_server-0.2.2.tar.gz -
Subject digest:
8aba397b1899c7c8ac47db79d0b736bd9554038ea2ee02ca9c0fa5b601bf2a84 - Sigstore transparency entry: 431179535
- Sigstore integration time:
-
Permalink:
primevalai/onyx-octopus@b895e90477d6768a1815ce41d2a38b4290cdf0a0 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/primevalai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b895e90477d6768a1815ce41d2a38b4290cdf0a0 -
Trigger Event:
release
-
Statement type: