Skip to content

feat: add streaming server and GitHub toolset#4

Merged
bordumb merged 22 commits intomainfrom
feat/server-github-toolset
Jan 25, 2026
Merged

feat: add streaming server and GitHub toolset#4
bordumb merged 22 commits intomainfrom
feat/server-github-toolset

Conversation

@bordumb
Copy link
Contributor

@bordumb bordumb commented Jan 24, 2026

Summary

  • Streaming Server: Production-ready SSE/WebSocket server for any Bond agent
  • GitHub Toolset: 6 tools to browse and analyze any GitHub repository
  • Composite Dependencies: BondToolDeps enables using multiple toolsets together

New Modules

bond.server

from bond import BondAgent
from bond.server import create_bond_server

agent = BondAgent(name="assistant", instructions="...", model="openai:gpt-4o")
app = create_bond_server(agent)
# uvicorn main:app

Endpoints:

  • POST /ask - Start session, get session_id
  • GET /stream/{session_id} - SSE stream
  • WS /ws - WebSocket bidirectional
  • GET /health - Health check

bond.tools.github

from bond.tools import github_toolset, GitHubAdapter

agent = BondAgent(
    toolsets=[github_toolset],
    deps=GitHubAdapter(token=os.environ["GITHUB_TOKEN"]),
)
await agent.ask("What's in the facebook/react repo?")

Tools: github_get_repo, github_list_files, github_read_file, github_search_code, github_get_commits, github_get_pr

BondToolDeps

from bond.tools import BondToolDeps, github_toolset, githunter_toolset

deps = BondToolDeps(github_token=os.environ["GITHUB_TOKEN"])
agent = BondAgent(toolsets=[github_toolset, githunter_toolset], deps=deps)

Files Changed

New:

  • src/bond/server/ - Server module (5 files)
  • src/bond/tools/github/ - GitHub toolset (7 files)
  • src/bond/tools/_composite.py - Composite dependencies
  • docs/guides/streaming-server.md - Server integration guide
  • docs/guides/github.md - GitHub toolset guide
  • tests/unit/server/ - Server tests
  • tests/unit/tools/github/ - GitHub tests

Modified:

  • pyproject.toml - Added httpx dep, server optional deps
  • src/bond/__init__.py - Lazy import for server
  • src/bond/tools/__init__.py - Export new toolsets
  • mkdocs.yml - Navigation updates

Test plan

  • pytest tests/unit/server/ tests/unit/tools/github/ - 36 tests pass
  • pytest tests/ - All 219 tests pass
  • ruff check - No linting errors
  • Manual: Run server with uvicorn, connect from UI

🤖 Generated with Claude Code

bordumb and others added 22 commits January 24, 2026 21:48
Add production-ready infrastructure for Bond agents:

## Server Module (bond.server)
- SSE and WebSocket streaming endpoints
- Session management with history
- CORS support and configuration
- Health check endpoint

## GitHub Toolset (bond.tools.github)
- 6 tools: get_repo, list_files, read_file, search_code, get_commits, get_pr
- GitHubAdapter with rate limit handling
- GitHubProtocol for backend flexibility

## Composite Dependencies (BondToolDeps)
- Single deps object for multiple toolsets
- Lazy adapter initialization
- Supports GitHub + GitHunter together

## Documentation
- guides/streaming-server.md - SSE/WebSocket integration
- guides/github.md - GitHub toolset usage

## Tests
- 36 new tests for server and GitHub modules

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Option 1: Using bond.server with wrapper endpoint for UI
- Option 2: Custom SSE endpoint (simpler)
- SSE event format reference
- Future roadmap for full session-based integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add GitHub toolset to test server with BondToolDeps
- Fix SSE streaming race condition by using synchronous queue operations
- Fix tool event emission from PydanticAI message history
- Add justfile for easy demo setup (just demo, just demo-stop, etc.)
- Fix useBondServer complete event handling order
- Add rate limit handling instructions to agent
- Reduce max_retries to prevent rate limit loops

The tool visualization now works correctly - tool blocks show
arguments and results similar to the demo mode.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- ruff format: now auto-formats instead of --check
- ruff lint: now uses --fix to auto-fix fixable issues
- mypy: unchanged (cannot auto-fix type errors)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix mkdocs --strict warnings:
- Create docs/api/server.md for server module API reference
- Add GitHub Toolset section to docs/api/tools.md
- Add Server to mkdocs.yml navigation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bordumb bordumb merged commit 3a2789b into main Jan 25, 2026
5 checks passed
@bordumb bordumb deleted the feat/server-github-toolset branch January 25, 2026 00:35
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.

1 participant