qbraid_core.services.agents.AgentSessionRegistryManager
- class qbraid_core.services.agents.AgentSessionRegistryManager(registry_path=None)
Manages the local agent session registry at ~/.qbraid/sessions.json.
Provides CRUD operations with file locking for cross-process safety.
- __init__(registry_path=None)
Methods
__init__([registry_path])assign_team(session_id, *[, team_id, ...])Place a running session in a team, with a role and a parent.
batch_update(*[, skip_unchanged, lock_timeout])Context manager for batch registry modifications.
begin_stop(session_id, at)Record that a deliberate stop of this session is starting.
calling_session()The registered, live agent session this process runs inside, if any.
deregister_session([session_id, pid, tool, ...])Mark a session as stopped.
end_stop(session_id, *, stopped[, at, survivors])Finish a deliberate stop begun with
begin_stop().find_by_pid(pid)Find an active session by PID.
find_by_prefix(prefix)Find the first session whose session_id starts with the given prefix.
find_by_tool(tool)Find all active sessions for a given tool.
get_active_sessions()Return all sessions that are not stopped or errored.
get_session(session_id)Get a session by ID.
load_registry()Load the registry from disk.
mark_stopped(session_id, *, at, interrupted)Stop a session that is still live, in one locked update.
merge_discovered_sessions(discovered)Merge discovered sessions into the registry.
prune_dead_sessions()Check all active sessions for dead PIDs and mark them stopped.
refresh_discovered_sessions([threshold_s, ...])Retire transcript-only rows without inferring runtime from file age.
register_from_hook_payload(data)Register an agent session from a hook payload dict.
register_session(session, *[, ...])Add or update a session in the registry.
relink_resumed(old_session_id, new_session_id)Carry an old session's parent and children over to its resumption.
resolve_session(identifier)Resolve a full id, unique id prefix, or session name to one session.
save_registry()Write the registry to disk atomically.
search_sessions(*[, tool, status, tags, ...])Search sessions with flexible filter criteria.
session_lifecycle_view(session)Classify an exact record like enumeration, without changing its identity or disk.
update_session(session_id, **updates)Update fields on an existing session.
write_server_info(port, pid[, token])Write ~/.qbraid/server.json with connection info.
Attributes
registry_pathPath to the registry file.