Code
app.agents.agent_system
¶
Agent system utilities for orchestrating multi-agent workflows.
This module provides functions and helpers to create, configure, and run agent systems using Pydantic AI. It supports delegation of tasks to research, analysis, and synthesis agents, and manages agent configuration, environment setup, and execution. Args: provider (str): The name of the provider. provider_config (ProviderConfig): Configuration settings for the provider. api_key (str): API key for authentication with the provider. prompts (dict[str, str]): Configuration for prompts. include_researcher (bool): Flag to include the researcher agent. include_analyst (bool): Flag to include the analyst agent. include_synthesiser (bool): Flag to include the synthesiser agent. query (str | list[dict[str, str]]): The query or messages for the agent. chat_config (ChatConfig): The configuration object for agents and providers. usage_limits (UsageLimits): Usage limits for agent execution. pydantic_ai_stream (bool): Whether to use Pydantic AI streaming.
Functions:
Name | Description |
---|---|
get_manager |
Initializes and returns a manager agent with the specified configuration. |
run_manager |
Asynchronously runs the manager agent with the given query and provider. |
setup_agent_env |
Sets up the environment for an agent by configuring provider settings, prompts, API key, and usage limits. |
Classes¶
Functions¶
get_manager(provider, provider_config, api_key, prompts, include_researcher=False, include_analyst=False, include_synthesiser=False, enable_review_tools=False)
¶
Initializes and returns a Agent manager with the specified configuration. Args: provider (str): The name of the provider. provider_config (ProviderConfig): Configuration settings for the provider. api_key (str): API key for authentication with the provider. prompts (PromptsConfig): Configuration for prompts. include_researcher (bool, optional): Flag to include analyst model. Defaults to False. include_analyst (bool, optional): Flag to include analyst model. Defaults to False. include_synthesiser (bool, optional): Flag to include synthesiser model. Defaults to False. Returns: Agent: The initialized Agent manager.
Source code in src/app/agents/agent_system.py
run_manager(manager, query, provider, usage_limits, pydantic_ai_stream=False)
async
¶
Asynchronously runs the manager with the given query and provider, handling errors and printing results. Args: manager (Agent): The system agent responsible for running the query. query (str): The query to be processed by the manager. provider (str): The provider to be used for the query. usage_limits (UsageLimits): The usage limits to be applied during the query execution. pydantic_ai_stream (bool, optional): Flag to enable or disable Pydantic AI stream. Defaults to False. Returns: None
Source code in src/app/agents/agent_system.py
setup_agent_env(provider, query, chat_config, chat_env_config)
¶
Sets up the environment for an agent by configuring provider settings, prompts, API key, and usage limits.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
provider
|
str
|
The name of the provider. |
required |
query
|
UserPromptType
|
The messages or queries to be sent to the agent. |
required |
chat_config
|
ChatConfig | BaseModel
|
The configuration object containing provider and prompt settings. |
required |
chat_env_config
|
AppEnv
|
The application environment configuration containing API keys. |
required |
Returns:
Name | Type | Description |
---|---|---|
EndpointConfig |
EndpointConfig
|
The configuration object for the agent. |
Source code in src/app/agents/agent_system.py
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 |
|
app.agents.llm_model_funs
¶
LLM model functions for integrating with various LLM providers.
This module provides functions to retrieve API keys, provider configurations, and to create model instances for supported LLM providers such as Gemini and OpenAI. It also includes logic for assembling model dictionaries for system agents.
Classes¶
Functions¶
get_api_key(provider, chat_env_config)
¶
Retrieve API key from chat env config variable.
Source code in src/app/agents/llm_model_funs.py
get_models(endpoint_config, include_researcher=False, include_analyst=False, include_synthesiser=False)
¶
Get the models for the system agents.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint_config
|
EndpointConfig
|
Configuration for the model. |
required |
include_researcher
|
bool
|
Whether to include the researcher model. |
False
|
include_analyst
|
bool
|
Whether to include the analyst model. |
False
|
include_synthesiser
|
bool
|
Whether to include the synthesiser model. |
False
|
Returns:
Name | Type | Description |
---|---|---|
ModelDict |
ModelDict
|
A dictionary containing compatible models for the system agents. |
Source code in src/app/agents/llm_model_funs.py
get_provider_config(provider, providers)
¶
Retrieve configuration settings for the specified provider.
Source code in src/app/agents/llm_model_funs.py
setup_llm_environment(api_keys)
¶
Set up LLM environment variables for API keys.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_keys
|
dict[str, str]
|
Dictionary mapping provider names to API keys. |
required |
Source code in src/app/agents/llm_model_funs.py
app.agents.peerread_tools
¶
PeerRead agent tools for multi-agent system integration.
This module provides agent tools that enable the manager agent to interact with the PeerRead dataset for paper retrieval, querying, and review evaluation.
Classes¶
Functions¶
add_peerread_review_tools_to_manager(manager_agent, max_content_length=15000)
¶
Add PeerRead review generation and persistence tools to the manager agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
manager_agent
|
Agent[None, BaseModel]
|
The manager agent to which review tools will be added. |
required |
max_content_length
|
int
|
The maximum number of characters to include in the prompt. |
15000
|
Source code in src/app/agents/peerread_tools.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 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 |
|
add_peerread_tools_to_manager(manager_agent)
¶
Add PeerRead dataset tools to the manager agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
manager_agent
|
Agent[None, BaseModel]
|
The manager agent to which PeerRead tools will be added. |
required |
Source code in src/app/agents/peerread_tools.py
read_paper_pdf(ctx, pdf_path)
¶
Read text content from a PDF file using MarkItDown.
Note: MarkItDown extracts the entire PDF content as a single text block. Page-level extraction is not supported by the underlying library.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctx
|
RunContext[None] | None
|
RunContext (unused but required for tool compatibility). |
required |
pdf_path
|
str | Path
|
Path to the PDF file. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Extracted text content from the entire PDF in Markdown format. |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If the PDF file doesn’t exist. |
ValueError
|
If the file is not a PDF or conversion fails. |
Source code in src/app/agents/peerread_tools.py
app.app
¶
Main entry point for the Agents-eval application.
This module initializes the agentic system, loads configuration files, handles user input, and orchestrates the multi-agent workflow using asynchronous execution. It integrates logging, tracing, and authentication, and supports both CLI and programmatic execution.
Classes¶
Functions¶
main(chat_provider=CHAT_DEFAULT_PROVIDER, query='', include_researcher=False, include_analyst=False, include_synthesiser=False, pydantic_ai_stream=False, chat_config_file=None, enable_review_tools=False, paper_number=None, download_peerread_full_only=False, download_peerread_samples_only=False, peerread_max_papers_per_sample_download=5)
async
¶
Main entry point for the application.
Returns:
Type | Description |
---|---|
None
|
None |
Source code in src/app/app.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 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 |
|
app.config.config_app
¶
Configuration constants for the application.
app.data_models.app_models
¶
Data models for agent system configuration and results.
This module defines Pydantic models for representing research and analysis results, summaries, provider and agent configurations, and model dictionaries used throughout the application. These models ensure type safety and validation for data exchanged between agents and system components.
Classes¶
AgentConfig
¶
Bases: BaseModel
Configuration for an agent
Source code in src/app/data_models/app_models.py
AnalysisResult
¶
AppEnv
¶
Bases: BaseSettings
Application environment settings loaded from environment variables or .env file.
This class uses Pydantic’s BaseSettings to manage API keys and configuration for various inference endpoints, tools, and logging/monitoring services. Environment variables are loaded from a .env file by default.
Source code in src/app/data_models/app_models.py
ChatConfig
¶
Bases: BaseModel
Configuration settings for agents and model providers
Source code in src/app/data_models/app_models.py
EndpointConfig
¶
Bases: BaseModel
Configuration for an agent
Source code in src/app/data_models/app_models.py
ModelDict
¶
Bases: BaseModel
Dictionary of models used to create agent systems
Source code in src/app/data_models/app_models.py
ProviderConfig
¶
ResearchResult
¶
Bases: BaseModel
Research results from the research agent with flexible structure.
Source code in src/app/data_models/app_models.py
ResearchResultSimple
¶
ResearchSummary
¶
Bases: BaseModel
Expected model response of research on a topic
Source code in src/app/data_models/app_models.py
app.data_models.peerread_evaluation_models
¶
PeerRead evaluation data models.
This module defines Pydantic models specifically for evaluation results when comparing agent-generated reviews against PeerRead ground truth.
Classes¶
PeerReadEvalResult
¶
Bases: BaseModel
Result of evaluating agent review against PeerRead ground truth.
Source code in src/app/data_models/peerread_evaluation_models.py
app.data_models.peerread_models
¶
PeerRead dataset data models.
This module defines Pydantic models for representing PeerRead scientific paper review data structures. These models ensure type safety and validation for papers, reviews, and evaluation results used in the multi-agent system evaluation.
The models are based on the actual PeerRead dataset structure validated from: https://raw.githubusercontent.com/allenai/PeerRead/master/data/acl_2017/train/reviews/104.json
This module also includes structured data models for LLM-generated reviews, ensuring consistency and validation against the PeerRead format.
Classes¶
DownloadResult
¶
Bases: BaseModel
Result of dataset download operation.
Source code in src/app/data_models/peerread_models.py
GeneratedReview
¶
Bases: BaseModel
Structured data model for LLM-generated reviews.
This model enforces the PeerRead review format and ensures all required fields are present with proper validation.
Source code in src/app/data_models/peerread_models.py
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 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 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 |
|
Functions¶
to_peerread_format()
¶
Convert to PeerRead dataset format for compatibility.
Source code in src/app/data_models/peerread_models.py
validate_comments_structure(v)
¶
Ensure comments contain key review sections.
Source code in src/app/data_models/peerread_models.py
PeerReadConfig
¶
Bases: BaseModel
Configuration for PeerRead dataset management.
Source code in src/app/data_models/peerread_models.py
PeerReadPaper
¶
Bases: BaseModel
Scientific paper from PeerRead dataset.
Source code in src/app/data_models/peerread_models.py
PeerReadReview
¶
Bases: BaseModel
Individual peer review from PeerRead dataset.
Source code in src/app/data_models/peerread_models.py
ReviewGenerationResult
¶
Bases: BaseModel
Complete result from the review generation process.
Contains the structured review along with metadata.
Source code in src/app/data_models/peerread_models.py
app.data_utils.datasets_peerread
¶
PeerRead dataset core utilities for download and loading.
This module provides pure dataset functionality for downloading, caching, and loading the PeerRead scientific paper review dataset. It contains no evaluation logic - only data access and management.
Classes¶
PeerReadDownloader
¶
Downloads PeerRead dataset files with caching and validation.
Handles direct download from GitHub repository with progress tracking, error recovery, and integrity verification.
Source code in src/app/data_utils/datasets_peerread.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 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 |
|
Functions¶
__init__(config)
¶
Initialize downloader with configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
PeerReadConfig
|
PeerRead dataset configuration. |
required |
Source code in src/app/data_utils/datasets_peerread.py
download_file(venue, split, data_type, paper_id)
¶
Download a single file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
venue
|
str
|
Conference venue. |
required |
split
|
str
|
Data split. |
required |
data_type
|
str
|
Type of data (‘reviews’, ‘parsed_pdfs’, ‘pdfs’). |
required |
paper_id
|
str
|
Paper identifier. |
required |
Returns:
Type | Description |
---|---|
bytes | dict[str, Any] | None
|
File content (JSON dict for .json files, bytes for PDFs), |
bytes | dict[str, Any] | None
|
or None if download fails. |
Raises:
Type | Description |
---|---|
ValueError
|
If venue/split is invalid. |
Source code in src/app/data_utils/datasets_peerread.py
download_venue_split(venue, split, max_papers=None)
¶
Download all files for a venue/split combination across all data types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
venue
|
str
|
Conference venue. |
required |
split
|
str
|
Data split. |
required |
max_papers
|
int | None
|
Maximum number of papers to download. |
None
|
Returns:
Type | Description |
---|---|
DownloadResult
|
DownloadResult with download statistics. |
Source code in src/app/data_utils/datasets_peerread.py
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 |
|
PeerReadLoader
¶
Loads and queries PeerRead dataset with structured access.
Source code in src/app/data_utils/datasets_peerread.py
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 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 |
|
Functions¶
__init__(config=None)
¶
Initialize loader with configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
PeerReadConfig | None
|
PeerRead dataset configuration. Loads from file if None. |
None
|
Source code in src/app/data_utils/datasets_peerread.py
get_paper_by_id(paper_id)
¶
Get a specific paper by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paper_id
|
str
|
Paper identifier. |
required |
Returns:
Type | Description |
---|---|
PeerReadPaper | None
|
PeerReadPaper if found, None otherwise. |
Source code in src/app/data_utils/datasets_peerread.py
get_raw_pdf_path(paper_id)
¶
Get the absolute path to the raw PDF file for a given paper ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paper_id
|
str
|
Unique identifier for the paper. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str | None
|
The absolute path to the PDF file, or None if not found. |
Source code in src/app/data_utils/datasets_peerread.py
load_papers(venue='acl_2017', split='train')
¶
Load papers from cached data or download if needed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
venue
|
str
|
Conference venue. |
'acl_2017'
|
split
|
str
|
Data split. |
'train'
|
Returns:
Type | Description |
---|---|
list[PeerReadPaper]
|
List of validated PeerReadPaper models. |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If cache directory doesn’t exist and download fails. |
Source code in src/app/data_utils/datasets_peerread.py
load_parsed_pdf_content(paper_id)
¶
Load the text content from the parsed PDF for a given paper ID.
Assumes parsed PDF files are JSON and contain a ‘sections’ key with ‘text’ within. Defaults to the latest revision if multiple exist (by filename).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paper_id
|
str
|
Unique identifier for the paper. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str | None
|
The extracted text content, or None if not found/parsed. |
Source code in src/app/data_utils/datasets_peerread.py
query_papers(venue=None, min_reviews=1, limit=None)
¶
Query papers with filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
venue
|
str | None
|
Filter by venue (None for all venues). |
None
|
min_reviews
|
int
|
Minimum number of reviews required. |
1
|
limit
|
int | None
|
Maximum number of papers to return. |
None
|
Returns:
Type | Description |
---|---|
list[PeerReadPaper]
|
List of filtered PeerReadPaper models. |
Source code in src/app/data_utils/datasets_peerread.py
Functions¶
download_peerread_dataset(peerread_max_papers_per_sample_download=None)
¶
Download PeerRead dataset and verify the download.
This function handles the setup phase separately from MAS execution, following Separation of Concerns principle. It downloads the dataset to the configured path and verifies the download was successful.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
peerread_max_papers_per_sample_download
|
int | None
|
The maximum number of papers to download. If None, downloads all papers it can find. |
None
|
Raises:
Type | Description |
---|---|
Exception
|
If download or verification fails. |
Source code in src/app/data_utils/datasets_peerread.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 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 |
|
load_peerread_config()
¶
Load PeerRead dataset configuration from config file.
Returns:
Name | Type | Description |
---|---|---|
PeerReadConfig |
PeerReadConfig
|
Validated configuration object. |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If config file doesn’t exist. |
ValidationError
|
If config data is invalid. |
Source code in src/app/data_utils/datasets_peerread.py
app.data_utils.review_loader
¶
Review loading utilities for external evaluation system.
Classes¶
ReviewLoader
¶
Loads MAS-generated reviews for external evaluation system.
Source code in src/app/data_utils/review_loader.py
Functions¶
__init__(reviews_dir=MAS_REVIEWS_PATH)
¶
Initialize with reviews directory path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reviews_dir
|
str
|
Directory containing review files |
MAS_REVIEWS_PATH
|
Source code in src/app/data_utils/review_loader.py
get_available_paper_ids()
¶
Get list of paper IDs that have reviews available.
Returns:
Name | Type | Description |
---|---|---|
list |
list[str]
|
Paper identifiers with available reviews |
Source code in src/app/data_utils/review_loader.py
load_all_reviews()
¶
Load all available reviews grouped by paper ID.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict[str, PeerReadReview]
|
Mapping of paper_id -> latest PeerReadReview |
Source code in src/app/data_utils/review_loader.py
load_review_for_paper(paper_id)
¶
Load the latest review for a specific paper.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paper_id
|
str
|
Paper identifier |
required |
Returns:
Type | Description |
---|---|
PeerReadReview | None
|
PeerReadReview object if found, None otherwise |
Source code in src/app/data_utils/review_loader.py
app.data_utils.review_persistence
¶
Review persistence interface for MAS and evaluation system integration.
Classes¶
ReviewPersistence
¶
Handles saving and loading of MAS-generated reviews.
Source code in src/app/data_utils/review_persistence.py
Functions¶
__init__(reviews_dir=MAS_REVIEWS_PATH)
¶
Initialize with reviews directory path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reviews_dir
|
str
|
Directory to store review files |
MAS_REVIEWS_PATH
|
Source code in src/app/data_utils/review_persistence.py
get_latest_review(paper_id)
¶
Get the most recent review file for a paper.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paper_id
|
str
|
Paper identifier |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str | None
|
Path to latest review file, or None if not found |
Source code in src/app/data_utils/review_persistence.py
list_reviews(paper_id=None)
¶
List available review files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paper_id
|
str | None
|
Optional filter by paper ID |
None
|
Returns:
Name | Type | Description |
---|---|---|
list |
list[str]
|
Paths to matching review files |
Source code in src/app/data_utils/review_persistence.py
load_review(filepath)
¶
Load a review from file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath
|
str
|
Path to the review file |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
tuple[str, PeerReadReview]
|
(paper_id, PeerReadReview object) |
Source code in src/app/data_utils/review_persistence.py
save_review(paper_id, review, timestamp=None)
¶
Save a review to the reviews directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paper_id
|
str
|
Unique identifier for the paper |
required |
review
|
PeerReadReview
|
The generated review object |
required |
timestamp
|
str | None
|
Optional timestamp, defaults to current UTC time |
None
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Path to the saved review file |
Source code in src/app/data_utils/review_persistence.py
Functions¶
app.evals.metrics
¶
Functions¶
output_similarity(agent_output, expected_answer)
¶
Determine to what degree the agent’s output matches the expected answer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent_output
|
str
|
The output produced by the agent. |
required |
expected_answer
|
str
|
The correct or expected answer. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the output matches the expected answer, False otherwise. |
Source code in src/app/evals/metrics.py
time_taken(start_time, end_time)
¶
Calculate duration between start and end timestamps
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_time
|
float
|
Timestamp when execution started |
required |
end_time
|
float
|
Timestamp when execution completed |
required |
Returns:
Type | Description |
---|---|
float
|
Duration in seconds with microsecond precision |
Source code in src/app/evals/metrics.py
app.evals.peerread_evaluation
¶
PeerRead evaluation utilities for comparing agent reviews against ground truth.
This module provides functionality to evaluate agent-generated scientific paper reviews against the peer reviews in the PeerRead dataset. It includes similarity metrics and structured comparison results.
Classes¶
Functions¶
calculate_cosine_similarity(text1, text2)
¶
Calculate cosine similarity between two text strings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text1
|
str
|
First text string. |
required |
text2
|
str
|
Second text string. |
required |
Returns:
Type | Description |
---|---|
float
|
Cosine similarity score (0-1). |
Source code in src/app/evals/peerread_evaluation.py
calculate_jaccard_similarity(text1, text2)
¶
Calculate Jaccard similarity between two text strings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text1
|
str
|
First text string. |
required |
text2
|
str
|
Second text string. |
required |
Returns:
Type | Description |
---|---|
float
|
Jaccard similarity score (0-1). |
Source code in src/app/evals/peerread_evaluation.py
create_evaluation_result(paper_id, agent_review, ground_truth_reviews)
¶
Create evaluation result comparing agent review to ground truth.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paper_id
|
str
|
Paper identifier. |
required |
agent_review
|
str
|
Review generated by agent. |
required |
ground_truth_reviews
|
list[PeerReadReview]
|
Original peer reviews. |
required |
Returns:
Type | Description |
---|---|
PeerReadEvalResult
|
PeerReadEvalResult with similarity metrics. |
Source code in src/app/evals/peerread_evaluation.py
evaluate_review_similarity(agent_review, ground_truth)
¶
Evaluate similarity between agent review and ground truth.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent_review
|
str
|
Review text generated by agent. |
required |
ground_truth
|
str
|
Ground truth review text. |
required |
Returns:
Type | Description |
---|---|
float
|
Weighted similarity score (0-1). |
Source code in src/app/evals/peerread_evaluation.py
app.utils.error_messages
¶
Error message utilities for the Agents-eval application.
This module provides concise helper functions for generating standardized error messages related to configuration loading and validation.
Functions¶
api_connection_error(error)
¶
failed_to_load_config(error)
¶
file_not_found(file_path)
¶
generic_exception(error)
¶
get_key_error(error)
¶
invalid_data_model_format(error)
¶
Generate an error message for invalid pydantic data model format.
invalid_json(error)
¶
invalid_type(expected_type, actual_type)
¶
app.utils.load_configs
¶
Configuration loading utilities.
Provides a generic function for loading and validating JSON configuration files against Pydantic models, with error handling and logging support.
Functions¶
load_config(config_path, data_model)
¶
Generic configuration loader that validates against any Pydantic model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_path
|
str | Path
|
Path to the JSON configuration file |
required |
model
|
Pydantic model class for validation |
required |
Returns:
Type | Description |
---|---|
BaseModel
|
Validated configuration instance |
Source code in src/app/utils/load_configs.py
app.utils.load_settings
¶
Utility functions and classes for loading application settings and configuration.
This module defines the AppEnv class for managing environment variables using Pydantic, and provides a function to load and validate application configuration from a JSON file.
Classes¶
AppEnv
¶
Bases: BaseSettings
Application environment settings loaded from environment variables or .env file.
This class uses Pydantic’s BaseSettings to manage API keys and configuration for various inference endpoints, tools, and logging/monitoring services. Environment variables are loaded from a .env file by default.
Source code in src/app/utils/load_settings.py
Functions¶
load_config(config_path)
¶
Load and validate application configuration from a JSON file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_path
|
str
|
Path to the JSON configuration file. |
required |
Returns:
Name | Type | Description |
---|---|---|
ChatConfig |
ChatConfig
|
An instance of ChatConfig with validated configuration data. |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If the configuration file does not exist. |
JSONDecodeError
|
If the file contains invalid JSON. |
Exception
|
For any other unexpected errors during loading or validation. |
Source code in src/app/utils/load_settings.py
app.utils.log
¶
Set up the logger with custom settings. Logs are written to a file with automatic rotation.
app.utils.login
¶
This module provides utility functions for managing login state and initializing the environment for a given project. It includes functionality to load and save login state, perform a one-time login, and check if the user is logged in.
Classes¶
Functions¶
login(project_name, chat_env_config)
¶
Logs in to the workspace and initializes the environment for the given project. Args: project_name (str): The name of the project to initialize. chat_env_config (AppEnv): The application environment configuration containing the API keys. Returns: None
Source code in src/app/utils/login.py
app.utils.paths
¶
Centralized path resolution utilities for the application.
Functions¶
get_app_root()
¶
Get the application root directory (src/app).
Returns:
Name | Type | Description |
---|---|---|
Path |
Path
|
Absolute path to the src/app directory. |
get_config_dir()
¶
Get the application config directory (src/app/config).
Returns:
Name | Type | Description |
---|---|---|
Path |
Path
|
Absolute path to the src/app/config directory. |
get_project_root()
¶
Get the project root directory.
Returns:
Name | Type | Description |
---|---|---|
Path |
Path
|
Absolute path to the project root directory. |
get_review_template_path()
¶
Get the path to the review template file.
Returns:
Name | Type | Description |
---|---|---|
Path |
Path
|
Absolute path to the REVIEW_PROMPT_TEMPLATE file. |
resolve_app_path(relative_path)
¶
Resolve a path relative to the application root.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
relative_path
|
str
|
Path relative to src/app directory. |
required |
Returns:
Name | Type | Description |
---|---|---|
Path |
Path
|
Absolute path resolved from the application root. |
Example
resolve_app_path(“datasets/peerread”) -> /full/path/to/src/app/datasets/peerread
Source code in src/app/utils/paths.py
resolve_config_path(filename)
¶
Resolve a config file path within the config directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
Name of the config file (e.g., “config_chat.json”). |
required |
Returns:
Name | Type | Description |
---|---|---|
Path |
Path
|
Absolute path to the config file. |
Example
resolve_config_path(“config_chat.json”) -> /full/path/to/src/app/config/config_chat.json
Source code in src/app/utils/paths.py
resolve_project_path(relative_path)
¶
Resolve a path relative to the project root.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
relative_path
|
str
|
Path relative to the project root directory. |
required |
Returns:
Name | Type | Description |
---|---|---|
Path |
Path
|
Absolute path resolved from the project root. |
Source code in src/app/utils/paths.py
app.utils.utils
¶
This module provides utility functions and context managers for handling configurations, error handling, and setting up agent environments.
Functions:
Name | Description |
---|---|
load_config |
str) -> Config: Load and validate configuration from a JSON file. |
print_research_Result |
Dict, usage: Usage) -> None: Output structured summary of the research topic. |
error_handling_context |
str, console: Console = None): Context manager for handling errors during operations. |
setup_agent_env |
Config, console: Console = None) -> AgentConfig: Set up the agent environment based on the provided configuration. |
Classes¶
Functions¶
log_research_result(summary, usage)
¶
Prints the research summary and usage details in a formatted manner.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
summary
|
Dict
|
A dictionary containing the research summary with keys ‘topic’, ‘key_points’, ‘key_points_explanation’, and ‘conclusion’. |
required |
usage
|
Usage
|
An object containing usage details to be printed. |
required |
Source code in src/app/utils/utils.py
examples.run_simple_agent_no_tools
¶
A simple example of using a Pydantic AI agent to generate a structured summary of a research topic.
Functions¶
main()
¶
Main function to run the research agent.
Source code in src/examples/run_simple_agent_no_tools.py
examples.run_simple_agent_system
¶
This example demonstrates how to run a simple agent system that consists of a manager agent, a research agent, and an analysis agent. The manager agent delegates research and analysis tasks to the corresponding agents and combines the results to provide a comprehensive answer to the user query. https://ai.pydantic.dev/multi-agent-applications/#agent-delegation
Classes¶
Functions¶
get_manager(model_manager, model_researcher, model_analyst, prompts)
¶
Get the agents for the system.
Source code in src/examples/run_simple_agent_system.py
get_models(model_config)
¶
Get the models for the system agents.
Source code in src/examples/run_simple_agent_system.py
main()
async
¶
Main function to run the research system.
Source code in src/examples/run_simple_agent_system.py
examples.run_simple_agent_tools
¶
Run the dice game agent using simple tools.
Functions¶
main()
¶
Run the dice game agent.
Source code in src/examples/run_simple_agent_tools.py
examples.utils.agent_simple_no_tools
¶
This module contains a function to create a research agent with the specified model, result type, and system prompt.
Classes¶
Functions¶
get_research(topic, prompts, provider, provider_config, api_key)
¶
Run the research agent to generate a structured summary of a research topic.
Source code in src/examples/utils/agent_simple_no_tools.py
examples.utils.agent_simple_system
¶
This module contains a simple system of agents that can be used to research and analyze data.
Classes¶
SystemAgent
¶
Bases: Agent
A generic system agent that can be used to research and analyze data.
Source code in src/examples/utils/agent_simple_system.py
Functions¶
add_tools_to_manager_agent(manager_agent, research_agent, analysis_agent)
¶
Create and configure the joke generation agent.
Source code in src/examples/utils/agent_simple_system.py
examples.utils.agent_simple_tools
¶
Simple agent for the dice game example.
Functions¶
get_dice(player_name, guess, system_prompt, provider, api_key, config)
¶
Run the dice game agent.
Source code in src/examples/utils/agent_simple_tools.py
examples.utils.data_models
¶
Example of a module with data models
Classes¶
AnalysisResult
¶
Config
¶
Bases: BaseModel
Configuration settings for the research agent and model providers
Source code in src/examples/utils/data_models.py
ProviderConfig
¶
ResearchResult
¶
ResearchSummary
¶
Bases: BaseModel
Expected model response of research on a topic
Source code in src/examples/utils/data_models.py
examples.utils.utils
¶
Utility functions for running the research agent example.
Classes¶
Functions¶
create_model(base_url, model_name, api_key=None, provider=None)
¶
Create a model that uses base_url as inference API
Source code in src/examples/utils/utils.py
get_api_key(provider)
¶
Retrieve API key from environment variable.
Source code in src/examples/utils/utils.py
get_provider_config(provider, config)
¶
Retrieve configuration settings for the specified provider.
Source code in src/examples/utils/utils.py
load_config(config_path)
¶
Load and validate configuration from a JSON file.
Source code in src/examples/utils/utils.py
print_research_Result(summary, usage)
¶
Output structured summary of the research topic.
Source code in src/examples/utils/utils.py
gui.components.footer
¶
gui.components.header
¶
gui.components.output
¶
Functions¶
render_output(result=None, info_str=None, type=None)
¶
Renders the output in a Streamlit app based on the provided type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
result
|
Any
|
The content to be displayed. Can be JSON, code markdown, or plain text. |
None
|
info
|
str
|
The information message to be displayed if result is None. |
required |
type
|
str
|
The type of the result content. Can be ‘json’, ‘code’, ‘md’, or other for plain text. |
None
|
Returns:
Name | Type | Description |
---|---|---|
Out |
None |
Source code in src/gui/components/output.py
gui.components.prompts
¶
gui.components.sidebar
¶
gui.config.config
¶
gui.config.styling
¶
gui.config.text
¶
gui.pages.home
¶
gui.pages.prompts
¶
Streamlit component for editing agent system prompts.
This module provides a function to render and edit prompt configurations for agent roles using a Streamlit-based UI. It validates the input configuration, displays warnings if prompts are missing, and allows interactive editing of each prompt.
Classes¶
Functions¶
render_prompts(chat_config)
¶
Render and edit the prompt configuration for agent roles in the Streamlit UI.
Source code in src/gui/pages/prompts.py
gui.pages.run_app
¶
Streamlit interface for running the agentic system interactively.
This module defines the render_app function, which provides a Streamlit-based UI for users to select a provider, enter a query, and execute the main agent workflow. Results and errors are displayed in real time, supporting asynchronous execution.
Functions¶
render_app(provider=None, chat_config_file=None)
async
¶
Render the main app interface for running agentic queries via Streamlit.
Displays input fields for provider and query, a button to trigger execution, and an area for output or error messages. Handles async invocation of the main agent workflow and logs any exceptions.
Source code in src/gui/pages/run_app.py
gui.pages.settings
¶
Streamlit settings UI for provider and agent configuration.
This module provides a function to render and edit agent system settings, including provider selection and related options, within the Streamlit GUI. It validates the input configuration and ensures correct typing before rendering.
Classes¶
Functions¶
render_settings(chat_config)
¶
Render and edit agent system settings in the Streamlit UI.
Displays a header and a selectbox for choosing the inference provider. Validates that the input is a ChatConfig instance and displays an error if not.
Source code in src/gui/pages/settings.py
run_cli
¶
Lightweight CLI wrapper for the Agents-eval application.
This wrapper handles help and basic argument parsing quickly without loading heavy dependencies. It only imports the main application when actual processing is needed.
Functions¶
parse_args(argv)
¶
Parse command line arguments into a dictionary.
This function processes a list of command-line arguments,
extracting recognized options and their values.
Supported arguments include flags (e.g., –help, –include-researcher
and key-value pairs (e.g., --chat-provider=ollama
).
If the --help
flag is present, a list of available commands and their
descriptions is printed, and an empty dictionary is returned.
Returns:
Type | Description |
---|---|
dict[str, str | bool]
|
|
dict[str, str | bool]
|
(with leading ‘–’ removed and hyphens replaced by underscores) |
dict[str, str | bool]
|
to their values ( |
dict[str, str | bool]
|
Returns an empty dict if |
Example
parse_args(['--chat-provider=ollama', '--include-researcher'])
returns{'chat_provider': 'ollama', 'include_researcher': True}
Source code in src/run_cli.py
run_gui
¶
This module sets up and runs a Streamlit application for a Multi-Agent System.
The application includes the following components: - Header - Sidebar for configuration options - Main content area for prompts - Footer
The main function loads the configuration, renders the UI components, and handles the execution of the Multi-Agent System based on user input.
Functions: - run_app(): Placeholder function to run the main application logic. - main(): Main function to set up and run the Streamlit application.