-
Notifications
You must be signed in to change notification settings - Fork 136
chore: plan 427, PR 2 of agent-first development plan #478
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
002750f
save progress
nabinchha afdf713
undo review-code skill change
nabinchha c516b40
delete status file
nabinchha 945f1a7
Merge branch 'main' into nmulepati/docs/427-agent-first-dev-pr-2
nabinchha 931022e
Merge branch 'main' into nmulepati/docs/427-agent-first-dev-pr-2
nabinchha 3b66a65
small tweaks
nabinchha b59190b
Fix 429 info
nabinchha 6b94a7a
Merge branch 'main' into nmulepati/docs/427-agent-first-dev-pr-2
nabinchha 2d71678
update workind on skill info
nabinchha 3944ec0
updates
nabinchha 2c540f9
Update architecture/overview.md
nabinchha 83dfaee
Merge branch 'main' into nmulepati/docs/427-agent-first-dev-pr-2
nabinchha 3d3fc1d
fix: correct symbol names and CLI commands in architecture docs
nabinchha 52ca33b
Merge branch 'main' into nmulepati/docs/427-agent-first-dev-pr-2
nabinchha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| ## π Summary | ||
| <!-- 1-3 sentences: what this PR does and why --> | ||
|
|
||
| ## π Related Issue | ||
| <!-- Link to the issue this addresses: Fixes #NNN or Closes #NNN --> | ||
|
|
||
| ## π Changes | ||
| <!-- | ||
| Default: a flat bullet list (delete this comment when you fill in). | ||
|
|
||
| Optional β for large or mixed PRs, group under the headings below and omit any empty section: | ||
| ### β¨ Added | ||
| ### π§ Changed | ||
| ### ποΈ Removed | ||
| ### π Fixed | ||
| --> | ||
|
|
||
| ## π§ͺ Testing | ||
| <!-- What testing was done? --> | ||
| - [ ] `make test` passes | ||
| - [ ] Unit tests added/updated | ||
| - [ ] E2E tests added/updated (if applicable) | ||
|
|
||
| ## β Checklist | ||
| - [ ] Follows commit message conventions | ||
| - [ ] Commits are signed off (DCO) | ||
| - [ ] Architecture docs updated (if applicable) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,82 @@ | ||
| # Agent Introspection | ||
|
|
||
| > Stub β to be populated. See source code at `packages/data-designer/src/data_designer/cli/`. | ||
| The agent introspection subsystem provides machine-readable CLI commands that let agents discover DataDesigner's type system, configuration state, and available operations at runtime. | ||
|
|
||
| Source: `packages/data-designer/src/data_designer/cli/commands/agent.py` and `packages/data-designer/src/data_designer/cli/utils/agent_introspection.py` | ||
|
|
||
| ## Overview | ||
| <!-- Agent CLI commands, type discovery, family specs --> | ||
|
|
||
| Agent introspection solves a specific problem: when an agent helps someone **author a dataset configuration** (columns, samplers, validators, processors, and related options), it needs an accurate catalog of what is available β including types added by installed plugins. Rather than hardcoding that knowledge or parsing source code, the agent can call `data-designer agent` commands to get structured, up-to-date information. | ||
|
|
||
| ## Key Components | ||
| <!-- Main classes, modules, entry points --> | ||
|
|
||
| ### Commands | ||
|
|
||
| All commands live under the `data-designer agent` group: | ||
|
|
||
| | Command | Purpose | | ||
| |---------|---------| | ||
| | `data-designer agent context` | Full context dump: version, paths, type catalogs, model aliases, persona state, available operations | | ||
| | `data-designer agent types [family]` | Type catalog for one or all families, with descriptions and source file locations | | ||
| | `data-designer agent state model-aliases` | Configured model aliases with usability status (missing provider, missing API key, etc.) | | ||
| | `data-designer agent state persona-datasets` | Available persona datasets with download status per locale | | ||
|
|
||
| ### FamilySpec | ||
|
|
||
| Maps a **family name** to a **discriminated union type** and its **discriminator field**: | ||
|
|
||
| | Family | Union Type | Discriminator | | ||
| |--------|-----------|---------------| | ||
| | `columns` | `ColumnConfigT` | `column_type` | | ||
| | `samplers` | `SamplerParamsT` | `sampler_type` | | ||
| | `validators` | `ValidatorParamsT` | `validator_type` | | ||
| | `processors` | `ProcessorConfigT` | `processor_type` | | ||
| | `constraints` | `ColumnConstraintT` | `constraint_type` | | ||
|
|
||
| ### Type Discovery | ||
|
|
||
| `discover_family_types` walks `typing.get_args(type_union)`, reads each Pydantic model's discriminator field annotation (must be `Literal[...]`), and builds a map of discriminator string β model class. Detects and reports duplicate discriminator values. | ||
|
|
||
| `get_family_catalog` yields the class name and first docstring paragraph for each type β enough for an agent to understand what each type does without reading source code. | ||
|
|
||
| `get_family_source_files` uses `inspect.getfile` and normalizes paths under `data_designer/` (absolute path fallback for plugin types outside the tree). | ||
|
|
||
| ### State Commands | ||
|
|
||
| Reuse the CLI's repository stack: | ||
| - **Model aliases**: `ModelRepository` + `ProviderRepository` + `get_providers_with_missing_api_keys` to report usability status (configured, missing provider, missing API key) | ||
| - **Personas**: `PersonaRepository` + `DownloadService` for locale availability and download status | ||
|
|
||
| ### Error Handling | ||
|
|
||
| `AgentIntrospectionError` carries a `code`, `message`, and `details` dict. Commands catch these and output structured error information to stderr with exit code 1, making errors parseable by agents. | ||
|
|
||
| ### Command Registration | ||
|
|
||
| `AGENT_COMMANDS` in `agent_command_defs.py` drives both the lazy Typer command map in `main.py` and `get_operations()` in introspection. This single source of truth ensures the operations table in `agent context` output stays in sync with the actual commands. | ||
|
|
||
| ## Data Flow | ||
| <!-- How data moves through this subsystem --> | ||
|
|
||
| ``` | ||
| Agent calls: data-designer agent types columns | ||
| β Typer dispatches to agent.get_types("columns") | ||
| β FamilySpec maps "columns" β ColumnConfigT union | ||
| β discover_family_types walks union members | ||
| β get_family_catalog extracts names + descriptions | ||
| β get_family_source_files resolves source locations | ||
| β Formatted output returned to agent | ||
| ``` | ||
|
|
||
| ## Design Decisions | ||
| <!-- Why things are the way they are --> | ||
|
|
||
| - **Declarative type discovery from Pydantic unions** rather than maintaining a separate type inventory. The discriminated unions are the source of truth for what types exist (including plugins), so introspection reads directly from them. | ||
| - **Structured errors with codes** enable agents to handle failures programmatically (retry, report, escalate) rather than parsing human-readable error messages. | ||
| - **Single command registration source** (`AGENT_COMMANDS`) prevents the operations table from drifting out of sync with actual CLI commands. | ||
| - **Source file resolution** helps agents navigate to implementations when they need to understand a type's behavior, not just its existence. | ||
|
|
||
| ## Cross-References | ||
| <!-- Links to related architecture docs --> | ||
| - [System Architecture](overview.md) | ||
| - [CLI](cli.md) | ||
| - [Config Layer](config.md) | ||
|
|
||
| - [System Architecture](overview.md) β where agent introspection fits | ||
| - [CLI](cli.md) β the CLI architecture that hosts these commands | ||
| - [Config Layer](config.md) β the discriminated unions that introspection reads | ||
| - [Plugins](plugins.md) β how plugin types appear in introspection results | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.