AI-Powered Customer Support Investigation Assistant
An intelligent assistant that helps support agents debug customer issues by automatically gathering, analyzing, and presenting relevant data from multiple sources. Built for Seam, the API for smart locks and access control.
Customer support teams spend significant time (30%+ of cases) manually navigating through admin dashboards, job logs, and various data sources to debug customer issues:
- Multiple clicks through complex admin interfaces
- Manual log analysis with poor search capabilities
- Time-consuming triangulation of timestamps across jobs, action attempts, and errors
- Inability to link to specific logs, causing duplicated effort
- Manual timeline reconstruction for issues reported days/weeks after occurrence
Seam Agent is an AI orchestrator that instantly gathers, analyzes, and presents debugging information from multiple data sourcesโreducing manual effort and improving response times from hours to minutes.
Support Agent: "What's wrong with device 267ed8d4-3933-4e71-921a-53ce3736879a?"
โ
โโโโโโโโโโโโโโโโโ
โ Seam Agent โ
โ Orchestrator โ
โโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ
โ PostgreSQL โ โ Quickwit โ โ Seam API โ
โ Database โ โ Logs โ โ Endpoints โ
โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโ
โ Formatted Analysis โ
โ + Admin Links โ
โ + Next Steps โ
โโโโโโโโโโโโโโโโโโโโโโโโโ
- Extracts device IDs, workspace IDs, access codes, and time references from natural language
- Classifies query types:
device_behavior,troubleshooting,api_help,account_issue - Uses GPT-4o-mini for cost-efficient structured extraction
- Automatically selects relevant investigation tools based on query type
- Supports multi-round tool calling with configurable limits
- Includes follow-up tool recommendations based on initial findings
| Tool | Description |
|---|---|
get_device_info |
Device properties, status, capabilities, and errors |
get_access_codes |
Access codes with managed/unmanaged status |
get_action_attempts |
Operation history with success/failure patterns |
get_device_events |
Event timeline including connectivity changes |
get_audit_logs |
Access code INSERT/DELETE audit trail |
get_admin_links |
Generated admin panel URLs for deeper investigation |
Generates structured internal notes with:
- ๐ Device Analysis summary
โ ๏ธ Issue identification- ๐ Timeline reconstruction
- ๐ง Root cause analysis
- ๐ฏ Actionable next steps
- ๐ Admin links for follow-up
src/seam_agent/
โโโ assistant/ # Core AI orchestration
โ โโโ simple_investigator.py # Main investigation orchestrator
โ โโโ tool_orchestrator.py # Tool execution and result summarization
โ โโโ tool_registry.py # Maps issue types to required tools
โ โโโ dynamic_tool_selector.py # Intelligent tool selection
โ โโโ query_parser.py # LLM-based query parsing
โ โโโ prompt_manager.py # Investigation prompt templates
โ โโโ investigation_config.py # Limits and resource management
โ โโโ investigation_logger.py # Structured logging
โโโ connectors/ # Data source integrations
โ โโโ db.py # PostgreSQL async client
โ โโโ quickwit.py # Quickwit log search client
โ โโโ seam_api.py # Seam REST API client
โ โโโ admin_links.py # Admin URL generator
โโโ integrations/ # External service integrations
โโโ slack.py # Slack integration (planned)
โโโ unthread.py # Unthread integration (planned)
SimpleInvestigator โ The main entry point that coordinates the entire investigation flow:
- Parses the support query to extract structured data
- Calls Claude with available tools based on query type
- Handles multi-round tool calling with configurable limits
- Formats findings into a structured support note
ToolOrchestrator โ Manages tool execution and result processing:
- Executes database queries and API calls
- Summarizes results to preserve critical debugging info
- Caches results to prevent hallucinations in follow-up tools
DynamicToolSelector โ Intelligently chooses investigation paths:
- Selects initial tools based on parsed query
- Recommends follow-up tools based on findings
- Respects configurable tool calling limits
- Python 3.10+
- PostgreSQL database access (Seam production/staging)
- API keys for Anthropic, OpenAI
# Clone the repository
git clone https://github.com/seamapi/seam-agent.git
cd seam-agent
# Install with uv (recommended)
uv syncCreate a .env file or export environment variables:
# Required
ANTHROPIC_API_KEY=sk-ant-... # For Claude (investigation)
OPENAI_API_KEY=sk-... # For GPT-4o-mini (query parsing)
DATABASE_URL=postgresql://... # Seam PostgreSQL connection
# Optional
QUICKWIT_URL=http://localhost:7280 # Quickwit log search
QUICKWIT_API_KEY=... # Quickwit authentication
SEAM_API_KEY=seam_... # Seam API accessimport asyncio
from seam_agent.assistant.simple_investigator import SimpleInvestigator
async def main():
investigator = SimpleInvestigator(debug_mode=True)
result = await investigator.investigate("""
Hello team!
We are checking an Igloohome device that does not seem to be
connected to a bridge, so it only supports offline functionality.
However, the device response says that it can program online
access codes. Is that correct?
Device ID: 267ed8d4-3933-4e71-921a-53ce3736879a
""")
# Print formatted investigation
print(result["investigation"])
# Export to markdown file
filename = investigator.export_investigation_to_md(result)
print(f"Report saved to: {filename}")
asyncio.run(main())๐ **Device Analysis**: Igloohome Device (267ed8d4-3933-4e71-921a-53ce3736879a)
โ ๏ธ **Issue Identified**: Device shows conflicting capability flags - indicates
online access code support while offline and not bridge-connected
๐ **Status**: Under investigation - potential platform capability reporting issue
๐ **Timeline**:
โข Device last disconnected: 2025-07-27T13:06:05.495Z
โข Last 10 connection reports all show "DEVICE_OFFLINE"
โข Device remains offline with no bridge connectivity
๐ง **Root Cause**: System showing `can_program_online_access_codes: true` based
on device model capabilities, but device is offline and not connected to bridge.
Capability flags are not dynamically updated based on actual connectivity status.
๐ฏ **Next Steps**:
1. **Customer Communication**: Confirm online access codes require bridge
connectivity - currently only offline codes are functional
2. **Technical Review**: Verify connectivity attempts through admin panel
3. **Platform Escalation**: Consider engineering review of capability flag logic
๐ **Admin Links for Further Investigation:**
- [Device Details](https://connect.getseam.com/admin/view_device?device_id=...)
- [Device Action History](https://connect.getseam.com/admin/view_device_action_attempts?device_id=...)from seam_agent.assistant.investigation_config import InvestigationConfig
# Production config (conservative)
config = InvestigationConfig.create_production_config()
# MAX_TOOL_ROUNDS: 2
# MAX_TOOLS_PER_ROUND: 3
# MAX_TOTAL_TOOLS: 6
# Debug config (permissive)
config = InvestigationConfig.create_debug_config()
# MAX_TOOL_ROUNDS: 5
# MAX_TOOLS_PER_ROUND: 8
# MAX_TOTAL_TOOLS: 20
# Custom config
config = InvestigationConfig(
MAX_TOOL_ROUNDS=3,
MAX_TOOLS_PER_ROUND=5,
MAX_TOTAL_TOOLS=10,
TOTAL_INVESTIGATION_TIMEOUT=120
)
investigator = SimpleInvestigator(config=config)# Human-readable logs
investigator = SimpleInvestigator(debug_mode=True, log_format="human")
# JSON logs (for parsing)
investigator = SimpleInvestigator(debug_mode=True, log_format="json")Run a full investigation demo with mocked external servicesโno API keys required:
uv run python demo_investigation.pyThis demonstrates:
- Dynamic tool selection based on issue type
- Multi-round tool calling with limit enforcement
- Structured analysis and recommendations
Run a real investigation against production databases:
# Single investigation (loads .env automatically)
uv run --env-file .env python -m seam_agent.assistant.simple_investigator
# Or run the test suite with live data
uv run --env-file .env pytest tests/test_investigator_live.py -v -sTest the LLM-based query parser in isolation:
uv run --env-file .env python -m seam_agent.assistant.query_parser# Run unit tests (no credentials needed)
uv run pytest tests/test_dynamic_tool_selector.py tests/test_investigation_config.py -v
# Run all tests with env
uv run --env-file .env pytest
# Run with verbose output
uv run --env-file .env pytest -v
# Run live integration tests (requires credentials)
uv run --env-file .env pytest tests/test_investigator_live.py -v -s# Format code
uv run ruff format src tests
# Lint
uv run ruff check src tests
# Fix lint issues automatically
uv run ruff check src tests --fix
# Type checking
uv run pyright src tests- Core investigation orchestration
- PostgreSQL database integration
- Dynamic tool selection
- Configurable investigation limits
- Admin link generation
- Quickwit log search integration
- Slack integration for triggering investigations
- Unthread integration for posting internal notes
- Timeline reconstruction with event correlation
- Provider-specific issue detection
- Proactive alerting for error patterns
Built with ๐ค by the Seam team