Skip to content

Conversation

@jsntsay
Copy link
Member

@jsntsay jsntsay commented Oct 23, 2025

Summary

LLMs tend to be very poor at parsing long or complex JSON objects. This plugin uses the JSON Processor component from the Agent Lifecycle Toolkit to detect long JSON responses and then parses long responses using a given query.

Notes

This PR adds the ALTKJsonProcessor plugin as a native plugin. An optional dependency to the agent-lifecycle-toolkit package in pypi is added as a optional dependency group. There is a dev dependency conflict with pyre-check due to its hard dataclasses-json==0.5.7 dependency.

watsonx:
wx_api_key: "" # optional, can define WX_API_KEY instead
wx_project_id: "" # optional, can define WX_PROJECT_ID instead
wx_url: "https://us-south.ml.cloud.ibm.com"
Copy link
Collaborator

@terylt terylt Oct 23, 2025

Choose a reason for hiding this comment

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

Is each section of the providers required? or optional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Optional, I can mark it as such.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We may not want to add this into the config.yaml by default as it will require the optional requirement of altk to be always need to be added.

Copy link
Member Author

Choose a reason for hiding this comment

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

Even if the plugin is disabled? What would be the right thing to do then? Separate config.yaml in the plugin directory?

Copy link
Collaborator

Choose a reason for hiding this comment

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

what are the implications of removing pyre-check when altk isn't installed? Do all the tests pass?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's supposed to be used in linting but as far as I can tell the current linter list doesn't use it:

LINTERS := isort flake8 pylint mypy bandit pydocstyle pycodestyle pre-commit \
(I'm assuming pyrefly is replacing it)

@crivetimihai
Copy link
Member

Must Fix

  • Add error messages (lines 80-100 just throw bare exceptions)
  • Fix README (remove .env stuff, add query examples)
  • Add basic tests
  • Fix manifest: tool_post_hooktool_post_invoke
  • Check length before parsing JSON (perf)

Should Fix

  • Validate empty jsonprocessor_query
  • Explain why pyre-check was removed
  • Warn about LLM API costs

@jsntsay jsntsay force-pushed the altk-json-plugin branch 2 times, most recently from 99da2de to 29c9fab Compare October 27, 2025 15:53
@jsntsay
Copy link
Member Author

jsntsay commented Oct 27, 2025

Addressed feedback in the following ways:

  • More descriptive error messages added for the provider initialization section
  • README more descriptive, with the .env stuff removed, more descriptions of how to configure the LLM provider, example queries, discussion of LLM costs, and testing.
  • Added unit test in tests/unit/mcp_gateway/plugins/plugins/altk_json_processor
  • Fixed manifest
  • Now checking length before checking if response is JSON
  • Made clear in config that LLM provider sections are optional
  • Validates empty jsonprocessor_query via providing an empty string default

Explain why pyre-check was removed:
pyre-check does not seem to actually be used in any of the linting (see Makefile) and conflicts with the agent-lifecycle-toolkit library due to its hard dataclasses-json==0.5.7 dependency. pyre-check also has been superseded by pyrefly which is what is currently being used during linting. I didn't add it back as an optional dependency because uv complains since it checks all options. I can add the optional dependency if necessary though.

@crivetimihai crivetimihai merged commit a5a24f7 into IBM:main Oct 28, 2025
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants