mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-09-16 14:57:15 +00:00
feat(processors): streamline event debugging and run inspection
This commit is contained in:
@@ -776,6 +776,9 @@ class RunLedgerStore:
|
||||
'dispatch_attempts': row.dispatch_attempts,
|
||||
'last_claimed_at': _datetime_to_epoch(row.last_claimed_at),
|
||||
'created_at': _datetime_to_epoch(row.created_at),
|
||||
'created_at_ms': round(_as_utc(row.created_at).timestamp() * 1000) if row.created_at else None,
|
||||
'started_at_ms': round(_as_utc(row.started_at).timestamp() * 1000) if row.started_at else None,
|
||||
'finished_at_ms': round(_as_utc(row.finished_at).timestamp() * 1000) if row.finished_at else None,
|
||||
'started_at': _datetime_to_epoch(row.started_at),
|
||||
'finished_at': _datetime_to_epoch(row.finished_at),
|
||||
'updated_at': _datetime_to_epoch(row.updated_at),
|
||||
|
||||
@@ -488,6 +488,9 @@ class AgentService:
|
||||
if not isinstance(config, dict):
|
||||
raise ValueError('Processor configuration must be an object')
|
||||
component_ref = data.get('component_ref') or (existing.component_ref if existing is not None else None)
|
||||
if component_ref is None and not config and not data.get('parameters'):
|
||||
# An unconfigured instance cannot subscribe to or execute any events.
|
||||
return {}, None, []
|
||||
if not isinstance(component_ref, str) or not component_ref.startswith('event_processor:'):
|
||||
raise ValueError('Select an installed EventProcessor component')
|
||||
try:
|
||||
|
||||
@@ -188,8 +188,9 @@ class LangBotMCPServer:
|
||||
@mcp.tool(
|
||||
description=(
|
||||
'Create an Agent, Pipeline or Event processor. Set `processor_data.kind` to '
|
||||
'`agent`, `pipeline` or `event_processor`. Event processors require an installed component_ref '
|
||||
'from get_processor_metadata; optional parameters configure the instance. Returns UUID and kind.'
|
||||
'`agent`, `pipeline` or `event_processor`. Event processors may be created without a component; '
|
||||
'then use update_processor with an installed component_ref from get_processor_metadata and optional '
|
||||
'parameters. Unconfigured instances support no events. Returns UUID and kind.'
|
||||
)
|
||||
)
|
||||
async def create_processor(processor_data: dict) -> str:
|
||||
@@ -213,7 +214,10 @@ class LangBotMCPServer:
|
||||
context = _authorized(Permission.RESOURCE_VIEW)
|
||||
return _dump(await ap.agent_service.get_agent_metadata(context))
|
||||
|
||||
@mcp.tool(description='List one Event processor instance run history; use before_id to page older runs.')
|
||||
@mcp.tool(
|
||||
description='List one Event processor instance run history; use before_id to page older runs. '
|
||||
'created_at_ms, started_at_ms and finished_at_ms are Host lifecycle times in epoch milliseconds.'
|
||||
)
|
||||
async def list_processor_runs(processor_uuid: str, before_id: int | None = None) -> str:
|
||||
context = _authorized(Permission.RESOURCE_VIEW)
|
||||
return _dump(await ap.agent_service.get_processor_runs(context, processor_uuid, before_id=before_id))
|
||||
|
||||
Reference in New Issue
Block a user