1818from pydantic import Field as PydanticField
1919from pydantic .json_schema import SkipJsonSchema
2020from pydantic .main import IncEx
21- from sqlalchemy import (
22- Boolean ,
23- Column ,
24- DateTime ,
25- Float ,
26- Numeric ,
27- String ,
28- func ,
29- select ,
30- )
21+ from sqlalchemy import Boolean , DateTime , Float , Numeric , String , func , select
3122from sqlalchemy .dialects .postgresql import JSON , JSONB
3223from sqlalchemy .exc import IntegrityError
3324from sqlalchemy .ext .asyncio import AsyncSession
25+ from sqlalchemy .orm import Mapped , mapped_column
3426
3527from intentkit .models .agent_data import AgentData
3628from intentkit .models .base import Base
@@ -184,133 +176,133 @@ class AgentUserInputColumns:
184176 __abstract__ = True
185177
186178 # Basic information fields from AgentCore
187- name = Column (
179+ name : Mapped [ str | None ] = mapped_column (
188180 String ,
189181 nullable = True ,
190182 comment = "Display name of the agent" ,
191183 )
192- picture = Column (
184+ picture : Mapped [ str | None ] = mapped_column (
193185 String ,
194186 nullable = True ,
195187 comment = "Picture of the agent" ,
196188 )
197- purpose = Column (
189+ purpose : Mapped [ str | None ] = mapped_column (
198190 String ,
199191 nullable = True ,
200192 comment = "Purpose or role of the agent" ,
201193 )
202- personality = Column (
194+ personality : Mapped [ str | None ] = mapped_column (
203195 String ,
204196 nullable = True ,
205197 comment = "Personality traits of the agent" ,
206198 )
207- principles = Column (
199+ principles : Mapped [ str | None ] = mapped_column (
208200 String ,
209201 nullable = True ,
210202 comment = "Principles or values of the agent" ,
211203 )
212204
213205 # AI model configuration fields from AgentCore
214- model = Column (
206+ model : Mapped [ str | None ] = mapped_column (
215207 String ,
216208 nullable = True ,
217209 default = "gpt-5-mini" ,
218210 comment = "AI model identifier to be used by this agent for processing requests. Available models: gpt-4o, gpt-4o-mini, deepseek-chat, deepseek-reasoner, grok-2, eternalai" ,
219211 )
220- prompt = Column (
212+ prompt : Mapped [ str | None ] = mapped_column (
221213 String ,
222214 nullable = True ,
223215 comment = "Base system prompt that defines the agent's behavior and capabilities" ,
224216 )
225- prompt_append = Column (
217+ prompt_append : Mapped [ str | None ] = mapped_column (
226218 String ,
227219 nullable = True ,
228220 comment = "Additional system prompt that has higher priority than the base prompt" ,
229221 )
230- temperature = Column (
222+ temperature : Mapped [ float | None ] = mapped_column (
231223 Float ,
232224 nullable = True ,
233225 default = 0.7 ,
234226 comment = "Controls response randomness (0.0~2.0). Higher values increase creativity but may reduce accuracy. For rigorous tasks, use lower values." ,
235227 )
236- frequency_penalty = Column (
228+ frequency_penalty : Mapped [ float | None ] = mapped_column (
237229 Float ,
238230 nullable = True ,
239231 default = 0.0 ,
240232 comment = "Controls repetition in responses (-2.0~2.0). Higher values reduce repetition, lower values allow more repetition." ,
241233 )
242- presence_penalty = Column (
234+ presence_penalty : Mapped [ float | None ] = mapped_column (
243235 Float ,
244236 nullable = True ,
245237 default = 0.0 ,
246238 comment = "Controls topic adherence (-2.0~2.0). Higher values allow more topic deviation, lower values enforce stricter topic adherence." ,
247239 )
248240
249241 # Wallet and network configuration fields from AgentCore
250- wallet_provider = Column (
242+ wallet_provider : Mapped [ str | None ] = mapped_column (
251243 String ,
252244 nullable = True ,
253245 comment = "Provider of the agent's wallet" ,
254246 )
255- readonly_wallet_address = Column (
247+ readonly_wallet_address : Mapped [ str | None ] = mapped_column (
256248 String ,
257249 nullable = True ,
258250 comment = "Readonly wallet address of the agent" ,
259251 )
260- network_id = Column (
252+ network_id : Mapped [ str | None ] = mapped_column (
261253 String ,
262254 nullable = True ,
263255 default = "base-mainnet" ,
264256 comment = "Network identifier" ,
265257 )
266258
267259 # Skills configuration from AgentCore
268- skills = Column (
260+ skills : Mapped [ dict [ str , Any ] | None ] = mapped_column (
269261 JSON ().with_variant (JSONB (), "postgresql" ),
270262 nullable = True ,
271263 comment = "Dict of skills and their corresponding configurations" ,
272264 )
273265
274266 # Additional fields from AgentUserInput
275- short_term_memory_strategy = Column (
267+ short_term_memory_strategy : Mapped [ str | None ] = mapped_column (
276268 String ,
277269 nullable = True ,
278270 default = "trim" ,
279271 comment = "Strategy for managing short-term memory when context limit is reached. 'trim' removes oldest messages, 'summarize' creates summaries." ,
280272 )
281- autonomous = Column (
273+ autonomous : Mapped [ dict [ str , Any ] | None ] = mapped_column (
282274 JSON ().with_variant (JSONB (), "postgresql" ),
283275 nullable = True ,
284276 comment = "Autonomous agent configurations" ,
285277 )
286- telegram_entrypoint_enabled = Column (
278+ telegram_entrypoint_enabled : Mapped [ bool | None ] = mapped_column (
287279 Boolean ,
288280 nullable = True ,
289281 default = False ,
290282 comment = "Whether the agent can receive events from Telegram" ,
291283 )
292- telegram_entrypoint_prompt = Column (
284+ telegram_entrypoint_prompt : Mapped [ str | None ] = mapped_column (
293285 String ,
294286 nullable = True ,
295287 comment = "Extra prompt for telegram entrypoint" ,
296288 )
297- telegram_config = Column (
289+ telegram_config : Mapped [ dict [ str , Any ] | None ] = mapped_column (
298290 JSON ().with_variant (JSONB (), "postgresql" ),
299291 nullable = True ,
300292 comment = "Telegram integration configuration settings" ,
301293 )
302- discord_entrypoint_enabled = Column (
294+ discord_entrypoint_enabled : Mapped [ bool | None ] = mapped_column (
303295 Boolean ,
304296 nullable = True ,
305297 default = False ,
306298 comment = "Whether the agent can receive events from Discord" ,
307299 )
308- discord_config = Column (
300+ discord_config : Mapped [ dict [ str , Any ] | None ] = mapped_column (
309301 JSON ().with_variant (JSONB (), "postgresql" ),
310302 nullable = True ,
311303 comment = "Discord integration configuration settings" ,
312304 )
313- xmtp_entrypoint_prompt = Column (
305+ xmtp_entrypoint_prompt : Mapped [ str | None ] = mapped_column (
314306 String ,
315307 nullable = True ,
316308 comment = "Extra prompt for xmtp entrypoint" ,
@@ -322,128 +314,128 @@ class AgentTable(Base, AgentUserInputColumns):
322314
323315 __tablename__ = "agents"
324316
325- id = Column (
317+ id : Mapped [ str ] = mapped_column (
326318 String ,
327319 primary_key = True ,
328320 comment = "Unique identifier for the agent. Must be URL-safe, containing only lowercase letters, numbers, and hyphens" ,
329321 )
330- slug = Column (
322+ slug : Mapped [ str | None ] = mapped_column (
331323 String ,
332324 nullable = True ,
333325 comment = "Slug of the agent, used for URL generation" ,
334326 )
335- owner = Column (
327+ owner : Mapped [ str | None ] = mapped_column (
336328 String ,
337329 nullable = True ,
338330 comment = "Owner identifier of the agent, used for access control" ,
339331 )
340- upstream_id = Column (
332+ upstream_id : Mapped [ str | None ] = mapped_column (
341333 String ,
342334 index = True ,
343335 nullable = True ,
344336 comment = "Upstream reference ID for idempotent operations" ,
345337 )
346- upstream_extra = Column (
338+ upstream_extra : Mapped [ dict [ str , Any ] | None ] = mapped_column (
347339 JSON ().with_variant (JSONB (), "postgresql" ),
348340 nullable = True ,
349341 comment = "Additional data store for upstream use" ,
350342 )
351- version = Column (
343+ version : Mapped [ str | None ] = mapped_column (
352344 String ,
353345 nullable = True ,
354346 comment = "Version hash of the agent" ,
355347 )
356- statistics = Column (
348+ statistics : Mapped [ dict [ str , Any ] | None ] = mapped_column (
357349 JSON ().with_variant (JSONB (), "postgresql" ),
358350 nullable = True ,
359351 comment = "Statistics of the agent, update every 1 hour for query" ,
360352 )
361- assets = Column (
353+ assets : Mapped [ dict [ str , Any ] | None ] = mapped_column (
362354 JSON ().with_variant (JSONB (), "postgresql" ),
363355 nullable = True ,
364356 comment = "Assets of the agent, update every 1 hour for query" ,
365357 )
366- account_snapshot = Column (
358+ account_snapshot : Mapped [ dict [ str , Any ] | None ] = mapped_column (
367359 JSON ().with_variant (JSONB (), "postgresql" ),
368360 nullable = True ,
369361 comment = "Account snapshot of the agent, update every 1 hour for query" ,
370362 )
371- extra = Column (
363+ extra : Mapped [ dict [ str , Any ] | None ] = mapped_column (
372364 JSON ().with_variant (JSONB (), "postgresql" ),
373365 nullable = True ,
374366 comment = "Other helper data fields for query, come from agent and agent data" ,
375367 )
376368
377369 # Fields moved from AgentUserInputColumns that are no longer in AgentUserInput
378- description = Column (
370+ description : Mapped [ str | None ] = mapped_column (
379371 String ,
380372 nullable = True ,
381373 comment = "Description of the agent, for public view, not contained in prompt" ,
382374 )
383- external_website = Column (
375+ external_website : Mapped [ str | None ] = mapped_column (
384376 String ,
385377 nullable = True ,
386378 comment = "Link of external website of the agent, if you have one" ,
387379 )
388- ticker = Column (
380+ ticker : Mapped [ str | None ] = mapped_column (
389381 String ,
390382 nullable = True ,
391383 comment = "Ticker symbol of the agent" ,
392384 )
393- token_address = Column (
385+ token_address : Mapped [ str | None ] = mapped_column (
394386 String ,
395387 nullable = True ,
396388 comment = "Token address of the agent" ,
397389 )
398- token_pool = Column (
390+ token_pool : Mapped [ str | None ] = mapped_column (
399391 String ,
400392 nullable = True ,
401393 comment = "Pool of the agent token" ,
402394 )
403- fee_percentage = Column (
395+ fee_percentage : Mapped [ Decimal | None ] = mapped_column (
404396 Numeric (22 , 4 ),
405397 nullable = True ,
406398 comment = "Fee percentage of the agent" ,
407399 )
408- example_intro = Column (
400+ example_intro : Mapped [ str | None ] = mapped_column (
409401 String ,
410402 nullable = True ,
411403 comment = "Introduction for example interactions" ,
412404 )
413- examples = Column (
405+ examples : Mapped [ dict [ str , Any ] | None ] = mapped_column (
414406 JSON ().with_variant (JSONB (), "postgresql" ),
415407 nullable = True ,
416408 comment = "List of example interactions for the agent" ,
417409 )
418- public_extra = Column (
410+ public_extra : Mapped [ dict [ str , Any ] | None ] = mapped_column (
419411 JSON ().with_variant (JSONB (), "postgresql" ),
420412 nullable = True ,
421413 comment = "Public extra data of the agent" ,
422414 )
423- deployed_at = Column (
415+ deployed_at : Mapped [ datetime | None ] = mapped_column (
424416 DateTime (timezone = True ),
425417 nullable = True ,
426418 comment = "Timestamp when the agent was deployed" ,
427419 )
428- public_info_updated_at = Column (
420+ public_info_updated_at : Mapped [ datetime | None ] = mapped_column (
429421 DateTime (timezone = True ),
430422 nullable = True ,
431423 comment = "Timestamp when the agent public info was last updated" ,
432424 )
433- x402_price = Column (
425+ x402_price : Mapped [ float | None ] = mapped_column (
434426 Float ,
435427 nullable = True ,
436428 comment = "Price of the x402 request" ,
437429 )
438430
439431 # auto timestamp
440- created_at = Column (
432+ created_at : Mapped [ datetime ] = mapped_column (
441433 DateTime (timezone = True ),
442434 nullable = False ,
443435 server_default = func .now (),
444436 comment = "Timestamp when the agent was created" ,
445437 )
446- updated_at = Column (
438+ updated_at : Mapped [ datetime ] = mapped_column (
447439 DateTime (timezone = True ),
448440 nullable = False ,
449441 server_default = func .now (),
0 commit comments