Api reference
components.ai_tooling.public.actions ¶
review_response ¶
Actions for submitting AI review responses.
submit_review_response ¶
Submit a review response for an AI conversation.
Finds the latest form version for the agent_type/review_type combination and stores the reviewer's answers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_id
|
UUID
|
The conversation or response ID being reviewed. |
required |
reviewer_id
|
str
|
"Local" user id of the Alaner submitting the review (we then get the global id). |
required |
answers
|
dict[str, Any]
|
Mapping of question_key to answer_value. |
required |
agent_type
|
str
|
The type of AI agent being reviewed. |
required |
review_type
|
ReviewType
|
The type of review workflow. |
required |
Returns:
| Type | Description |
|---|---|
ReviewResponseResult
|
A ReviewResponseResult with the created response data. |
Raises:
| Type | Description |
|---|---|
missing_resource
|
If no form exists for the agent_type/review_type. |
Source code in components/ai_tooling/public/actions/review_response.py
components.ai_tooling.public.agent_config_resolver ¶
Resolve the (env, branch, version) triple for Marmot agent prompt configs.
Originally specific to the AR store; now accepts any S3ConfigStore via the
optional store= parameter, so other agents can resolve their own branch/version
against dedicated stores (see ai_tooling_service.AiToolingService).
get_current_user_branch ¶
Return the developer's IAM user on dev, else main.
Source code in components/ai_tooling/public/agent_config_resolver.py
get_latest_version_from_s3 ¶
Return the latest version folder for (env, branch) from S3 commit history.
Source code in components/ai_tooling/public/agent_config_resolver.py
get_nonnull_env_branch_version ¶
Resolve (env, branch, version) from potentially-null inputs.
Defaults: env from runtime, branch from current IAM user (dev) / main,
version from latest S3 commit. On dev, falls back to main if the user's
branch has no commit history yet.
If store is None, defaults to the AR FR-scoped store (legacy behavior).
Source code in components/ai_tooling/public/agent_config_resolver.py
components.ai_tooling.public.agent_config_stores ¶
ar_config_store
module-attribute
¶
ar_config_store = S3ConfigStore(
prefix="automated-resolution",
sections=[agents, llm_prompt_templates, redirections],
)
harry_config_store
module-attribute
¶
legal_complaint_config_store
module-attribute
¶
legal_complaint_config_store = S3ConfigStore(
prefix="legal-complaint",
sections=[agents, llm_prompt_templates],
)
components.ai_tooling.public.ai_agent_config_tool ¶
AIAgentConfigTool ¶
AIAgentConfigTool(
config_store,
view_permissions,
edit_permissions,
enrichers=(),
review_notifications_slack_channel=None,
read_only=False,
)
Configurable agent configuration tool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_store
|
ConfigStore
|
Config store (pure data access). |
required |
enrichers
|
Sequence[ConfigEnricher]
|
Transforms applied in order to fetched configs before they're
returned. The store fetches raw data; each consumer declares its own
enrichment at the composition root (e.g. |
()
|
view_permissions
|
set[EmployeePermission]
|
Employee permissions required for read endpoints. |
required |
edit_permissions
|
set[EmployeePermission]
|
Employee permissions required for write endpoints. |
required |
review_notifications_slack_channel
|
str | None
|
Slack channel for review notifications. |
None
|
read_only
|
bool
|
When True, only register read endpoints (the write endpoints are skipped). |
False
|
Source code in components/ai_tooling/public/ai_agent_config_tool.py
get_llm_prompt_template ¶
get_llm_prompt_template(
prompt_name,
config_branch=None,
config_version=None,
config_env=None,
app_name=None,
)
Return the raw prompt template dict.
Source code in components/ai_tooling/public/ai_agent_config_tool.py
get_member_attribute_names ¶
get_member_attribute_names(
agent_name,
config_branch=None,
config_version=None,
config_env=None,
app_name=None,
)
Return the member-attribute names configured for an agent.
Source code in components/ai_tooling/public/ai_agent_config_tool.py
register_smorest_routes ¶
Register agent config tool routes on a flask-smorest blueprint.
Endpoints (write endpoints are skipped when read_only):
GET {prefix}/agent_config/all
GET {prefix}/agent_config/branches
GET {prefix}/agent_config/commit_history
POST {prefix}/agent_config/save (write)
POST {prefix}/agent_config/copy (write)
POST {prefix}/agent_config/rollback (write)
POST {prefix}/agent_config/delete_branch (write)
POST {prefix}/agent_config/request_review (write)
GET {prefix}/agent_config/review_state
POST {prefix}/agent_config/approve_review (write)
GET {prefix}/agent_config/agents
GET {prefix}/agent_config/agent
GET {prefix}/agent_config/tools
Source code in components/ai_tooling/public/ai_agent_config_tool.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | |
standard_sections_enricher ¶
Enricher expanding agents/member_attributes/redirections (S3-backed stores).
Source code in components/ai_tooling/public/ai_agent_config_tool.py
components.ai_tooling.public.ai_debug_tool ¶
AIDebugTool ¶
AIDebugTool(
get_doctorai_conversation_id,
get_conversation_parts,
get_context_sections,
get_conversation_overview_config,
paginate_conversations,
)
Configurable AI debug tool for conversations created using the DoctorAI service.
Provides a reusable framework for debugging AI conversations with a three-column layout: context panel, conversation view, and trace view. The trace is automatically pulled from DoctorAI's API.
Usage
debug_tool = AIDebugTool( get_doctorai_conversation_id=lambda entity_id: entity_id, get_conversation_elements=my_conversation_fn, get_context_sections=my_context_fn, ) debug_tool.register_smorest_routes(my_blueprint)
Initialize the AI debug tool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
get_doctorai_conversation_id
|
Callable[[UUID], str | None]
|
Function to get DoctorAI conversation ID from entity ID. |
required |
get_conversation_parts
|
Callable[[UUID], ConversationPanel]
|
Function to get conversation elements for display. |
required |
get_context_sections
|
Callable[[UUID], list[BaseContextSection]]
|
Function to get context panel sections. |
required |
get_conversation_overview_config
|
Callable[[], ConversationOverviewConfig]
|
Function returning overview config (columns + card preview). |
required |
paginate_conversations
|
Callable[[int, int, dict[str, str]], ConversationsOverviewResponse]
|
Function returning paginated, filtered conversations. |
required |
Source code in components/ai_tooling/public/ai_debug_tool.py
register_smorest_routes ¶
Register debug tool routes on a flask-smorest blueprint.
Creates endpoints: - GET {prefix}/debug/{entity_id}/conversation - GET {prefix}/debug/{entity_id}/context - GET {prefix}/debug/{entity_id}/trace - GET {prefix}/debug/config - GET {prefix}/debug/conversations
Source code in components/ai_tooling/public/ai_debug_tool.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
DebugConversationsGetQuerySchema ¶
Bases: Schema
Query parameters for the paginated conversations list endpoint.
components.ai_tooling.public.ai_review_tool ¶
AIReviewTool ¶
AIReviewTool(
agent_type,
review_type,
get_conversation_parts,
get_context_sections,
get_review_form,
get_reviewable_conversations,
get_reviewable_conversations_config,
assign_conversation,
get_and_assign_next_conversation,
on_submit_review=None,
required_permission=EmployeePermission.view_marmot_information,
persist_review_response=True,
)
Configurable AI review tool for conversations created using the DoctorAI service.
Provides a reusable framework for reviewing AI conversations with a three-column layout: context panel, conversation view, and review form.
Usage
review_tool = AIReviewTool( get_conversation_parts=my_conversation_parts_fn, get_context_sections=my_context_fn, get_review_form=my_review_form_fn, get_reviewable_conversations=my_paginated_conversations_fn, on_submit_review=my_additional_submit_fn, # optional get_reviewable_conversations_config=my_config_fn, assign_conversation=my_assign_fn, ) review_tool.register_smorest_routes(my_controller)
Initialize the AI review tool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_type
|
AgentType
|
The type of AI agent being reviewed. |
required |
review_type
|
ReviewType
|
The type of review workflow. |
required |
get_conversation_parts
|
Callable[[UUID], ConversationPanel]
|
Function to get conversation elements for display. |
required |
get_context_sections
|
Callable[[UUID], list[BaseContextSection]]
|
Function to get context panel sections. |
required |
get_review_form
|
Callable[[UUID], ReviewForm]
|
Function to get the review form configuration. |
required |
on_submit_review
|
SubmitReviewCallable | None
|
Optional callback for additional submit logic. Called after the base submit_review_response. Receives (entity_id, reviewer_id, answers). |
None
|
get_reviewable_conversations
|
Callable[[int, int, dict[str, str], int | None], ConversationsOverviewResponse]
|
Function returning paginated, filtered conversations for review. Accepts (page, per_page, filters, user_id). |
required |
get_reviewable_conversations_config
|
Callable[[], ConversationOverviewConfig]
|
Function returning column configuration. |
required |
assign_conversation
|
Callable[[UUID, int], AssignConversationResult]
|
Function to assign a conversation to a reviewer (entity_id, user_id). |
required |
get_and_assign_next_conversation
|
Callable[[dict[str, str], int], UUID | None]
|
Function to get and assign next unreviewed conversation. Accepts (filters, user_id) and returns entity_id or None if no more. |
required |
required_permission
|
EmployeePermission
|
Permission required to access the review tool endpoints. |
view_marmot_information
|
persist_review_response
|
bool
|
Whether to store a generic AIReviewResponse row on submit. Defaults to True. Set False for tools whose on_submit_review already produces the durable record (e.g. annotation, which writes an eval TestCase). |
True
|
Source code in components/ai_tooling/public/ai_review_tool.py
register_smorest_routes ¶
Register review tool routes on a flask-smorest blueprint.
Creates endpoints: - GET {prefix}/review/{entity_id}/conversation - GET {prefix}/review/{entity_id}/context - GET {prefix}/review/{entity_id}/form - POST {prefix}/review/{entity_id}/submit - POST {prefix}/review/{entity_id}/assign - POST {prefix}/review/{entity_id}/submit-and-next - GET {prefix}/review/config - GET {prefix}/review/conversations
Source code in components/ai_tooling/public/ai_review_tool.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
AssignConversationResult
dataclass
¶
AssignmentStatus ¶
Bases: Enum
Status of a conversation assignment attempt.
ReviewConversationsGetQuerySchema ¶
Bases: Schema
Query parameters for the paginated conversations list endpoint.
SubmitAndNextPostJsonSchema ¶
SubmitAndNextResult
dataclass
¶
SubmitReviewCallable
module-attribute
¶
SubmitReviewPostJsonSchema ¶
Bases: Schema
JSON body for submitting a review response.
components.ai_tooling.public.ai_tooling_app_group ¶
components.ai_tooling.public.ai_tooling_service ¶
Service encapsulating dedicated-store prompt fetching.
Background: agent prompts historically lived in a single automated-resolution/fr/...
S3 prefix (the "AR store") and were fetched by FR's legacy
get_llm_prompt_template. We're migrating one agent at a time to dedicated stores
(legal-complaint/fr/..., future harry/fr/..., ...). This service owns the
"which prompts are served by dedicated stores, and how to fetch them" routing,
keeping that logic out of FR-specific files.
FR's get_llm_prompt_template is expected to delegate to this service when
is_prompt_template_supported returns True, otherwise fall through to its
existing AR-store code path.
AiToolingService ¶
Encapsulates dedicated-store prompt fetching, isolated from FR's legacy AR-store code path.
get_llm_prompt_template
staticmethod
¶
Return the raw prompt template dict from the prompt's dedicated store.
Caller is responsible for converting to its own entity type
(e.g. LlmPromptTemplate.from_dict(...) on the FR side). Raises if the
prompt is not routed to a dedicated store — callers should guard with
is_prompt_template_supported first.
Source code in components/ai_tooling/public/ai_tooling_service.py
is_prompt_template_supported
staticmethod
¶
True iff this prompt is served by a dedicated store (not the AR fallback).
resolve_env_branch_version_for_prompt
staticmethod
¶
Resolve (env, branch, version) against the prompt's dedicated store.
Used by upstream callers that pin a version before calling doctorai so the round-trip stays consistent. Raises if the prompt is not routed to a dedicated store.
Source code in components/ai_tooling/public/ai_tooling_service.py
components.ai_tooling.public.blueprint ¶
ai_tooling_blueprint
module-attribute
¶
ai_tooling_blueprint = create_blueprint(
name="ai_tooling",
import_name=__name__,
template_folder=join(
dirname(__file__), "..", "templates"
),
cli_group="ai_tooling",
)
components.ai_tooling.public.commands ¶
seed_agent_config_store ¶
Seed an empty initial commit in an agent config S3 store.
Required once per agent config store before the Marmot Agents Config tab can
load — resolve_env_branch_version raises "No versions found" on an empty
store. Seeds dev, stage and prod in one go (bucket is shared across envs;
the env is just a path segment).
Auto-scopes to the current app's country prefix (matches the runtime behavior
of AIAgentConfigTool._country_store).
Usage
flask ai_tooling seed-agent-config-store --store legal-complaint flask ai_tooling seed-agent-config-store --store harry --country fr
seed_agent_config_store ¶
Seed {store_prefix}/{country}/{env}/main/ with an empty initial commit for each of dev, stage, prod.
No-ops on any env whose branch already has a commit history.
Source code in components/ai_tooling/public/commands/seed_agent_config_store.py
components.ai_tooling.public.config_store ¶
ConfigStore ¶
Bases: Protocol
Backend-agnostic agent-config store contract used by AIAgentConfigTool.
copy ¶
Copy a source's configs to a target as a new commit.
Source code in components/ai_tooling/public/config_store.py
delete_branch ¶
fetch_agent ¶
Fetch a single agent's sections + commit metadata for a version.
fetch_all ¶
fetch_recent_commits ¶
Fetch the most recent commits up to a version, newest first.
fetch_review_state ¶
fetch_section ¶
fetch_tools_catalog ¶
for_country ¶
get_latest_version ¶
list_agent_names ¶
list_branches ¶
remove_version ¶
rollback ¶
Re-publish an older version as a new commit.
upload_all_sections ¶
Publish a commit: all sections plus its metadata.
Source code in components/ai_tooling/public/config_store.py
upload_review_state ¶
components.ai_tooling.public.dependencies ¶
components.ai_tooling.public.entities ¶
agent_config ¶
AgentConfigCommitMetadata
dataclass
¶
AgentConfigCommitMetadata(
author,
created_at,
message,
review_skipped=False,
env=None,
branch=None,
version=None,
)
Bases: DataClassJsonMixin
Metadata describing a versioned commit, stored alongside config sections in S3.
create
classmethod
¶
Build new commit metadata, stamped with the current user and time.
Source code in components/ai_tooling/public/entities/agent_config.py
LlmParams
dataclass
¶
PromptTemplate
dataclass
¶
ReviewState
dataclass
¶
Bases: DataClassJsonMixin
Review state stored alongside config versions in S3.
context_sections ¶
BaseContextSection
dataclass
¶
BaseContextSectionType ¶
Bases: AlanBaseEnum
Types of elements that can appear as a section in the context panel
ContextSectionType ¶
ListContextSection
dataclass
¶
ListItem
dataclass
¶
conversation_parts ¶
AgentHandoverConversationPart
dataclass
¶
AgentHandoverConversationPart(
*,
id,
part_type,
timestamp,
agent_task_id=None,
from_agent,
to_agent
)
Bases: BaseConversationPart
A conversation part representing a handover between agents.
BaseConversationPart
dataclass
¶
Bases: DataClassJsonMixin
Represents a single element in the conversation view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
part_type
|
BaseConversationPartType
|
The type of conversation element. |
required |
timestamp
|
datetime | None
|
When this element occurred. |
required |
BaseConversationPartType ¶
Bases: AlanBaseEnum
Types of elements that can appear in a conversation view.
ConversationPanel
dataclass
¶
ConversationPartType ¶
DocumentsConversationPart
dataclass
¶
Bases: BaseConversationPart
A conversation part containing document attachments.
InfoCardConversationPart
dataclass
¶
InfoCardConversationPart(
*,
id,
part_type,
timestamp,
agent_task_id=None,
role,
title,
subtitle,
icon=None,
url_path=None
)
Bases: BaseConversationPart
A conversation part displaying an info card in the debug tool UI.
MessageAttachment
dataclass
¶
MessageConversationPart
dataclass
¶
MessageConversationPart(
*,
id,
part_type,
timestamp,
agent_task_id=None,
role,
message,
is_voice_transcription=None
)
Bases: BaseConversationPart
A text message in the conversation.
MessageRole ¶
ReasoningConversationPart
dataclass
¶
Bases: BaseConversationPart
A conversation part representing LLM reasoning.
ToolCallConversationPart
dataclass
¶
ToolCallConversationPart(
*,
id,
part_type,
timestamp,
agent_task_id=None,
name,
arguments,
result,
role
)
Bases: BaseConversationPart
A conversation part representing an LLM tool call and its result.
ToolCallReviewStatus ¶
Bases: AlanBaseEnum
Human review state for a tool call with human review (metadata review_status).
Values must stay aligned with doctorai.common.enums.tool_call_review_status.
ToolCallWithReviewConversationPart
dataclass
¶
ToolCallWithReviewConversationPart(
*,
id,
part_type=ConversationPartType.TOOL_CALL,
timestamp,
agent_task_id=None,
name,
arguments,
result,
role,
review_status=None,
is_success=None
)
Bases: ToolCallConversationPart
A tool call with optional human review status and success flag.
overview ¶
CardPreviewConfig
dataclass
¶
Bases: DataClassJsonMixin
Column names used for the conversation list card preview.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Column name for the top-left bold text. |
required |
timestamp
|
str
|
Column name for the top-right dimmed time. |
required |
subtitle
|
str
|
Column name for the truncated line below. |
required |
ColumnConfig
dataclass
¶
ColumnConfig(
name,
label,
column_type,
show_in_table,
show_in_filter=True,
options=None,
link_template=None,
required=False,
default_value=None,
)
Bases: DataClassJsonMixin
Configuration for a single column in the conversation overview table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Internal column identifier (e.g. "state"). |
required |
label
|
str
|
Human-readable label (e.g. "State"). |
required |
column_type
|
ColumnType
|
Data type of the column. |
required |
show_in_table
|
bool
|
Whether to display as a table column. |
required |
show_in_filter
|
bool
|
Whether to display as a filter (defaults to True for filterable types). |
True
|
options
|
list[str] | None
|
Enum values for enum-type columns, None otherwise. |
None
|
link_template
|
str | None
|
URL template with {value} placeholder for link columns. |
None
|
required
|
bool
|
If True, filter cannot be cleared and default_value is applied. |
False
|
default_value
|
str | None
|
Default filter value for required columns. |
None
|
ColumnType ¶
Bases: AlanBaseEnum
Data type for a column in the conversation overview table.
ConversationListItem
dataclass
¶
Bases: DataClassJsonMixin
A single conversation row in the overview list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
Conversation identifier. |
required |
values
|
dict[str, str | None]
|
Mapping of column_name to stringified value. |
required |
ConversationOverviewConfig
dataclass
¶
Bases: DataClassJsonMixin
Full configuration returned by get_conversation_overview_config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
columns
|
list[ColumnConfig]
|
Column definitions for the overview table. |
required |
card_preview
|
CardPreviewConfig | None
|
Column mapping for the conversation list card preview. |
None
|
ConversationsOverviewResponse
dataclass
¶
Bases: DataClassJsonMixin
Paginated response for the conversation overview endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
list[ConversationListItem]
|
List of conversation rows for the current page. |
required |
page
|
int
|
Current page number (1-indexed). |
required |
per_page
|
int
|
Number of items per page. |
required |
total
|
int
|
Total number of matching conversations. |
required |
JoinedConversationRow
dataclass
¶
review_form ¶
ConditionalRequirement
dataclass
¶
ConditionalVisibility
dataclass
¶
MultiSelectField
dataclass
¶
MultiSelectField(
id,
label,
field_type,
required=False,
options=list(),
placeholder=None,
description=None,
conditional_on=None,
required_when=None,
allow_create=False,
)
Bases: ReviewField
A multi-select checkbox/tag field.
RatingField
dataclass
¶
RatingField(
id,
label,
field_type,
required=False,
options=None,
placeholder=None,
description=None,
conditional_on=None,
required_when=None,
allow_create=False,
min_value=1,
max_value=5,
)
ReviewField
dataclass
¶
ReviewField(
id,
label,
field_type,
required=False,
options=None,
placeholder=None,
description=None,
conditional_on=None,
required_when=None,
allow_create=False,
)
Bases: DataClassJsonMixin
A single field in a review form.
This base class includes all possible field attributes for backward compatibility. Use the specialized subclasses (RatingField, TextField, SelectField, MultiSelectField) when you need type-specific defaults and validation.
ReviewFieldOption
dataclass
¶
ReviewFieldType ¶
Bases: AlanBaseEnum
Types of fields that can appear in a review form.
ReviewForm
dataclass
¶
Bases: DataClassJsonMixin
A review form configuration.
from_ai_review_form_model
staticmethod
¶
Convert an AIReviewForm ORM model to a ReviewForm dataclass.
Source code in components/ai_tooling/public/entities/review_form.py
SelectField
dataclass
¶
SelectField(
id,
label,
field_type,
required=False,
options=list(),
placeholder=None,
description=None,
conditional_on=None,
required_when=None,
allow_create=False,
)
Bases: ReviewField
A single-select dropdown/radio field.
TextField
dataclass
¶
TextField(
id,
label,
field_type,
required=False,
options=None,
placeholder=None,
description=None,
conditional_on=None,
required_when=None,
allow_create=False,
)
Bases: ReviewField
A free-text input field.
ToolCallsReviewData
dataclass
¶
ToolCallsReviewField
dataclass
¶
ToolCallsReviewField(
id,
label,
field_type,
required=False,
options=None,
placeholder=None,
description=None,
conditional_on=None,
required_when=None,
allow_create=False,
tool_calls_data=None,
)
Bases: ReviewField
A field for reviewing tool calls made during a conversation.
review_field_from_dict ¶
Convert a field dictionary to the appropriate ReviewField subclass.
Source code in components/ai_tooling/public/entities/review_form.py
review_response ¶
Public entity for review response results.
ReviewResponseResult
dataclass
¶
Bases: DataClassJsonMixin
Result of submitting a review response.
This is the public representation of a submitted review, containing only the data needed by consumers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
The unique identifier of the created response. |
required |
entity_id
|
UUID
|
The conversation or response ID that was reviewed. |
required |
reviewer_id
|
str
|
Profile ID of the Alaner who submitted the review. |
required |
agent_type
|
str
|
The type of AI agent that was reviewed. |
required |
answers
|
dict[str, Any]
|
The submitted answers. |
required |
components.ai_tooling.public.enums ¶
agent_type ¶
Public agent type enum for AI tooling.
AgentType ¶
Bases: AlanBaseEnum
Type of agent being reviewed on AI conversations.
config_section ¶
components.ai_tooling.public.git_config_store ¶
GitConfigStore ¶
GitConfigStore(
repo_full_name,
registry_base,
prompts_base,
agent_registry_paths,
tool_definition_paths=(),
default_branch="main",
max_fetch_workers=8,
)
Git-backed agent-config store
The repo is the source of truth: each agent's config is assembled on the fly from its registry YAML + the prompt file it references, read at a given branch/commit. A "version" is a commit SHA.
Source code in components/ai_tooling/public/git_config_store.py
copy ¶
Create target_branch at the source commit (branch creation only).
Source code in components/ai_tooling/public/git_config_store.py
delete_branch ¶
Unsupported: edits to the git-backed config go through a PR.
fetch_agent ¶
Assemble a single agent's sections + commit metadata at version.
Cheaper than fetch_all: reads only this agent's registry/prompt/tool
files (plus the shared tool-definition files), not every agent's.
Source code in components/ai_tooling/public/git_config_store.py
fetch_all ¶
Assemble all sections + commit metadata at version (a commit SHA).
Source code in components/ai_tooling/public/git_config_store.py
fetch_recent_commits ¶
Most recent commits on branch, newest first, as commit metadata.
Source code in components/ai_tooling/public/git_config_store.py
fetch_review_state ¶
Always None: the git-backed config has no peer-review workflow.
Source code in components/ai_tooling/public/git_config_store.py
fetch_section ¶
Return a single section's assembled data at version.
Source code in components/ai_tooling/public/git_config_store.py
fetch_tools_catalog ¶
Full catalog of every defined tool, read straight from the tool-definition files (no agent fan-out).
Source code in components/ai_tooling/public/git_config_store.py
for_country ¶
No-op: the git-backed config is global, not partitioned by country.
get_latest_version ¶
HEAD commit SHA of branch, or None if the branch doesn't exist.
Source code in components/ai_tooling/public/git_config_store.py
list_agent_names ¶
The agent names, straight from the registry config (no GitHub read).
list_branches ¶
The git-backed config only exposes its configured default branch.
remove_version ¶
Unsupported: edits to the git-backed config go through a PR.
rollback ¶
Unsupported: edits to the git-backed config go through a PR.
Source code in components/ai_tooling/public/git_config_store.py
upload_all_sections ¶
Unsupported: edits to the git-backed config go through a PR.
Source code in components/ai_tooling/public/git_config_store.py
upload_review_state ¶
Unsupported: edits to the git-backed config go through a PR.
Source code in components/ai_tooling/public/git_config_store.py
components.ai_tooling.public.github_app ¶
agent_studio_github_app_client ¶
Build a GithubClient authed as the Agent Studio GitHub App.
write=True mints a token that can also create branches/commits/PRs;
otherwise the token is read-only. In test mode, returns a fake-token client
(callers mock the GitHub API).
Source code in components/ai_tooling/public/github_app.py
components.ai_tooling.public.helpers ¶
list_item_builders ¶
create_flask_admin_list_item ¶
Create a link to the item in Flask Admin
Source code in components/ai_tooling/public/helpers/list_item_builders.py
create_intercom_list_item ¶
Create a link to the Intercom conversation
Source code in components/ai_tooling/public/helpers/list_item_builders.py
create_marmot_user_list_item ¶
Create a link to the user's Marmot profile
Source code in components/ai_tooling/public/helpers/list_item_builders.py
components.ai_tooling.public.queries ¶
review_form ¶
Public queries for review form retrieval.
get_review_form_by_type ¶
Fetch the latest review form configuration for a given agent and review type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_type
|
str
|
The type of AI agent (e.g., "automated_resolution"). |
required |
review_type
|
ReviewType
|
The type of review workflow. |
required |
Returns:
| Type | Description |
|---|---|
ReviewForm | None
|
A ReviewForm if found, None otherwise. |
Source code in components/ai_tooling/public/queries/review_form.py
components.ai_tooling.public.s3_config_store ¶
S3ConfigStore ¶
S3 config store.
S3 key layout
{prefix}/{env}/{branch}/{version}/{section}.json {prefix}/{env}/{branch}/commit_history.txt
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
Path prefix isolating this deployment (e.g. "automated-resolution", "harry"). |
required |
sections
|
Sequence[ConfigSection]
|
Section names this store manages (e.g. ["agents", "llm_prompt_templates"]). |
required |
Source code in components/ai_tooling/public/s3_config_store.py
append_to_commit_history ¶
Append a version to the commit history file.
Source code in components/ai_tooling/public/s3_config_store.py
copy ¶
Copy source configs to target as a new commit.
Source code in components/ai_tooling/public/s3_config_store.py
delete_branch ¶
Delete all S3 objects for a branch.
Source code in components/ai_tooling/public/s3_config_store.py
fetch_agent ¶
Fetch all sections with the agents section narrowed to a single agent.
Source code in components/ai_tooling/public/s3_config_store.py
fetch_all ¶
Fetch all sections + commit metadata from S3 in parallel.
Returns {section_name: section_json, "metadata": commit_metadata_dict}.
Source code in components/ai_tooling/public/s3_config_store.py
fetch_commit_history ¶
Fetch the commit history (list of version strings) from S3.
Returns empty list if the commit history file doesn't exist.
Source code in components/ai_tooling/public/s3_config_store.py
fetch_recent_commits ¶
Fetch the most recent commits up to the given version, newest first.
Source code in components/ai_tooling/public/s3_config_store.py
fetch_review_state ¶
Fetch review_state.json for a version, or None if it doesn't exist.
Source code in components/ai_tooling/public/s3_config_store.py
fetch_section ¶
Fetch a single section's JSON from S3.
Source code in components/ai_tooling/public/s3_config_store.py
fetch_tools_catalog ¶
Return the persisted tools section (empty when tools are injected by an
enricher rather than stored).
Source code in components/ai_tooling/public/s3_config_store.py
for_country ¶
Return a new store with the country-specific prefix for country-specific storage.
Source code in components/ai_tooling/public/s3_config_store.py
get_latest_version ¶
Get the latest version from commit history, or None if the branch has no versions.
Source code in components/ai_tooling/public/s3_config_store.py
list_agent_names ¶
List agent names from the agents section.
Source code in components/ai_tooling/public/s3_config_store.py
list_branches ¶
List all branches for an environment.
Source code in components/ai_tooling/public/s3_config_store.py
remove_version ¶
Remove a version's files from S3 and its entry from commit history.
Source code in components/ai_tooling/public/s3_config_store.py
rollback ¶
Rollback by re-publishing an older commit as a new one.
Source code in components/ai_tooling/public/s3_config_store.py
upload_all_sections ¶
Publish a commit: upload all sections + commit metadata, then append to commit history.
Source code in components/ai_tooling/public/s3_config_store.py
upload_review_state ¶
Upload review_state.json for a version.
Source code in components/ai_tooling/public/s3_config_store.py
upload_section ¶
Upload a single section's JSON to S3.
Source code in components/ai_tooling/public/s3_config_store.py
with_sub_prefix ¶
Return a new store with the suffix appended to the prefix for country-specific storage.