This directory contains integration tests that verify AgentUnit works with real framework implementations.
The LangGraph integration tests verify that AgentUnit can properly evaluate LangGraph agents through a complete evaluation cycle.
To run LangGraph integration tests, you need to install LangGraph:
# Install optional integration test dependencies
poetry install --extras integration-testsOr install LangGraph manually:
poetry add langgraph --group devpytest tests/integration/pytest tests/integration/ -m langgraphpytest -m "not integration"pytest tests/integration/ -vsimple_langgraph_agent.py- Contains a simple LangGraph agent implementation for testingtest_langgraph_integration.py- Integration tests for LangGraph adapterconftest.py- Test configuration and markers
- Scenario Creation: Tests creating scenarios from callable agents and Python files
- Full Evaluation Cycle: Tests running complete evaluation cycles with multiple test cases
- Metrics Integration: Tests that metrics can be calculated (when available)
- Error Handling: Tests graceful handling of agent failures
- Retry Logic: Tests scenario retry functionality
- Multiple Scenarios: Tests running multiple scenarios together
The integration tests are designed to be optionally run in CI:
- Tests are automatically skipped if LangGraph is not installed
- Use pytest markers to selectively run or skip integration tests
- All tests are marked with
@pytest.mark.integrationand@pytest.mark.langgraph
When adding integration tests for other frameworks:
- Create a simple agent implementation in the framework
- Create test cases that cover the full evaluation cycle
- Use appropriate pytest markers (e.g.,
@pytest.mark.crewai) - Ensure tests are skipped gracefully when dependencies are not available
- Document the prerequisites and running instructions
import pytest
from agentunit import Scenario, run_suite
from tests.integration.simple_langgraph_agent import invoke_agent
@pytest.mark.langgraph
@pytest.mark.integration
def test_my_langgraph_scenario():
scenario = Scenario.load_langgraph(
path=invoke_agent,
dataset=my_dataset,
name="my-test"
)
result = run_suite([scenario])
assert len(result.scenarios) == 1