Repository navigation
feat: add plugin framework #1352
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
+3,283
−48
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ac25825
feat(plugins): add plugin interfaces, hook types and SequentialPlugin…
mykytanetipa 5b896c1
feat(server): run plugin hooks in DefaultRequestHandlerV2
mykytanetipa 114e781
feat(client): run plugin hooks in BaseClient
mykytanetipa 8a22fbf
test: cover plugins over JSON-RPC, HTTP+JSON, gRPC and v0.3
mykytanetipa 07b8ae0
refactor(server): merge plugin and default push delivery paths
mykytanetipa 7912da8
refactor: drop telemetry-only transport metadata from the plugin PR
mykytanetipa f50a7fc
refactor(client): pass plugin RPC names at each call site
mykytanetipa d8ab490
refactor(server): let the push sender own its plugin manager
mykytanetipa 1b310a9
Merge branch 'main' into feat/a2a-plugins
mykytanetipa a6ed492
refactor(plugins): rename server and client hooks
mykytanetipa 13505d5
chore: allow PLW in spell check
mykytanetipa 1a0c5b9
Merge branch 'main' into feat/a2a-plugins
mykytanetipa 7f0c242
refactor(plugins): use the client method names for plugin hooks
mykytanetipa 1be722a
Merge remote-tracking branch 'origin/main' into feat/a2a-plugins
mykytanetipa 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| """Plugins: hooks into the A2A client and `DefaultRequestHandlerV2`. | ||
|
|
||
| Example: | ||
| from a2a import plugins | ||
|
|
||
| class TaskAudit(plugins.TaskObserverPlugin): | ||
| name = 'task-audit' | ||
|
|
||
| async def on_task_event(self, info: plugins.TaskEventInfo) -> None: | ||
| print(info.task_id, info.from_state, '->', info.to_state) | ||
|
|
||
| plugins.set_global(plugins.sequential(TaskAudit())) | ||
| # Create DefaultRequestHandlerV2 and clients after this point. | ||
| """ | ||
|
|
||
| from a2a.plugins.base import ( | ||
| ClientPlugin, | ||
| CompletePlugin, | ||
| ExecutionPlugin, | ||
| Plugin, | ||
| PushPlugin, | ||
| ServerPlugin, | ||
| TaskObserverPlugin, | ||
| ) | ||
| from a2a.plugins.manager import ( | ||
| PluginManager, | ||
| SequentialPluginManager, | ||
| get_global, | ||
| sequential, | ||
| set_global, | ||
| ) | ||
| from a2a.plugins.types import ( | ||
| ClientRequest, | ||
| ClientResponse, | ||
| PushRequest, | ||
| PushResult, | ||
| ServerRequest, | ||
| ServerResponse, | ||
| TaskEventInfo, | ||
| ) | ||
|
|
||
|
|
||
| __all__ = [ | ||
| 'ClientPlugin', | ||
| 'ClientRequest', | ||
| 'ClientResponse', | ||
| 'CompletePlugin', | ||
| 'ExecutionPlugin', | ||
| 'Plugin', | ||
| 'PluginManager', | ||
| 'PushPlugin', | ||
| 'PushRequest', | ||
| 'PushResult', | ||
| 'SequentialPluginManager', | ||
| 'ServerPlugin', | ||
| 'ServerRequest', | ||
| 'ServerResponse', | ||
| 'TaskEventInfo', | ||
| 'TaskObserverPlugin', | ||
| 'get_global', | ||
| 'sequential', | ||
| 'set_global', | ||
| ] |
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.