Skip to content

Feature/graphql api v0.1#81

Merged
InftyAI-Agent merged 16 commits intoInftyAI:mainfrom
wanyingz-dis:feature/graphql-api-v0.1
Nov 20, 2025
Merged

Feature/graphql api v0.1#81
InftyAI-Agent merged 16 commits intoInftyAI:mainfrom
wanyingz-dis:feature/graphql-api-v0.1

Conversation

@wanyingz-dis
Copy link
Copy Markdown
Contributor

Add initial GraphQL API server (schema, types, router, placeholder resolvers)

Summary

This PR introduces the initial GraphQL API layer for the AlphaTrion dashboard.
It provides the minimal end-to-end structure required for the frontend to begin querying data through a unified GraphQL endpoint.

This includes:

  • GraphQL schema (Projects-- Experiments -- Trials-- Runs -- Metrics)
  • Strawberry types
  • GraphQL resolvers (currently returning placeholder values)
  • GraphQL router integrated into FastAPI (/graphql)
  • Dependency updates in pyproject.toml and uv.lock
  • Cleanup of .gitignore

This PR intentionally focuses on API structure and scaffolding instead of full backend logic.

What This PR Adds

1. GraphQL Schema + Types

  • Defines all objects needed for the dashboard:
    • Project
    • Experiment
    • Trial
    • Run
    • Metric
  • Adds list + detail queries for each object.

2. Resolver Class

Resolvers currently return placeholder empty lists or None.
This allows:

  • API introspection to work
  • The endpoint to function end-to-end
  • The frontend to start integrating with the schema structure

Database integration (SQLAlchemy -- > Postgres) will come in a later PR.

3. FastAPI Integration

  • Adds a /graphql endpoint using GraphQLRouter.
  • Ensures GraphQL Playground loads correctly.

4. Dependency Updates

  • Adds required FastAPI and Strawberry packages.
  • Regenerates uv.lock using uv.

5. Repository Cleanup

  • Updates .gitignore to exclude .venv, .python-version, and dev-only folders.

Run the GraphQL API server:

uv run uvicorn alphatrion.main:app

@InftyAI-Agent InftyAI-Agent added needs-triage Indicates an issue or PR lacks a label and requires one. needs-priority Indicates a PR lacks a label and requires one. do-not-merge/needs-kind Indicates a PR lacks a label and requires one. labels Nov 19, 2025
@kerthcet
Copy link
Copy Markdown
Member

/assign

Copy link
Copy Markdown
Member

@kerthcet kerthcet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM.
Thanks @wanyingz-dis

Comment thread .gitignore Outdated
python-version
testenv/
ptest/
.python-version No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate

Comment thread alphatrion/graphql/resolvers.py Outdated
class GraphQLResolvers:

@staticmethod
def get_projects() -> List[Project]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename similar function names to def list_xxx()? Easy to tell.

Comment thread alphatrion/main.py Outdated

if __name__ == "__main__":
print("Hello, AlphaTrion!")
import uvicorn
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not import in the head?

Comment thread alphatrion/main.py
# root endpoint for testing
@app.get("/")
def root():
return {"message": "AlphaTrion API running"}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation will be in another PR right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kerthcet for your review and feedback, Yes, implementation will come in the next PR.
This one only sets up the schema & scaffolding.

Comment thread alphatrion/graphql/types.py Outdated
@strawberry.type
class Metric:
id: strawberry.ID
trial_id: strawberry.ID
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess trial_id is not needed here because usually we query the metric via trial_id. We can add it back if needed.

@kerthcet
Copy link
Copy Markdown
Member

You can run make format to reproduce the lint error.

@kerthcet
Copy link
Copy Markdown
Member

We can remove the test_main for now, once we have the api, we can add integration-tests at that time.

@kerthcet
Copy link
Copy Markdown
Member

/lgtm
/approve
/kind feature

part of #59

@InftyAI-Agent InftyAI-Agent added lgtm Looks good to me, indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. feature Categorizes issue or PR as related to a new feature. labels Nov 20, 2025
@InftyAI-Agent InftyAI-Agent removed the do-not-merge/needs-kind Indicates a PR lacks a label and requires one. label Nov 20, 2025
@InftyAI-Agent InftyAI-Agent merged commit 16135bf into InftyAI:main Nov 20, 2025
24 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. feature Categorizes issue or PR as related to a new feature. lgtm Looks good to me, indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a label and requires one. needs-triage Indicates an issue or PR lacks a label and requires one.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants