piqrypt_search_events
Search agent cryptographic event history by type, time range, or session to reconstruct actions with signed events and chain metadata.
Instructions
Search the agent's cryptographic event history by type, time range, or session. Returns signed events with chain metadata. Use to reconstruct what an agent did during a specific period.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| event_type | No | Filter by event type (e.g., "trade_executed", "decision_made") | |
| from_timestamp | No | Start timestamp (Unix UTC seconds) | |
| to_timestamp | No | End timestamp (Unix UTC seconds) | |
| limit | No | Maximum number of results |
Implementation Reference
- src/python/bridge.py:175-198 (handler)The actual handler function 'search_events' that executes the search by calling aiss.search_events() with the agent_id/participant, event_type, from_timestamp, to_timestamp, and limit parameters.
def search_events(params: Dict[str, Any]) -> Dict[str, Any]: """ Search events using AISS index. Args: params: dict with optional agent_name (or agent_id), event_type, from_timestamp, to_timestamp, limit Returns: dict with events list, count, vigil_url """ participant = params.get("agent_name", params.get("agent_id")) results = aiss.search_events( participant=participant, event_type=params.get("event_type"), after=params.get("from_timestamp"), before=params.get("to_timestamp"), limit=params.get("limit", 50), ) return { "events": results, "count": len(results), "vigil_url": VIGIL_URL, } - src/index.ts:217-224 (handler)The TypeScript handler in the switch/case that routes 'piqrypt_search_events' to callPythonBridge('search', ...) with params extracted from args.
case 'piqrypt_search_events': result = callPythonBridge('search', { event_type: args.event_type, from_timestamp: args.from_timestamp, to_timestamp: args.to_timestamp, limit: args.limit || 100, }); break; - src/index.ts:131-156 (registration)Tool registration: defines the tool name 'piqrypt_search_events', description, and input schema with event_type, from_timestamp, to_timestamp, and limit properties.
{ name: 'piqrypt_search_events', description: 'Search the agent\'s cryptographic event history by type, time range, or session. Returns signed events with chain metadata. Use to reconstruct what an agent did during a specific period.', inputSchema: { type: 'object', properties: { event_type: { type: 'string', description: 'Filter by event type (e.g., "trade_executed", "decision_made")', }, from_timestamp: { type: 'number', description: 'Start timestamp (Unix UTC seconds)', }, to_timestamp: { type: 'number', description: 'End timestamp (Unix UTC seconds)', }, limit: { type: 'number', description: 'Maximum number of results', default: 100, }, }, }, }, - src/index.ts:131-156 (schema)Input schema for piqrypt_search_events: defines event_type (string), from_timestamp (number), to_timestamp (number), and limit (number, default 100) as optional filter parameters.
{ name: 'piqrypt_search_events', description: 'Search the agent\'s cryptographic event history by type, time range, or session. Returns signed events with chain metadata. Use to reconstruct what an agent did during a specific period.', inputSchema: { type: 'object', properties: { event_type: { type: 'string', description: 'Filter by event type (e.g., "trade_executed", "decision_made")', }, from_timestamp: { type: 'number', description: 'Start timestamp (Unix UTC seconds)', }, to_timestamp: { type: 'number', description: 'End timestamp (Unix UTC seconds)', }, limit: { type: 'number', description: 'Maximum number of results', default: 100, }, }, }, }, - src/index.ts:46-63 (helper)Helper function 'callPythonBridge' that spawns a Python subprocess to execute the bridge commands (including 'search') with params passed as JSON.
function callPythonBridge(command: string, params: any): any { const pythonCmd = process.env.PIQRYPT_PYTHON || (process.platform === 'win32' ? 'python' : 'python3'); const result = spawnSync( pythonCmd, [PYTHON_BRIDGE, command, JSON.stringify(params)], { encoding: 'utf-8', timeout: 30000 } ); if (result.error) throw new Error(`PiQrypt bridge spawn error: ${result.error.message}`); if (result.status !== 0) throw new Error(`PiQrypt bridge error: ${result.stderr}`); const stdout = result.stdout; const jsonStart = stdout.indexOf('{'); if (jsonStart === -1) throw new Error(`No JSON in bridge output: ${stdout}`); return JSON.parse(stdout.slice(jsonStart)); }