API Reference¶
Auto-generated from Google-style docstrings. For HTTP endpoints, see LIME platform documentation.
LimeAgent¶
lime_agents.LimeAgent ¶
Async client for LIME agent workers.
Wraps site-login approve (PoW + X-Agent-Token) and MCP OAuth client calls to
external resource servers. MCP JWTs are issued and cached automatically on
list_tools / call_tool — use get_mcp_access_token() only when you need
the raw JWT string.
See LIME platform docs <https://lime.pics/docs#guide-agentSdk>_ for HTTP details.
__init__ ¶
__init__(*, agent_token=None, base_url=None, timeout=30.0, max_retries=3, pow_timeout=10.0, mcp_token_refresh_skew=30.0, mcp_read_timeout=300.0, serialize_mcp_per_url=True, http_client=None)
Create an agent client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_token
|
str | None
|
Opaque agent secret (default from |
None
|
base_url
|
str | None
|
API root including |
None
|
timeout
|
float
|
HTTP timeout seconds for LIME platform calls. |
30.0
|
max_retries
|
int
|
Retries on transient 408/429/5xx responses. |
3
|
pow_timeout
|
float
|
Max seconds to solve PoW before |
10.0
|
mcp_token_refresh_skew
|
float
|
Refresh MCP JWT this many seconds before expiry. |
30.0
|
mcp_read_timeout
|
float
|
MCP streamable HTTP read timeout seconds. |
300.0
|
serialize_mcp_per_url
|
bool
|
Serialize MCP calls per server URL when True. |
True
|
http_client
|
AsyncClient | None
|
Injectable |
None
|
Raises:
| Type | Description |
|---|---|
AuthenticationError
|
When no agent token is configured. |
login
async
¶
login(request_id)
Complete site-login approve for one request_id.
Fetches PoW challenge, solves it, and posts approve with X-Agent-Token.
The site backend receives the passport JWT separately via SSE.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request_id
|
str
|
Login request id from the site backend ( |
required |
Returns:
| Type | Description |
|---|---|
ApprovalResult
|
|
Raises:
| Type | Description |
|---|---|
ApiError
|
Invalid request id or approve rejected by API. |
PowTimeoutError
|
PoW not solved within |
get_mcp_access_token
async
¶
get_mcp_access_token(*, force_refresh=False)
Return a cached MCP OAuth JWT (optional — MCP facade methods auto-issue).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force_refresh
|
bool
|
When True, bypass cache and request a new token. |
False
|
Returns:
| Type | Description |
|---|---|
McpAccessToken
|
|
Note
Prefer list_tools / call_tool for normal MCP usage. This method is
for integrators who need the raw JWT (custom HTTP clients, debugging).
list_tools
async
¶
list_tools(server_url)
List tools on an external MCP resource server.
OAuth JWT is fetched and attached automatically on first call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_url
|
str
|
Full streamable HTTP MCP endpoint (e.g. |
required |
Returns:
| Type | Description |
|---|---|
list[Tool]
|
List of |
call_tool
async
¶
call_tool(server_url, name, arguments=None)
Invoke a tool on an external MCP resource server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_url
|
str
|
Full streamable HTTP MCP endpoint. |
required |
name
|
str
|
Tool name from |
required |
arguments
|
dict[str, Any] | None
|
JSON-serializable tool arguments. |
None
|
Returns:
| Type | Description |
|---|---|
CallToolResult
|
|
read_resource
async
¶
read_resource(server_url, uri)
Read a resource URI from an external MCP server.
get_prompt
async
¶
get_prompt(server_url, name, arguments=None)
Fetch a prompt template from an external MCP server.
mcp_session
async
¶
mcp_session(server_url)
Hold an MCP session lock for advanced low-level calls on one server URL.
Result types¶
Authenticated agent profile from Core API.
from_api
classmethod
¶
from_api(data)
Parse profile JSON; accepts wire user_id / user_kyc_level aliases.