Skip to content

Commit c0dc300

Browse files
stuaganoclaude
andcommitted
feat: Add databricks-agents framework for building discoverable agents
Add databricks-agents, a lightweight Python framework for building discoverable AI agents on Databricks Apps. Key features: - AgentApp: FastAPI wrapper with auto-generated A2A protocol endpoints - AgentDiscovery: Workspace scanning and agent discovery - A2AClient: Agent-to-agent communication - UCAgentRegistry: Unity Catalog integration - MCPServer: Model Context Protocol support - UCFunctionAdapter: Expose UC Functions as tools The framework enables building agents with just 5 lines of code: app = AgentApp(name="my_agent", description="...", capabilities=[...]) @app.tool(description="...") async def my_tool(param: str) -> dict: ... This auto-generates: - /.well-known/agent.json (A2A protocol agent card) - /.well-known/openid-configuration (OIDC delegation) - /health (health check) - /api/mcp (MCP server) - /api/tools/* (tool endpoints) Includes: - Complete test suite - CI/CD workflows (test, publish, docs) - MkDocs documentation - 4 working examples - Apache 2.0 license Project structure: - src/databricks_agents/ - Core framework (~2000 LOC) - examples/ - Complete working examples - tests/ - Test suite - docs/ - MkDocs documentation - .github/workflows/ - CI/CD pipelines Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 52a8459 commit c0dc300

41 files changed

Lines changed: 5522 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
deploy-docs:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.11'
21+
22+
- name: Install dependencies
23+
run: |
24+
pip install mkdocs-material mkdocstrings[python] pymdown-extensions
25+
26+
- name: Build and deploy
27+
run: |
28+
mkdocs gh-deploy --force
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build-and-publish:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.11'
21+
22+
- name: Install build dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install build twine
26+
27+
- name: Build package
28+
run: |
29+
python -m build
30+
31+
- name: Check package
32+
run: |
33+
twine check dist/*
34+
35+
- name: Publish to PyPI
36+
env:
37+
TWINE_USERNAME: __token__
38+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
39+
run: |
40+
twine upload dist/*
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.10", "3.11", "3.12"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -e ".[dev]"
28+
29+
- name: Lint with ruff
30+
run: |
31+
ruff check src/
32+
33+
- name: Check formatting with black
34+
run: |
35+
black --check src/
36+
37+
- name: Type check with mypy (informational)
38+
continue-on-error: true
39+
run: |
40+
pip install mypy types-httpx
41+
mypy src/ --ignore-missing-imports
42+
43+
- name: Run tests with pytest
44+
run: |
45+
pytest tests/ -v --cov=databricks_agents --cov-report=xml --cov-report=term
46+
47+
- name: Upload coverage to Codecov
48+
uses: codecov/codecov-action@v4
49+
if: matrix.python-version == '3.11'
50+
with:
51+
file: ./coverage.xml
52+
flags: unittests
53+
name: codecov-umbrella
54+
fail_ci_if_error: false

databricks-agents/.gitignore

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
23+
# Virtual environments
24+
venv/
25+
env/
26+
ENV/
27+
.venv
28+
29+
# IDEs
30+
.vscode/
31+
.idea/
32+
*.swp
33+
*.swo
34+
*~
35+
36+
# Testing
37+
.pytest_cache/
38+
.coverage
39+
htmlcov/
40+
.tox/
41+
.hypothesis/
42+
43+
# Documentation
44+
docs/_build/
45+
site/
46+
47+
# OS
48+
.DS_Store
49+
Thumbs.db
50+
51+
# Project specific
52+
*.log
53+
.env
54+
.env.local

databricks-agents/CONTRIBUTING.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Contributing to databricks-agents
2+
3+
Thank you for your interest in contributing to databricks-agents! This project is a Databricks Labs initiative to make it easier to build discoverable AI agents on Databricks Apps.
4+
5+
## Development Setup
6+
7+
1. Clone the repository
8+
2. Install dependencies:
9+
```bash
10+
pip install -e ".[dev]"
11+
```
12+
3. Run tests:
13+
```bash
14+
pytest
15+
```
16+
17+
## Code Style
18+
19+
- Use Black for code formatting: `black src/`
20+
- Use Ruff for linting: `ruff check src/`
21+
- Line length: 100 characters (configured in `pyproject.toml`)
22+
- Type hints are encouraged for public APIs
23+
24+
## Testing
25+
26+
- Write tests for new features using pytest
27+
- Place tests in the `tests/` directory
28+
- Run tests with: `pytest tests/`
29+
- Aim for >80% code coverage
30+
31+
## Pull Requests
32+
33+
1. Fork the repository
34+
2. Create a feature branch: `git checkout -b feature/my-feature`
35+
3. Make your changes
36+
4. Add tests for new functionality
37+
5. Run tests and linting: `pytest && black src/ && ruff check src/`
38+
6. Commit with a clear message describing the change
39+
7. Push and create a pull request
40+
41+
## PR Guidelines
42+
43+
- **Clear description**: Explain what the PR does and why
44+
- **Tests included**: All new features should have tests
45+
- **Documentation updated**: Update README.md and docstrings as needed
46+
- **Small, focused changes**: One feature or fix per PR
47+
- **Passes CI**: All tests and linting must pass
48+
49+
## Areas for Contribution
50+
51+
We welcome contributions in these areas:
52+
53+
- **Unity Catalog integration**: Register agents as UC catalog objects
54+
- **MCP server support**: Add Model Context Protocol server capabilities
55+
- **Orchestration patterns**: Multi-agent coordination utilities
56+
- **RAG utilities**: Built-in vector search and retrieval patterns
57+
- **Observability**: Logging, metrics, and tracing integrations
58+
- **Documentation**: Examples, guides, and API documentation
59+
- **Testing**: Improve test coverage and test utilities
60+
61+
## Questions?
62+
63+
- Open an issue for bugs or feature requests
64+
- Start a discussion for design questions
65+
- Check existing issues and PRs before starting work
66+
67+
## Code of Conduct
68+
69+
Be respectful, inclusive, and constructive in all interactions. This is a professional community focused on building great tools together.
70+
71+
## License
72+
73+
By contributing, you agree that your contributions will be licensed under the Apache 2.0 License.

0 commit comments

Comments
 (0)