Skip to content

Conversation

@Ilevk
Copy link
Contributor

@Ilevk Ilevk commented Jul 29, 2025

Description

  • Added coinbase-agentkit-pydantic-ai extensions in python/framework-extensions/pydantic-ai
  • Provides get_pydantic_ai_tools() funtions to provide AgentKit actions as PydanticAI Tool
    • Extract information from AgentKit Actions to match the annotations / schema required by pydantic ai's tools.
  • Added an example using PydanticAI agent.
    • python/examples/pydantic-ai-cdp-server-chatbot.py
  • Follows patterns like langchain, openai-agents-sdk, strands.
  • Closed: Add Framework-extension for PydanticAI #775

With this PR, developers building agents using the Pydantic AI framework will now be able to implement Based Agents with AgentKit.

Tests

Chatbot: python/examples/pydantic-ai-cdp-server-chatbot.py
Network: Base Sepolia
Setup: Check Balance, and tools schema.

Prompt: How much ETH do I have?
Output You have approximately 0.1916 ETH in your wallet.
-------------------

Prompt: I'd like to know what tools you have.
Output: I can help you interact with on-chain functions, such as requesting faucet funds, swapping tokens, checking balances, transferring tokens, fetching price feeds, and more. If you need any specific tasks or information, feel free to ask, and I'll assist you accordingly!
-------------------

Prompt: Can I know the schemas of transferring tokens tool?
Output: The tool for transferring ERC20 tokens requires the following schema:

1. **amount**: The amount of the asset to transfer in wei.
2. **contract_address**: The contract address of the token to transfer.
3. **destination**: The on-chain address where to send the tokens.

If you have a specific transfer in mind, let me know, and I can assist you with it!
-------------------

Checklist

A couple of things to include in your PR for completeness:

  • Added documentation to all relevant README.md files
  • Added a changelog entry

@Ilevk Ilevk requested a review from murrlincoln as a code owner July 29, 2025 11:36
@cb-heimdall
Copy link

cb-heimdall commented Jul 29, 2025

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@github-actions github-actions bot added documentation Improvements or additions to documentation example New example agent framework extension New framework extension python labels Jul 29, 2025
@Ilevk Ilevk changed the title feat: Pydantic AI framework xcension feat: Pydantic AI framework excension Jul 29, 2025
@Ilevk Ilevk changed the title feat: Pydantic AI framework excension feat: Pydantic AI framework extension Jul 29, 2025
@phdargen
Copy link
Contributor

Hi @Ilevk, thanks for your contribution! Looks great, a few initial comments below before I do some testing.

@phdargen
Copy link
Contributor

Note that we require signed commits. See here for instructions on setting up commit signing. Once setup, rebase against main to re-sign all commits.

@Ilevk Ilevk requested a review from phdargen July 30, 2025 07:46
@Ilevk Ilevk force-pushed the main branch 3 times, most recently from 81d38cd to c8edafc Compare July 30, 2025 09:12
@Ilevk
Copy link
Contributor Author

Ilevk commented Jul 30, 2025

I rebased all commits

@phdargen
Copy link
Contributor

Thanks for the updates @Ilevk ! Will test it later today.

It would be great if you could also add a few basic unit tests as in https://github.com/coinbase/agentkit/tree/main/python/framework-extensions/openai-agents-sdk/tests

"ignore::pydantic.PydanticDeprecatedSince20",
]

[tool.uv]
Copy link
Contributor

@phdargen phdargen Jul 31, 2025

Choose a reason for hiding this comment

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

can [tool.uv] be removed? mypy, ruff dependencies already in [dependency-groups] with conflicting versions. seems

 "ruff>=0.7.1,<0.8",
   "mypy>=1.13.0,<2",

also used in other frameworks (https://github.com/coinbase/agentkit/blob/main/python/framework-extensions/strands-agents/pyproject.toml), better stick to those I think

Copy link
Contributor Author

@Ilevk Ilevk Jul 31, 2025

Choose a reason for hiding this comment

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

Thank you for comments!

@phdargen
Copy link
Contributor

Also a link to pydantic ai docs would be good in framework and chatbot readme

@Ilevk
Copy link
Contributor Author

Ilevk commented Jul 31, 2025

  • d8aa695: Remove duplicated dependencies, Add pydantic ai docs link to README
  • 946e648: Add some test cases

@phdargen
Copy link
Contributor

Thanks for the quick turnaround @Ilevk, great job! I tested it and think its good to go @CarsonRoscoe

@phdargen phdargen mentioned this pull request Aug 4, 2025
7 tasks
@Ilevk Ilevk force-pushed the main branch 2 times, most recently from bf8fbd4 to e7f0d8f Compare August 5, 2025 07:11
@logan-d-able
Copy link

logan-d-able commented Aug 5, 2025

@phdargen I've rebased this PR with main to apply Agentkit 0.7.1

@phdargen
Copy link
Contributor

phdargen commented Aug 5, 2025

@phdargen I've rebased this PR with main to apply Agentkit 0.7.1

Thanks! @CarsonRoscoe could you please approve the workflow to see if the tests pass?

@Ilevk
Copy link
Contributor Author

Ilevk commented Aug 14, 2025

@CarsonRoscoe Hey how's it going? please let me know what should I do.

@phdargen
Copy link
Contributor

@CarsonRoscoe Hey how's it going? please let me know what should I do.

Hi @Ilevk, I checked out your code and ran uv sync in framework-extensions/pydantic-ai/ and examples/pydantic-ai-cdp-chatbot, then committed the uv.lock files. It appears that this would pass the checks now, see #826.

Is this what you tried before?

@phdargen
Copy link
Contributor

Hi @CarsonRoscoe @murrlincoln, could you please approve this workflow to check if this passes now?

Copy link
Contributor

@CarsonRoscoe CarsonRoscoe left a comment

Choose a reason for hiding this comment

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

Hey guys, apologies for not following up on this.

Re-ran the workflow, still the issue here. @phdargen though has this working in #826, which is just branched off your commit.

I'm leaning towards merging phdargen's PR. It retains your authorship, it just adds one commit to fix the lock file. You would still be considered the author of your commits.

If this is fine with you, let me know and we'll get it in asap. Alternatively, try to run phdargen's steps/steal his commit from his PR and we'll get it in

Thank you two for your patience

@Ilevk
Copy link
Contributor Author

Ilevk commented Aug 17, 2025

I've cherry-picked the 2b53ddcfrom #826.

Hi @Ilevk, I checked out your code and ran uv sync in framework-extensions/pydantic-ai/ and examples/pydantic-ai-cdp-chatbot, then committed the uv.lock files. It appears that this would pass the checks now, see #826.

Is this what you tried before?

@Ilevk
Copy link
Contributor Author

Ilevk commented Aug 17, 2025

I got it, my uv version is too outdated, I used 0.4.25. I've just upgraded it to latest

I'm afraid of failing checking uv lock ci, because I've just re-run uv sync I found that sub-dependencies has been changed.

image

there's another issues, I think checking uv.lock is too sensitive, the dependencies that we didn’t define explicitly would be changed depending on when ci workflow run.

For example, whenever sub-dependency’s version updated, the meta data will be changed, url, hash, size, upload-time.

If we couldn’t trust uv dependency management system, the present way is good way. but if we could, we should check the dependencies that we define explicitly only.

or we can change the condition to trigger lint ci workflow, when right after pull request opened, update, push commit.

@Ilevk
Copy link
Contributor Author

Ilevk commented Aug 20, 2025

@CarsonRoscoe Could you take a look at my comments?

I guess the commit I cherry-picked isn’t working at the moment.

If it fails again this time, it would be fine to merge the PR from @phdargen (#826).

I really appreciate it! 😊

Copy link
Contributor

@CarsonRoscoe CarsonRoscoe 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 your contribution! Looking good!

@CarsonRoscoe CarsonRoscoe merged commit 20b6a15 into coinbase:main Aug 21, 2025
26 checks passed
@Ilevk
Copy link
Contributor Author

Ilevk commented Aug 22, 2025

Finally It's done.

it couldn't have done without your support. Thank you!

@phdargen @CarsonRoscoe

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

Labels

documentation Improvements or additions to documentation example New example agent framework extension New framework extension python

Development

Successfully merging this pull request may close these issues.

Add Framework-extension for PydanticAI

5 participants