Skip to content

Conversation

@sanzog03
Copy link
Collaborator

@sanzog03 sanzog03 commented Jan 13, 2026

Summary 📝
Porting a CMR agent created through CARE process using the openai agent platform into the AKD as an extension.

Details
A new CMR agent is created going through the CARE process in openai agent creation platform. The provided agent code is ported to AKD as extension for its easy usability on the AKD backend. To easily port the generated code with minimal intervention to it, the code is copied to get_response_async method that is extended from the base agent.

Usage

            from akd_ext.agents.cmr_care_agent import (
                CMRCareAgent,
                CMRCareAgentConfig,
                CMRCareInputSchema,
                CMRCareOutputSchema
            )

            # Initiate Agent
            config = CMRCareAgentConfig()
            agent = CMRCareAgent(config=config, debug=True)

            # Curate input
            test_input = CMRCareInputSchema(input_as_text='Find datasets related to sea surface temperature in the Pacific Ocean')

            # Run agent
            result = await agent.arun(test_input)

            # Display results
            print(f"\nFound {len(result.dataset_concept_ids)} dataset(s):\n")

Tested Changes

  • Test cases to find the dataset concept ids using the search query. test with usage

@sanzog03 sanzog03 requested a review from NISH1001 January 13, 2026 04:58
@NISH1001
Copy link
Collaborator

@sanzog03 Thanks for working on this. Couple of things:

  • Could you put the PR description in a way it's way more like documentation/elaborate. Eg: What are the major changes. What are the minor changes. IF there's any Usage example for the component, provide that usage section as well.
  • The naming conventions: for all the base, i'd encourage to use _base.py pattern we use and some of the open source projects follow that convention as well.

Example PR

I'd create a PR template that will be easier to fill in next time.

Copy link
Collaborator

@NISH1001 NISH1001 left a comment

Choose a reason for hiding this comment

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

Thank you for quickly having this PR. I have added a detail feedback, particularly how we want to design the openaisdk porting.

Comment on lines +8 to +13
class OpenAIBaseAgentConfig(BaseAgentConfig):
"""Configuration for OpenAI agents based AKD Agents.
This configuration extends BaseConfig to provide OpenAI-specific
settings for agents built with OpenAI's platform agent builder.
"""
pass
Copy link
Collaborator

@NISH1001 NISH1001 Jan 13, 2026

Choose a reason for hiding this comment

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

If this doesn't add anything new fields, maybe just removing the config will be better. Or
Add tracing_params: dict[str, Any]? I'd also add reasoning_effort as part of the OpenAIBaseAgentConfig and probably mcp as well.

class OpenAIBaseAgentConfig(BaseAgentConfig):
  """Configuration for OpenAI agents based AKD Agents.
    This configuration extends BaseConfig to provide OpenAI-specific
    settings for agents built with OpenAI's platform agent builder.
  """
reasoning_effort: Literal["low", "medium", "high",...] = Field(....)
tracing_params: dict[str, Any] | None = Field(default_factory=dict, description="Paramters that can be passed to OpenAI Agents SDK for traceability in the platform API)

Comment on lines +22 to +33
input_schema = InputSchema
output_schema = OutputSchema

def __init__(self,
config: OpenAIBaseAgentConfig | None = None,
debug: bool = False
) -> None:
super().__init__(config=config, debug=debug)
self.config = config

async def _arun(self, params: InSchema, **kwargs) -> OutSchema:
raise NotImplementedError("Subclasses must implement this method.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can remove this boilerplate as akd.agents._base.BaseAgent already does it. We also don't need to do self.config=config because the base meta class already handles this.

What we can do is:

class OpenAIBaseAgent[
  InSchema: InputSchema,
  OutSchema: OutputSchema,
](BaseAgent):
  """Base class for OpenAI agents.
  Any agent generated from the openai's platform agent builder should inherit from this class.
  """

  config = OpenAIBaseAgentConfig
  
  def __init__(self,
      config: OpenAIBaseAgentConfig | None = None,
      debug: bool = False
    ) -> None:
    super().__init__(config=config, debug=debug)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please change the base filename to akd_ext.agents._base.py. This will make it consistent in naming convention.

Comment on lines +10 to +11
class CMRCareAgentConfig(OpenAIBaseAgentConfig):
pass
Copy link
Collaborator

@NISH1001 NISH1001 Jan 13, 2026

Choose a reason for hiding this comment

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

Do we need this now? IF it's just a dummy, then we can in fact just remove the config.

Normally, I'd inherit the config if there's extra things that are being added. But in this case OpenAIBaseAgentConfig or BaseAgentConfig handles it. Or when I want to override some field values. Eg: reasoning_effort could be set to medium by default for CMR while the base will default to low.

Base on the comment in another thread, I think this can take advantage of just overriding system_prompt with CARE prompt we have.

This way, we can make sure Openai agents SDK is properly ported for configurability.


class CMRCareInputSchema(InputSchema):
"""Input schema for CMR Care Agent."""
input_as_text: str = Field(..., description="Input query")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rename input_as_text to just maybe query to have consistent input field across everything. And reflect the changes accordingly. This will make consistent for any agents like we have in akd core.


nasa_cmr_data_search_agent = Agent(
name="NASA CMR Data Search Agent",
instructions="""ROLE
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move this prompt to CMRAgentConfig.system_prompt.

Since akd.agents._base.BaseAgentConfig.system_prompt already exists. So CMRCareAgentConfig.system_prompt could be overridden from this. It will make it proper in a way that if we have newer care version for CMR which would be just change in system prompt and instructions TBH. So, CMRCareAgentConfig.system_prompt is a proper place.


# Main code entrypoint
async def run_workflow(workflow_input: WorkflowInput):
with trace("Workshop Data agent"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

the name could come from tracing_params

class OutputAgentSchema(BaseModel):
dataset_concept_ids: list[str]

nasa_cmr_data_search_agent = Agent(
Copy link
Collaborator

Choose a reason for hiding this comment

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

also if we want to properly generalize theopenaibase agent then...the Agent object could in fact be abstracted out within the base class as self.agent or something.

Comment on lines +467 to +468
"__trace_source__": "agent-builder",
"workflow_id": "wf_6949ac60e244819082e6ed0bf22ccead09adcd4d789b8c37"
Copy link
Collaborator

Choose a reason for hiding this comment

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

again, this can come from self.config.tracing_params

})
)

conversation_history.extend([item.to_input_item() for item in output_agent_result_temp.new_items])
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should make use of conversation tracking we have inBaseAgent. Since memory (see) is abstracted in base...we can have OpenAIBaseAgent.memory as list of dict. Looking a tit. IT does seems like it's a list.

@sanzog03 sanzog03 requested review from muthukumaranR and removed request for muthukumaranR January 13, 2026 14:59
@NISH1001 NISH1001 closed this Jan 13, 2026
@NISH1001 NISH1001 deleted the feature/open_ai_agents_port_to_akd1 branch January 13, 2026 15:23
@sanzog03 sanzog03 restored the feature/open_ai_agents_port_to_akd1 branch January 13, 2026 16:42
@sanzog03 sanzog03 reopened this Jan 13, 2026
source = { editable = "." }
dependencies = [
{ name = "akd" },
{ name = "deepeval" },
Copy link
Collaborator

Choose a reason for hiding this comment

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

no need to install deepeval for akd-ext.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove deepeval now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants