[design] Class-oriented authoring API for the Agenta SDK (POC)#4627
Draft
mmabrouk wants to merge 3 commits into
Draft
[design] Class-oriented authoring API for the Agenta SDK (POC)#4627mmabrouk wants to merge 3 commits into
mmabrouk wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Today users write evaluators and applications by decorating plain functions. Schemas are inferred from function signatures at runtime, and the settings/inputs/outputs contracts are untyped dicts. This makes it hard to see what a workflow expects at a glance, and means typos in column names or config keys fail deep inside an evaluation run rather than at definition time.
This PR proposes a class-oriented authoring model as an alternative. None of the code in this PR runs. It is a design POC that shows what the developer experience could look like.
What this adds
Eight annotated example files under
docs/designs/class-based-sdk/:The core pattern. A class IS the workflow. You declare three inner Pydantic models and implement one method:
The three Pydantic models compile directly to
JsonSchemas.parameters/inputs/outputsin the existingWorkflowRevisionData. The class is a typed front-end over the workflow data model, not a parallel system. Everything underneath (middleware chain, handler registry, tracing, upsert, serving) reuses the current engine.Framework adapters (
06_framework_adapters.py). Three tiers for teams already using OpenAI Agents SDK, Pydantic AI, or LangGraph:run()from parameters.ag.ext.openai_agents.Application, implementbuild(parameters), the base runs it.ag.Application.from_agent(existing_agent). AnAgentAdapterport extracts Parameters/Inputs/Outputs from the agent object without mutating it.Config-only workflows (
07_config_only.py).ag.Configurationhas Parameters but no handler. It is a versioned, deployable config store (prompts, routing tables, rubrics) that any service can pull withafetch(environment="production"). Generalizes prompt management without a special-case API.Testsets as classes (
08_testsets.py). ACaseinner model becomes the column schema.ag.aevaluatecan check compatibility between testset columns and application/evaluator inputs before running anything, so a missing column raises at submit time rather than after 200 LLM calls.Serving (
05_serve.py). Each class exposes a standardAPIRouterwith typed/invokeand/inspectendpoints. You mount it withapp.include_routerlike any FastAPI router. No custom registration call.Notes
This is purely a design document to spark discussion. The
ag.Application,ag.Evaluator,ag.Configuration,ag.Testset, and related methods do not exist yet. The main question for review is whether the proposed surface feels right before any implementation starts.The implementation path (how classes map onto
WorkflowRevisionData, the ~20-line seam change inauto_workflow, what new files would live insdk/authoring/) is sketched indocs/designs/class-based-sdk/README.md.