Skip to content

Add Agent Lightning showcase application#1

Open
stephenspreetail wants to merge 1 commit into
mainfrom
claude/agent-lightning-showcase-app-6Ltpm
Open

Add Agent Lightning showcase application#1
stephenspreetail wants to merge 1 commit into
mainfrom
claude/agent-lightning-showcase-app-6Ltpm

Conversation

@stephenspreetail

Copy link
Copy Markdown
Owner

This commit adds a comprehensive showcase application demonstrating
Microsoft's Agent Lightning framework for training AI agents.

Features:

  • Sentiment analysis agent with functional and class-based approaches
  • Question answering agent with chain-of-thought reasoning
  • Math problem solver with step verification
  • Multi-agent pipeline demonstrating selective optimization
  • Sample datasets for training and validation
  • Grading utilities for computing rewards
  • 5 example scripts showing different use cases
  • Comprehensive README with documentation

https://claude.ai/code/session_01ThrVrGQcWmzDpoF14Lyegv

This commit adds a comprehensive showcase application demonstrating
Microsoft's Agent Lightning framework for training AI agents.

Features:
- Sentiment analysis agent with functional and class-based approaches
- Question answering agent with chain-of-thought reasoning
- Math problem solver with step verification
- Multi-agent pipeline demonstrating selective optimization
- Sample datasets for training and validation
- Grading utilities for computing rewards
- 5 example scripts showing different use cases
- Comprehensive README with documentation

https://claude.ai/code/session_01ThrVrGQcWmzDpoF14Lyegv

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a comprehensive showcase application demonstrating Microsoft's Agent Lightning framework for training AI agents. The showcase includes multiple example implementations showing different aspects of the framework, from basic sentiment analysis to complex multi-agent pipelines.

Changes:

  • Added complete package structure with agents, datasets, and utilities modules
  • Implemented 5 runnable examples demonstrating various Agent Lightning features
  • Provided sample datasets and grading utilities for sentiment analysis, question answering, and math problem solving
  • Included comprehensive README with installation instructions, usage examples, and API reference

Reviewed changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
setup.py Package configuration with dependencies and console script entry point
requirements.txt Core dependencies for the showcase application
agent_lightning_showcase/init.py Package initialization with version information
agent_lightning_showcase/agents/*.py Agent implementations (sentiment, QA, math, multi-agent)
agent_lightning_showcase/datasets/sample_datasets.py Training and validation datasets with TypedDict definitions
agent_lightning_showcase/utils/graders.py Reward grading functions for evaluating agent outputs
agent_lightning_showcase/utils/prompt_templates.py Baseline prompt templates for different agent types
examples/01_basic_sentiment_training.py Basic sentiment classification training example
examples/02_qa_agent_training.py Question answering with functional and class-based approaches
examples/03_math_solver_training.py Math problem solver with verification capabilities
examples/04_multi_agent_pipeline.py Multi-agent pipeline demonstrating selective optimization
examples/05_custom_store_and_strategy.py Advanced configuration with custom stores and strategies
README.md Comprehensive documentation with quick start guide and examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

)
from agent_lightning_showcase.utils.prompt_templates import (
SENTIMENT_BASELINE_PROMPT,
QA_BASELINE_PROMPT,

Copilot AI Jan 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The imported QA_BASELINE_PROMPT is never used in this file. It should be removed to avoid confusion.

Suggested change
QA_BASELINE_PROMPT,

Copilot uses AI. Check for mistakes.

from agent_lightning_showcase.datasets import create_math_dataset
from agent_lightning_showcase.agents.math_agent import MathAgent, math_solver
from agent_lightning_showcase.utils.prompt_templates import MATH_BASELINE_PROMPT

Copilot AI Jan 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The imported MATH_BASELINE_PROMPT is never used in this file. It should be removed to avoid confusion.

Suggested change
from agent_lightning_showcase.utils.prompt_templates import MATH_BASELINE_PROMPT

Copilot uses AI. Check for mistakes.
Comment thread README.md
formatted_prompt = prompt_template.format(text=task["text"])
response = prompt_template.complete(formatted_prompt)

reward = 1.0 if response.lower() == task["expected"].lower() else 0.0

Copilot AI Jan 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example code references task["expected"] but based on the SentimentTask TypedDict definition in agent_lightning_showcase/datasets/sample_datasets.py, the correct key is "expected_sentiment". This will cause a KeyError if someone tries to run this exact code.

Suggested change
reward = 1.0 if response.lower() == task["expected"].lower() else 0.0
reward = 1.0 if response.lower() == task["expected_sentiment"].lower() else 0.0

Copilot uses AI. Check for mistakes.
Comment thread README.md
trainer = agl.Trainer(
algorithm=agl.APO(AsyncOpenAI()),
n_runners=4,
initial_resources={"prompt_template": my_prompt_template},

Copilot AI Jan 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example code references an undefined variable my_prompt_template. This should either be defined in the example or replaced with a more descriptive placeholder like create_prompt_template() to match the pattern used in the actual example files.

Copilot uses AI. Check for mistakes.
Comment thread README.md
)
)

reward = grade_answer(response, task["expected"])

Copilot AI Jan 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example code uses task["expected"] but based on the QATask TypedDict definition in the codebase, the correct key is "expected_answer". Additionally, the function grade_answer is undefined - it should likely be qa_grader from agent_lightning_showcase.utils.graders to match the actual implementation.

Copilot uses AI. Check for mistakes.
Comment thread setup.py
Comment on lines +28 to +32
entry_points={
"console_scripts": [
"agl-showcase=agent_lightning_showcase.cli:main",
],
},

Copilot AI Jan 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setup.py defines a console script entry point 'agent_lightning_showcase.cli:main', but there is no cli.py module in the agent_lightning_showcase package. This will cause an error when the package is installed and someone tries to run the 'agl-showcase' command.

Suggested change
entry_points={
"console_scripts": [
"agl-showcase=agent_lightning_showcase.cli:main",
],
},

Copilot uses AI. Check for mistakes.
Comment thread README.md

```bash
# Clone the repository
git clone https://github.com/your-repo/agent-lightning-showcase.git

Copilot AI Jan 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The repository URL contains a placeholder "your-repo" which should be replaced with the actual repository owner/organization name before release.

Suggested change
git clone https://github.com/your-repo/agent-lightning-showcase.git
git clone https://github.com/microsoft/agent-lightning-showcase.git

Copilot uses AI. Check for mistakes.
Comment thread setup.py
Comment on lines +9 to +10
author="Your Name",
author_email="your.email@example.com",

Copilot AI Jan 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The author and author_email fields contain placeholder values ("Your Name" and "your.email@example.com"). These should be updated with actual information before release, or removed if not applicable.

Suggested change
author="Your Name",
author_email="your.email@example.com",

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +27
for label in valid_labels:
if label in prediction_clean:
predicted_label = label
break

Copilot AI Jan 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sentiment extraction logic uses a simple substring search which can lead to false positives. For example, if a response contains "not positive" or "negative" appears first in text like "negative sentiment is incorrect, it's positive", the wrong label could be extracted. Consider using regex word boundaries or extracting only the final/first complete word match.

Suggested change
for label in valid_labels:
if label in prediction_clean:
predicted_label = label
break
# Match only complete sentiment words and pick the last occurrence
pattern = r'\b(' + '|'.join(valid_labels) + r')\b'
matches = list(re.finditer(pattern, prediction_clean))
if matches:
predicted_label = matches[-1].group(1)

Copilot uses AI. Check for mistakes.
Comment on lines +96 to +97
openai_client = AsyncOpenAI()

Copilot AI Jan 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable openai_client is not used.

Suggested change
openai_client = AsyncOpenAI()

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants