self_review
robotsix_llmio.clients.self_review
Direct-HTTP self-review client and pydantic-ai tool adapter.
Provides SelfReviewClient (async REST client for a self-review /
recent-activity API) and build_recent_activity_tools(client,
conversation_store) which wraps it into pydantic-ai-compatible async
tool functions.
Imports are deferred via :pep:562 __getattr__ so that importing the
self_review package does not eagerly pull in pydantic-ai until a name is
accessed.
SelfReviewClientError
Bases: RobotsixLLMIOError
Error from the self-review client (HTTP, auth, malformed response).
SelfReviewClient
Bases: BaseHttpClient
Async HTTP client for a self-review / recent-activity REST API.
Connects directly to the self-review HTTP API — no agent-comm
broker intermediary. Creates a fresh, timeout-bounded
httpx2.AsyncClient per request (stateless per-call pattern).
Parameters
base_url:
Root URL of the self-review API (e.g. http://self-review:8000/api/v1).
api_key:
Optional bearer token sent as Authorization: Bearer <api_key>.
list_activity
async
list_activity(limit=10)
List recent agent activities.
Parameters
limit: Maximum number of activity entries to return (default 10).
Returns
list[dict]
A list of activity dicts, each with keys id, agent,
action, summary, and timestamp. An empty list
means no recent activity.
get_activity
async
get_activity(activity_id)
Retrieve a single activity entry by its identifier.
Parameters
activity_id: The activity identifier.
Returns
dict
The activity with keys id, agent, action,
summary, timestamp, and detail.
Raises
SelfReviewClientError If the activity is not found (HTTP 404) or the request fails.
build_recent_activity_tools
build_recent_activity_tools(
client, conversation_store=None
)
Build pydantic-ai-compatible async tool functions from a
:class:SelfReviewClient.
Returns two async tool functions:
list_recent_activity(limit: int = 10) -> str— list recent agent activities, returns formatted results.get_recent_activity_detail(activity_id: str) -> str— retrieve a single activity by ID, returns the activity detail.
Each tool handles its own errors and returns a plain-text message so the agent can interpret the result directly.
Parameters
client:
The SelfReviewClient to wrap.
conversation_store:
Reserved for future use (e.g. cross-referencing activity against
conversation history). Currently accepted but unused.