This guide provides comprehensive information for Large Language Models (LLMs) working with the IntentKit autonomous agent framework.
IntentKit is an autonomous agent framework that enables creation and management of AI agents with capabilities.
-
IntentKit Package (
intentkit/)- The intentkit/ folder is published as a pip package.
- The core/ folder contains the agent system, driven by LangGraph.
- The models/ folder houses the entity models, most of it both have padantic models for memory use and sqlalchemy models for storage.
- The config/ folder contains the system level config, like database config, LLM provider api keys and skill provider api keys.
- The skills/ folder contains the skills system, driven by LangChain's BaseTool. LLM can call skills to fetch data, perform actions, or interact with the environment.
- The utils/ folder contains the utility functions, like logging, formatting, etc.
- The abstracts/ folder contains interfaces, for core/ and skills/ use.
-
IntentKit App (
app/)- The app/ folder contains API server, autonomous runner, and background scheduler.
- User can use intentkit package in their own project for customization, or just start the intentkit app for default features.
-
Operation or Temporary Scripts (
scripts/)- Agent management scripts
- Manual scripts for potential use
- Migration scripts
-
Integration Tests (
tests/)- Core package testing in
tests/core/ - API server testing in
tests/api/ - Skill integration testing in
tests/skills/
- Core package testing in
- Package manager: uv, please use native
uvcommand, do not use theuv pipcommand. If you want run or test python script, useuv runcommand, don't directly using python command. - Lint: ruff, run
uv run ruff format & uv run ruff check --fixafter your final edit. - API framework: fastapi, Doc in https://fastapi.tiangolo.com/
- DB ORM: SQLAlchemy 2.0, please check the 2.0 api for use, do not use the legacy way. Doc in https://docs.sqlalchemy.org/en/20/
- Model: Pydantic V2, Also be careful not to use the obsolete V1 interface. Doc in https://docs.pydantic.dev/latest/
- Testing Framework: pytest
- Always use the latest version of the new package.
- Always use English for code comments.
- Always use English to search.
- Unless I specifically ask you to do so, do not git commit after coding.
- Skills are in the
intentkit/skills/folder. Each folder is a category. Each skill category can contain multiple skills. A category can be a theme or a brand. - To avoid circular dependencies, Skills can only depend on the contents of models, abstracts, utils, and clients.
- The necessary elements in a skill category folder are as follows. For the paradigm of each element, you can refer to existing skills, such as skills/twitter
base.py: Base class inheritIntentKitSkill. If there are functions that are common to this category, they can also be written in BaseClass. A common example is get_api_key- Then every skill can have it's own file, with the same name as the skill. Key points:
- The skill class inherit BaseClass created in base.py
- The
nameattribute need a same prefix as the category name, such astwitter_, for uniqueness in the system. - The
descriptionattribute is the description of the skill, which will be used in LLM to select the skill. - The
args_schemaattribute is the pydantic model for the skill arguments. - The
_arunmethod is the main logic of the skill. There is special parameterconfig: RunnableConfig, which is used to pass the LangChain runnable config. There is functioncontext_from_configin IntentKitSkill, can be used to get the context from the runnable config. In the _arun method, if there is any exception, just raise it, and the exception will be handled by the Agent. If the return value is not a string, you can document it in the description attribute.
- The
__init__.pymust have the functionasync def get_skills( config: "Config", is_private: bool, store: SkillStoreABC, **_,) -> list[OpenAIBaseTool]- Config is inherit from
SkillConfig, and thestatesis a dict, key is the skill name, value is the skill state. If the skill category have any other config fields need agent creator to set, they can be added to Config. - If the skill is stateless, you can add a global _cache for it, to avoid re-create the skill object every time.
- Config is inherit from
- A square image is needed in the category folder.
- Add schema.json file for the config, since the Config inherit from SkillConfig, you can check examples in exists skill category to find out the pattern.
- There is no need to catch exceptions in skills, because the agent has a dedicated module to catch skill exceptions. If you need to add more information to the exception, you can catch it and re-throw the appropriate exception.
- run
uv run ruff format && uv run ruff check --fixbefore commit. - When you generate git commit message, always start with one of feat/fix/chore/docs/test/refactor/improve. Title Format:
<type>: <subject>, subject should start with lowercase. Only one-line needed, do not generate commit message body.
- If there are uncommited changes, add them and commit them.
- Push to remote branch.
- Pull origin/main, so you can summarize the changes for pull request title and description.
- Create a pull request with MCP tools.
- Please use gh command to do it.
- Make a
git pullfirst. - The release number rule is: pre-release is vX.X.X-devX, release is vX.X.X.
- Find the last version number in release or pre-release using
git tag --sort=-version:refname | head -10, diff origin/main with it, summarize the release note to build/changelog.md for later use. Calculate the version number of this release. Add a diff link to release note too, the from and to should be the version number. - And also insert the release note to the beginning of CHANGELOG.md (This file contains all history release notes, don't use it in gh command), leave this changed CHANGELOG.md in local, don't commit and push it, we will commit it together with next changes.
- Construct
gh release createcommand, calculate the next version number, use changelog.md as notes file in gh command. - Use gh to do release only, don't create branch, tag, or pull request.