Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
run: pip install httpx==0.28.1 pytest pytest-asyncio anyio pyyaml fastapi "pydantic>=2.0,<3.0" uvicorn python-multipart asyncpg langfuse redis

- name: Run Unit Tests
run: CONFIG_PATH=router/config.yaml PYTHONPATH=.:router pytest --ignore=test_agy_behavior.py --ignore=test_agy_tiers.py
run: CONFIG_PATH=router/config.yaml PYTHONPATH=.:router pytest --ignore=tests/test_agy_behavior.py --ignore=tests/test_agy_tiers.py

- name: Run Breaker Verification
run: python3 verify_breaker.py
run: python3 scripts/verification/verify_breaker.py

- name: Run Integration Verification
run: python3 test_a2_verify.py
run: python3 tests/test_a2_verify.py
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,26 @@ All configurations, automation scripts, and databases are self-contained within
│ ├── agy_proxy.py # 3-tier agy fallback with session continuation
│ ├── circuit_breaker.py # Exponential cooldown breaker for agy proxy
│ └── memory_mcp.py # MCP bridge server for Goose memory integration
├── scripts/
│ └── backup.sh # Database backup with pg_isready retry logic
├── scripts/ # Automation, maintenance, and verification scripts
│ ├── backup.sh # Database backup with pg_isready retry logic
│ ├── host_agy_daemon.py # Real-time PTY-based streaming daemon for agy
│ ├── sync_gemini_token.py # Extraction/sync script for keyring credentials
│ ├── get_pr_status.py # PR state helper
│ ├── watch_quota.sh # Quota reset watcher
│ ├── test_quota_reset.sh # Quota reset test simulator
│ └── verification/ # Routing & cooldown verification tests
│ ├── verify_breaker.py # Circuit breaker verification
│ └── ...
├── tests/ # Integration & unit test suite
│ ├── test_agy_tiers.py # agy proxy model tier test suite
│ ├── test_classifier_accuracy.py # Classifier accuracy benchmark
│ └── ...
├── backups/ # Timestamped PostgreSQL dumps + config snapshots
├── valkey-data/ # [Git Ignored] Persistent memory volumes for Valkey Cache
├── postgres-data/ # [Git Ignored] Persistent tables for PostgreSQL
├── clickhouse-data/ # [Git Ignored] Persistent traces for Langfuse v3
├── valkey-lf-data/ # [Git Ignored] Persistent job queues for Langfuse v3
├── minio-data/ # [Git Ignored] S3-compatible event storage for Langfuse v3
├── test_agy_tiers.py # agy proxy model tier test suite
└── test_classifier_accuracy.py # Classifier accuracy benchmark
└── minio-data/ # [Git Ignored] S3-compatible event storage for Langfuse v3
```

---
Expand Down Expand Up @@ -719,15 +729,15 @@ agy --print "First message" # creates conversation
agy --conversation <id> --print "Follow-up" # continues same session

# Run the full tier test suite
python3 test_agy_tiers.py
python3 tests/test_agy_tiers.py
```

### 9b. Streaming & Concurrency Optimizations

To support production agentic environments (such as `goose-cli` or similar tools) that require low-latency streaming and high concurrent throughput, the following components were introduced:

#### 1. Real-Time PTY-Based Streaming Bridge for `agy` Response
To support low-latency streaming for agent clients (such as `goose-cli`), the host-side `host_agy_daemon.py` runs `agy --print` inside a pseudo-terminal (PTY) using `pty.openpty()`.
To support low-latency streaming for agent clients (such as `goose-cli`), the host-side `scripts/host_agy_daemon.py` runs `agy --print` inside a pseudo-terminal (PTY) using `pty.openpty()`.
* Running `agy` inside a PTY disables internal buffering, forcing it to write generated characters/lines progressively.
* The host daemon streams these chunks in real-time as `application/x-ndjson` lines to the Triage Router.
* The Triage Router immediately transforms these incoming chunks into standard OpenAI Server-Sent Event (SSE) packets and yields them to the client. This results in a true, low-latency stream with minimal Time-To-First-Token (TTFT) and eliminates synthetic buffering.
Expand Down
131 changes: 0 additions & 131 deletions router/test_memory_mcp.py

This file was deleted.

10 changes: 10 additions & 0 deletions router/tests/test_agy_proxy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
import sys
from pathlib import Path

# Dynamic project root discovery
root = Path(__file__).resolve()
while root.parent != root and not (root / ".git").exists():
root = root.parent
sys.path.insert(0, str(root))
sys.path.insert(0, str(root / "router"))

from unittest.mock import patch, MagicMock
from router.agy_proxy import _wrap_response, _is_quota_exhausted

Expand Down
Loading