trading_agent.requests.permission_response
¶
The user's decision on a held tool call: allow it once, always allow it, or deny it.
Typical usage example:
response = PermissionResponse(request, 'deny', 'Not today') response.check() text = response.message(None)
PermissionResponse
¶
Allow once, always allow, or deny, with the user's reason for a denial.
Creates the response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
UserRequest
|
The permission request. |
required |
decision
|
str
|
"allow_once", "always_allow" or "deny". |
required |
reason
|
str
|
Why it was denied, or what the desk should do instead; may be empty. |
required |
Source code in src/trading_agent/requests/permission_response.py
check
¶
Checks the decision.
Raises:
| Type | Description |
|---|---|
ValueError
|
The decision is not one of DECISIONS. |
Source code in src/trading_agent/requests/permission_response.py
stored
¶
The response as saved with the request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
ToolResult | None
|
What the call returned when it was run, or None. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The decision, the reason and the call's result. |
Source code in src/trading_agent/requests/permission_response.py
message
¶
The message the desk receives.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
ToolResult | None
|
What the call returned when it was run, or None when it was denied. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The decision and, when the call was run, its result. |