-
Notifications
You must be signed in to change notification settings - Fork 1.1k
AI Agent Framework and ChatGXY 2.0 #21434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
lib/galaxy/agents/tools.py
Outdated
| Returns: | ||
| List of tool categories | ||
| """ | ||
| return [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to see these agents come in one at a time after the framework - I would feel better critiquing them in that context. If the cost of getting the infrastructure in is this though - I guess I'm fine - I would love to see progress and we could clean this up later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's totally fine, we just have to have some set of things to test initially. Plan is to prune it down and open separate PRs.
|
Binary file addedBIN +24.8 MB I think this is still in and the PR description says it is out? |
It is for now so folks don't have to build it. It'll be rebased out (probably along with the agent itself, to be included separately) |
e65c242 to
643ec7c
Compare
|
I've pushed 967ba75 that makes some changes to the tests. Please feel free to rebase or squash it as much as you'd like. I've removed some tests to get things green but I've tracked them in #21437. There are many parts of the code that do unqualified imports of pydantic-ai - I think it really needs to be a hard dependency. For instance pytest collection fails the way things are now (https://github.com/galaxyproject/galaxy/actions/runs/20148161399/job/57834129303?pr=21434). Also I needed to install some pytest asyncio library to get these tests to run that will probably need to be dev dependency - I guess CI will make that clear. I think the remaining tasks:
|
bcce7d5 to
306dae4
Compare
- Move unit tests out of integration test file and into test/unit. - Move remaining "API" tests into test/integration because they use ``self.app`` and mock out the API - they are what we would call integration tests in Galaxy. - Have unit and integration tests use the same common environment variables all now prefixed with GALAXY_TEST_ (we do this for object store stuff). - Small tweak to orchestrator.py to make the unit tests pass. - Clean up the mocked tests method to work cleanly without any infrastructure - some tests that used the LLM had gotten in there. Tracked the tests I removed as galaxyproject#21437.
Changed the agent endpoints to return proper AgentResponse types instead of Dict[str, Any], which gives us typed responses in the client. Updated execute_agent in the manager to return the schema object directly. Fixed type assertion in GalaxyWizard for accessing metadata.error.
route_and_execute now returns AgentResponse instead of dict, fixed the dict-style access that was breaking agent queries. Also added unused-ignore to type comments so mypy passes whether or not pydantic_ai is installed.
Added pytestmark_live_llm to unittest_utils for skipping live LLM tests. Added importorskip for pydantic_ai in unit tests so they skip gracefully when the optional dependency isn't installed.
- Add get_agent callable to GalaxyAgentDependencies to avoid circular imports when agents call other agents via tool functions. A bit more contrived than the late import it replaces, but may be strictly cleaner architecturally. - Replace regex-based agent_type derivation with explicit class attribute requirement for clarity - Improve _validate_model_capabilities docstring
Tool-rec code was too entangled across commits to cleanly rebase out, so just deleting the files and updating references instead. The agent-based-ai-tool-rec branch has the full implementation for a follow-up PR.
The GTN agent was extracted to agent-based-ai-gtn branch previously, but references remained in tests and prompts. Cleaning those up now.
Move pydantic-ai from conditional to required dependencies since the agents code imports it unconditionally.
Replace str(e) in user-facing responses with generic error messages. The detailed exception info is still logged server-side for debugging.
Fixes protobuf version conflict for Python 3.9 (temporalio requires protobuf<6) and picks up a few minor version bumps.
Since pydantic-ai is now a required dependency, remove all the HAS_PYDANTIC_AI conditional checks and simplify the imports. Also fix ModelRequest/ModelResponse construction to use proper parts-based API.
Use proper pydantic-ai types and APIs, fix list typing in chat history, correct Agent.run_sync() usage. Add generic type parameters to Agent class attributes and fix provider variable naming in base.py.
Match base class Agent[GalaxyAgentDependencies, Any] signature. Output types vary at runtime based on model structured output support.
504df8d to
4b79efd
Compare
7153967 to
80c1652
Compare
31510eb to
b73e2e8
Compare
Pull Request: AI Agent Framework for Galaxy
Summary
This PR introduces an AI-powered multi-agent framework for Galaxy. The focus is on establishing the framework and APIs - the agents themselves are functional but will continue to evolve, and of course we want to add more. This provides the foundation for intelligent assistance in error analysis, tool recommendations, custom tool creation, and training material discovery. This is NOT meant to be merged as-is -- we want to iterate on the framework and basic agents with a wider audience and this will likely be trimmed down prior to merge. The GTN agent works well and is useful, but I don't love the deployment mechanism and we want to use chatgxy-materials embeddings (likely) anyway, which can happen in a separate branch.
Key Points
/api/chat) and direct programmatic access (/api/ai/agents/*) endpointsWhat's Included
Framework Components
lib/galaxy/agents/base.py- Base agent classes with pydantic-ai integrationlib/galaxy/agents/registry.py- Dynamic agent registration and lookuplib/galaxy/managers/agents.py- Centralized AgentService for executionlib/galaxy/schema/agents.py- Pydantic API schemasAPI Endpoints
GET /api/ai/agents- List available agentsPOST /api/ai/agents/query- Unified query with auto-routingPOST /api/ai/agents/error-analysis- Direct error analysisPOST /api/ai/agents/tool-recommendation- Direct tool recommendationsPOST /api/ai/agents/custom-tool- Direct custom tool creation/api/chatfor ChatGXYInitial Agents (5)
UI Integration
Configuration
What's NOT Included (Future Work)
Testing
To make this easy, we plan to deploy on test and will allow folks to primarily exercise it that way.
There is a start of a comprehensive pytest suite with mocked and live LLM modes
mypy and lint checks passing
Tested with claude (sonnet and haiku) and local LLMs via LiteLLM
Notes
gtn_search.db) needs to be built at deployment time - not included in repo (well, it is now, as John noticed, but it won't be)